Saturday, February 25, 2012

Alter column name from SQL?

How can you rename a column in a table (from c# code, preferrably from a SQL script command) without deleting the column and re-creating it with a new name?

Hello,

SQL Server contains a system stored procedure called SP_RENAME which can be used to rename user created object (tables, column, sp's, ...)

For more information, look at the BOL documentation on the subject http://msdn2.microsoft.com/en-us/library/ms188351.aspx (this is the 2005 version, but the system stored procedure also exist in previous version of SQL server)

Hope this helps,

|||Unfortunately this is not implemented in SQL Everywhere - you can only access the renaming APIs via OLE DB. You can always write a wrapper for .NET as I did.|||Guess I reacted to hasty. Thanks for the correction.|||

As of now we don't have direct method (e.g. SP support) for renaming column in SQL Server Everywhere Edition.

Thanks
Sachin

No comments:

Post a Comment