I tried to update the column name for a field in a table in SQL Server. I received the following error.
SQL Error (4902): Cannot find the object "dbo.state" because it does not exist or you do not have permissions.
The SQL code generated was this:
ALTER TABLE "dbo"."state" ALTER COLUMN "circuit_court1" VARCHAR(255) NULL;
I saw a recommendation to use the sp_rename for changing a field name in SQL Server.
EXEC sp_RENAME 'table_name.old_field_name','new_field_name','COLUMN'
That command worked. Wanted to let you know in case there was a away to implement that into your program.
MS Sql Update Field Names
Going through the "Other Versions" on this page:
http://technet.microsoft.com/en-us/library/ms188351(v=sql.105).aspx
it seems like the sp_rename should work on versions from 2005 up.
http://technet.microsoft.com/en-us/library/ms188351(v=sql.105).aspx
it seems like the sp_rename should work on versions from 2005 up.
Please login to leave a reply, or register at first.