Posted by frien on 12/11/06 03:43
I want to create a stored procedure to find if the index exists if not
i have to create the index....i use following stored procedure....but
does'nt seem to be working.......but when i hard code the query it does
work... can u plz tell me were i am going wrong
CREATE PROCEDURE [dbo].[sd_find_create_ind]
@tblName varchar(255),
@colName varchar(255),
@indName varchar(255)
AS
declare @query varchar(1024)
select @query = 'IF indexproperty(object_id('+@tblName+'),
'+@indName+', ''IsClustered'') IS NULL
CREATE INDEX '+@indName+' ON '+@tblName+'('+@colName+')'
GO
thanks a lot
[Back to original message]
|