ALTER TABLE [TEMP]
SP_RENAME '[TEMP].[Day]', 'GT', 'COLUMN'
I am trying to rename Day to GT and am getting the error
Incorrect syntax near 'SP_RENAME'
SQL Server Management Studio says the error is on SP_RENAME
NOTE: I'm open to other options…
I say 'issue' because it's not breaking anything, it's merely a small thing I've noticed in SSMS.
I run the following:
SP_RENAME 'MyTable.OldName', 'NewName' , 'COLUMN'
And then type the following in SSMS:
SELECT [NewName] FROM MyTable;
The…
I am trying to use the sp_rename stored procedure with a variable since I do not have control over the source (an Excel file that changes the column name to have a date).
I drop a table, and then import that table. I then want to change the column…
There appears to be several stored procedures that were renamed with sp_rename, causing the syscomments to be left with the old proc name instead of the new proc name.
Thus, my db transfers are failing to transfer correctly.
Is there a way to find…
I'm coding in C# in ASP.NET environment and I need to write a function that takes SQL Server database table and gives it another name.
So from SQL standpoint I need to do this:
EXEC sp_rename 'OldTableName', 'NewTableName';
But the problem is that…
I am running the following query:
SELECT * INTO dbo.2015_10_2_cs FROM dbo.2015_10_2
IF NOT EXISTS
(SELECT type FROM sys.indexes WHERE object_id = object_id('dbo.2015_10_2_cs')
AND NAME ='cci' AND type = 5)
BEGIN
CREATE CLUSTERED COLUMNSTORE…
I recently used - EXEC sp_rename '', '' to rename an existing table and want to execute the same on one of our live server. Is there any issue in using this procedure to rename a table?. I am asking this…
I just moved my Member table from MRK schema to GNR.
I previously had the script below to set its primary key:
If not Exists (select 1
from sys.objects
where name = 'PK_MRK_Member'
)
ALTER TABLE…
Wanted to see if I could get some help concerning altering and renaming tables in MSSQL Server 2008. I am getting an error message on the sp_name syntax and maybe I am doing something wrong?
-- Archives data existing one week ago and then…
I have a SQL Server database employeedb and table employee with column EmployeeID whose value I need to update and simultaneously rename that column.
EmployeeID
-----------
83456785647
I need to add a '-' 2 digit places from the end and rename…
I have several tables whose names end with .csv. I.e. schema.table1.csv, schema.table2.csv.
How can I remove the .csv or rename them without the offending characters?
Per this SO question I tried this:
exec sp_rename @objname =…
I try to rename my column name with the firt row of my table.
(I know, it do not make sense 'a first row without order by' in SQL, but I have to do this for my test).
So, I wan't to search dynamically my old and my new column names to execute…
I'm trying to change a series of table names in Microsoft SQL Server 2017 Standard edition using Microsoft SQL Server Management Studio 2018.
The code I've been transmitting is based on the following code:
use DatabaseX
declare @RunRW…
I'm trying to rename a table using sp_rename but I am getting the following error when executing the query:
DECLARE @DateValue INT
SET @DateValue = CONVERT(VARCHAR(8), GETDATE()-1, 112)
DECLARE @ArchiveTableName VARCHAR(255)
SET …
I have searched and searched and cannot work out how to resolve my problem. I am actually not sure it is possible but thought I'd post here and check.
The issue:
I have a stored procedure where I make the following call (there are 2 because I was…