Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Re-create the table, but preserve the data
Message
General information
Forum:
Microsoft SQL Server
Category:
SQL syntax
Environment versions
SQL Server:
SQL Server 2005
Miscellaneous
Thread ID:
01321355
Message ID:
01321655
Views:
14
This message has been marked as a message which has helped to the initial question of the thread.
>>Did you have any constraints of that table?
>>If not then you could use this (after a really good test of course)
>>
>>SELECT * INTO dbo.Tmp_YourTable FROM YourTable
>>GO
>>DROP TABLE dbo.YourTable
>>GO
>>EXECUTE sp_rename N'dbo.Tmp_YourTable', N'YourTable', 'OBJECT'
>>GO
>>
>
>Still not exactly clear. I guess I could have tried select *, extra new fields into temptable and then rename...
>
>But I do have constraints.
>
>Anyway, I have a new more complex question now (sort of interface question), so I'll ask in a new thread.

BTW why you need to DROP table?
Isn't ALTER TABLE work for you?
Against Stupidity the Gods themselves Contend in Vain - Johann Christoph Friedrich von Schiller
The only thing normal about database guys is their tables.
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform