What VB.net code would I use to rename a SQL table
Thanks
Visual Basic.NETMicrosoft SQL Server
Last Comment
arnold
8/22/2022 - Mon
arnold
You have to make sure there are constraints,indexes, etc. that could prevent,
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
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