Murray Brown
asked on
VB.net Rename a SQL table
Hi
What VB.net code would I use to rename a SQL table
Thanks
What VB.net code would I use to rename a SQL table
Thanks
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Great! Thanks very much
NOTE that you have to check for errors, as constraints, foreign keys, indexes, etc. could through an error denying the change. To change the table name in such circumstances, index, statistics, constraints, triggers have to be dropped.
You would issue "alter table tablename rename to new tablename"
Alternatively, you could create a new table using the old ones schema, copy the data, and drop the old table.
Or use the stored procedure, sp_rename old name,newname, table