I want to rename a table in SQL Server. I know the proper syntax would be:
sp_rename 'old table name','new table name';
Would it make any difference if I write it this way?:
EXEC sp_rename 'old table name','new table name';
I tried running it on SQL Server and without the EXEC
, it would highlight my syntax sp_rename
with red, but it doesn't throw any error.
Can anyone suggest the proper way or any other alternatives to rename a table?
Note: I know altering table name will affect or probably break the script and stored procedure, is there any way to prevent this? Or it only breaks if there is another table dependent on it?