Friday, 20 July 2012

how to delete more than one record at a time in store procedure

alter PROCEDURE UCUGrideviewDelete
    (
    @TABLE varchar(50),
    @COLUMNNAME varchar(50),
    @SCHEMA varchar(50),
    @VALUE varchar(max)     //value like(1,2)//
    )
   
AS
 SET NOCOUNT ON
 DECLARE @sql varchar(max)
    begin
    set @sql=('delete from '+@SCHEMA+'.'+@TABLE+' where '+@COLUMNNAME+' in('+@VALUE+')')
    exec(@sql)
     SET NOCOUNT OFF
    end

No comments:

Post a Comment