Created
October 23, 2018 17:31
-
-
Save kimsk/9308a24058547331a50f495d3d8baf52 to your computer and use it in GitHub Desktop.
generate sp_rename tables in schema
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| SELECT 'exec sp_rename ''' + t1.name + '.' + t2.name + ''', ''_' + t2.name + ''';' | |
| FROM sys.schemas t1 | |
| INNER JOIN sys.tables t2 | |
| ON t2.schema_id = t1.schema_id | |
| WHERE t1.name = 'Measurements' | |
| ORDER BY t1.name,t2.name |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment