Hi guys i want to get alter index statement from my select
In order to do thAT I have this,
select 'ALTER INDEX '+name+ ' ON'+' rebuild' from sys.indexes
where object_id = (select object_id from sys.objects where name = 'TABLE_NAME')
name is not null
the output is
ALTER INDEX index_name ON rebuild
IT SHOULD BE;
ALTER INDEX index_name ON TABLE_NAME rebuild
I'm missing the table name part. I tried to use INFORMATION_SCHEMA.columns.TABLE_NAME but it did not work since it produces 3 index statements (because i have three tables). Any suggestions ?
Thanks in advance ....