This is my Technical area of troubleshooting and learning new Programming skills and many more. Here you will find answers for many new technologies like asp.net 2.0/3.5,4.0 C# access, mysql, Amazon Webservice ,Sql-server, JD Edwards, SAS, Salesforce, APIs, MVC and many more. please visit & discuss.
Monday, November 15, 2010
Parsing string variable in Where clause with commas
string variable in Where clause with commas
DECLARE @sTemp VARCHAR(1000)
DECLARE @psCSString VARCHAR(1000)
set @psCSString='dsdss,dsdd,sddsds,43443,dsdsd'
WHILE LEN(@psCSString) > 0
BEGIN
SET @sTemp = LEFT(@psCSString, ISNULL(NULLIF(CHARINDEX(',', @psCSString) - 1, -1),
LEN(@psCSString)))
SET @psCSString = SUBSTRING(@psCSString,ISNULL(NULLIF(CHARINDEX(',', @psCSString), 0),
LEN(@psCSString)) + 1, LEN(@psCSString))
-- INSERT INTO @otTemp VALUES (@sTemp)
select @sTemp
END
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment