March 14, 2014 at 7:02 am
How to create a script to input one table name(already indexed) to get list of all index for that table?
March 14, 2014 at 7:13 am
just a list of indexes, or the scripts for the indexes?
just the list:
select * from sys.indexes where object_name(object_id) = 'EDLogDetail'
scripting the indexes is a little harder, there's a lot of settings to dig for. there's quite a few examples in the scripts section here on SSC:
http://www.sqlservercentral.com/search/?q=script+indexes&t=s&sort=relevance
Lowell
March 14, 2014 at 7:20 am
I ran your script, it list index for that table. I need it.
Can you tell me how to generate index scripts for one table? I need to apply the scripts for the same table but in another server.
March 14, 2014 at 7:25 am
adonetok (3/14/2014)
I ran your script, it list index for that table. I need it.Can you tell me how to generate index scripts for one table? I need to apply the scripts for the same table but in another server.
create a dynamic sql script to iterate through all the tables (in all databases if need be) and insert into a table the location that you want. this is a pretty straight forward thing you want to do actually.
March 14, 2014 at 7:26 am
if you don't want to browse the scripts section i mentioned, the easiest way is to use SSMS: In SSMS2012, make sure the scripting option for script indexes is true in Tools>>Options>>SQL Server Object Explorer>>Scripting t.
then just right click the table, choose "Script Table As" and copy and paste the index code generated on the other server.
Lowell
March 14, 2014 at 7:33 am
Thank you. It works for me.
Viewing 6 posts - 1 through 5 (of 5 total)
You must be logged in to reply to this topic. Login to reply