Monday, January 27, 2014

SP with input parameters to disable and enable indexes

We do this by means of SQL Server agent job.


We have a logic like below




DECLARE @IndexScript varchar(max)

SELECT @IndexScript= STUFF((SELECT '; ALTER INDEX ALL ON ' + schemaname + '.' + tablename + ' DISABLE'
FROM table
WHERE Flag='y'
FOR XML PATH('')),1,1,'')
EXEC(@IndexScript)





Please Mark This As Answer if it helps to solve the issue Visakh ---------------------------- http://ift.tt/19nLNVq http://ift.tt/1iEAj0c


No comments:

Post a Comment