Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2008 Forums
 Transact-SQL (2008)
 sql server split

Author  Topic 

egemen_ates
Yak Posting Veteran

76 Posts

Posted - 2012-05-24 : 03:28:14
how can i split string?

for example

egemen.ates

value1=egemen
value2=ates

khtan
In (Som, Ni, Yak)

17689 Posts

Posted - 2012-05-24 : 03:34:50
basically make use of function like charindex(), substring(), left(), right() etc

DIY
1. use charindex() to find the position of dot
2. value 1 = left of the input string to the position of dot - 1
2. value 2 = starting from position of dot + 1 till end of string

OR

Use a ready make function like fnParseString


KH
[spoiler]Time is always against us[/spoiler]

Go to Top of Page

egemen_ates
Yak Posting Veteran

76 Posts

Posted - 2012-05-24 : 04:22:49
thank you sir;

i make it

SELECT @INDEX=CharIndex('.',''+@DENIED_PAGE+'')
SELECT @MODULE=substring(''+@DENIED_PAGE+'',0,@INDEX)
SELECT @FUSEACTION=substring(''+@DENIED_PAGE+'',@INDEX+1,LEN(''+@DENIED_PAGE+''))

quote:
Originally posted by khtan

basically make use of function like charindex(), substring(), left(), right() etc

DIY
1. use charindex() to find the position of dot
2. value 1 = left of the input string to the position of dot - 1
2. value 2 = starting from position of dot + 1 till end of string

Use a ready make function like fnParseString


KH
[spoiler]Time is always against us[/spoiler]



Go to Top of Page
   

- Advertisement -