select 'ALTER SCHEMA dbo TRANSFER ' + s.Name+ '.' + p.Name
FROM sys.tables p
inner join
sys.Schemas s on p.schema_id = s.schema_id
Result :
- ALTER SCHEMA dbo TRANSFER aniSchema.video_master
- ALTER SCHEMA dbo TRANSFER aniSchema.enquiry_master
- ALTER SCHEMA dbo TRANSFER aniSchema.blog_master
OR
For tables and views
SELECT 'ALTER SCHEMA dbo TRANSFER ' + TABLE_SCHEMA + '.' + TABLE_NAME FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_SCHEMA = 'aniSchema'
And do the above step after getting the result
0 comments:
Post a Comment