ALTER PROCEDURE [dbo].[sprocUpdateStatusInProductMaster]
@List nvarchar(4000) -- value assigned to @List from DataLayer
AS
BEGIN
declare @ProdId2 int;
declare @Status2 nvarchar(100);
declare @CountRows int;
mailto:declare@val int;
declare @i int;
set @i = 1;
-- format of @List is @List = {1,True;2,False;3,True;4,False;5,False;}
-- execute sprocUpdateStatusInProductMaster ';1,True;2,False;3,True;4,False;5,False;'
set @List = ltrim(rtrim(Substring(@List,CharIndex(';',@List)+1,Len(@List)))); -- to eliminate the first semicolon ;
while(len(@List)>0)
BEGIN
set @ProdId2 = ltrim(rtrim(Substring(@List,1,CharIndex(',',@List)-1)));
set @List = ltrim(rtrim(Substring(@List,len(@ProdId2)+2,len(@List))));
set @Status2 = ltrim(rtrim(Substring(@List,1,CharIndex(';',@List)-1)));
set @List = ltrim(rtrim(Substring(@List,len(@Status2)+2,len(@List))));
update tblProductMaster set IsActive = @Status2
where ProductID = @ProdId2;
END
END
Google Brother Up
Subscribe to:
Post Comments (Atom)
Drop Down List
1. http://www.janetsystems.co.uk/Articles/NetArticles/tabid/74/itemid/161/modid/449/Default.aspx
No comments:
Post a Comment