Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- declare @create_indexes nvarchar(max);
- set @create_indexes = N'';
- select
- @create_indexes = @create_indexes +
- 'create clustered index ' + quotename('IX_' + object_name(i.object_id)) +
- char(13) + char(10) +
- 'on ' + quotename(object_name(i.object_id)) + '(' + quotename(c.name) + ');' +
- char(13) + char(10) +
- 'go' +
- char(13) + char(10)
- from sys.indexes i
- inner join sys.columns c
- on i.object_id = c.object_id
- where i.type = 0
- and c.is_identity = 1;
- print @create_indexes;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement