Hi Friends,
I have one Table like ShownBelow...
Domain Name Min Years MaxYears
.com 2 10
.net 4 12
.co 1 12
.buz 1 13
But Am passing parameter to stored procedure like this way .com,.net,.co
Now i need to split this value and check with database and again i need to return dataset like above table
Domain Name Min Years MaxYears
.com 2 10
.net 4 12
.co 1 13
.buz 1 13
Need your help friends...
Loading
Jignesh TrivediPosted Jan 7, 2013, 1:14 AM
try following code in your Store procedure
Declare @ListValues nvarchar(max) = '.com,.net,.co'
Declare @SplitBy nvarchar(5) = ','
Declare @Value nvarchar(max)
While (Charindex(@SplitBy,@ListValues)>0)
Begin
set @Value = ltrim(rtrim(Substring(@ListValues,1,Charindex(@SplitBy,@ListValues)-1)))
print @Value
-- @Value contain .com or .net or so on...
-- you may process your record here for duplication check etc...
Set @ListValues = Substring(@ListValues,Charindex(@SplitBy,@ListValues)+len(@SplitBy),len(@ListValues))
End
Set @Value = ltrim(rtrim(@ListValues))
print @Value
and one more thing you do want to return here?
hopr this will help you.