May 20, 2011 at 7:11 am
HOW DO I CHANGE THE TABLE NAME WITH TSQL CODE?
THANKS
May 20, 2011 at 7:14 am
sp_rename
May 20, 2011 at 11:09 am
To rename a table
Exec sp_Rename 'schema.original_table_name','new_table_name','object'
Go
To rename a field
Exec sp_Rename 'schema.table_name.original_field_name','new_field_name','column'
Go
Note: The rule requiring [brackets] around partially invalid names (i.e. - dbo.[1_Table_Name]) should be used in the original name section of the statement, but DO NOT use it in the new name section of the statement.
Example:
Exec sp_Rename 'dbo.[1_table_name].[2_original_field_name]','3_new_field_name','column'
[font="Arial"]“Any fool can know. The point is to understand.”
- Albert Einstein
"DOH!"
- Homer Simpson[/font]
Viewing 3 posts - 1 through 2 (of 2 total)
You must be logged in to reply to this topic. Login to reply
This website stores cookies on your computer.
These cookies are used to improve your website experience and provide more personalized services to you, both on this website and through other media.
To find out more about the cookies we use, see our Privacy Policy