Click here to Skip to main content
15,894,198 members
Please Sign up or sign in to vote.
5.00/5 (1 vote)
See more:
Hi Friends,

I have one Table like ShownBelow...

SQL
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

SQL
Domain Name	Min Years	MaxYears
.com                2               10
.net                4               12
.co                 1               13
.buz                1               13
Posted
Updated 4-Jan-13 2:52am
v2

AFAIK, there is no split function is SQL Server.

However something like this[^] might help you.
 
Share this answer
 
Hi,

See this also:

SQL
declare @str varchar(100)
set @str = "val1_val2,val3_val4"


declare @str varchar(100) = 'val1_val2,val3_val4'

select substring(f.value, 0, charindex('_', f.value)) as val1
      ,substring(f.value, charindex('_', f.value) + 1, LEN(f.value) ) as val2
from dbo.fnSplitString(@str, ',') f


Checkout this link too.
Arrays and Lists in SQL Server

Thanks
 
Share this answer
 
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900