I recently had to rename a table (and column and FK / PK) in SQL Server 2000 without losing data. Apparently, there were no obvious T-SQL DDL statements to complete this action, so I used sp_rename to directly script with the names of the objects.
Was this the only solution to the problem? (other than giving the correct table name is doh!)
sp_rename is the right way to do this.
EXEC sp_rename 'Old_TableName', 'New_TableName'
.EXEC sp_rename 'Old_TableName', 'New_TableName' , , "alter tabel old_name to new_name"
, : , , .
, . , / ( , - ):
ALTER TABLE
, :
SELECT oldTable.oldField1 as newField1, ...
newTable (, , )
, .
Source: https://habr.com/ru/post/1697807/More articles:Самый быстрый способ получить производительность в VS 08 и С# - c#Disable run-time checking in Visual Studio - c ++automatic invalidation of request cache - cachingHow do you clone 'WebControls in C # .NET? - c #Is there a “best practice” for accessing another process in the OS via java? - javaWhat is the size limit of an application object in classic asp? - cachingHow would you implement ant-shaped patterns in python to select groups of files? - pythonКак отслеживать время реплицируемых строк для подписчиков в SQL Server 2005? - sql-serverWhy does ActiveRecord serialization accidentally distort my data? - ruby | fooobar.comSorting sets of ordered linked lists - language-agnosticAll Articles