SQL linked server

Brindha Thangavel 26 Reputation points
2021-10-07T20:53:31.077+00:00

Hi All,

I need to rename table name from cross server.I have linked server(Azure SQL server is the destination where I need to rename) in server object but I cannot rename using it.Could you please help me with the script for it.

Thanks,
Brindha

SQL Server
SQL Server
A family of Microsoft relational database management and analysis systems for e-commerce, line-of-business, and data warehousing solutions.
13,315 questions
0 comments No comments
{count} vote

Accepted answer
  1. Erland Sommarskog 106.5K Reputation points
    2021-10-07T21:39:14.987+00:00

    What do the linked server has to do with it?

    The normal thing to do would be to connect to the instance where the database resides, and run

    EXEC sp_rename 'MyTable', 'MyRenamedTable'
    

    If you want to do it across a linked server, you can do:

    EXEC SERVER.db.sys.sp_rename 'MyTable', 'MyRenamedTable'
    
    1 person found this answer helpful.
    0 comments No comments

1 additional answer

Sort by: Most helpful
  1. Brindha Thangavel 26 Reputation points
    2021-10-07T22:17:07.917+00:00

    Thanks much.second statement worked for rename table through Linked server.

    0 comments No comments