Jump to content

One Sql question : how to split string in sql ???


Recommended Posts

Posted

sCo_^Y sCo_^Y sCo_^Y sCo_^Y


declare @sample varchar(100)
set @sample='12-09-2011_Maddy'



Now I want only 'Maddy' to be assigned to @sample. how to split ??

in programming languages , we can use split function,I don't know whether we have this here  sCo_^Y sCo_^Y

  • Replies 36
  • Created
  • Last Reply

Top Posters In This Topic

  • galigannarao

    11

  • qwerty1204

    8

  • htnamus

    5

  • gvkishore.kish

    5

Popular Days

Top Posters In This Topic

Posted

[quote author=BEZAWADA ROWDY link=topic=236410.msg2943060#msg2943060 date=1315848324]
use substring
[/quote]

@gr33d

Posted

[quote author=BEZAWADA ROWDY link=topic=236410.msg2943060#msg2943060 date=1315848324]
use substring
[/quote]


substring works like this baa

DECLARE @StringTest char(10)
SET @StringTest = 'Robin '
SELECT SUBSTRING(@StringTest,3,LEN(@StringTest))



But i want to split where there is an _ ( underscore) in the string value

for ex : 120911_userid_afdb


I want to split the above like into three different strings ... dynamically I don't know where there will be an _ (underscore) in string value kadha...

Posted

[url=http://sqltutorials.blogspot.com/2007/09/sql-function-split.html]http://sqltutorials.blogspot.com/2007/09/sql-function-split.html[/url]
idi sudu ba

Posted

[quote author=Maddy_Rulez link=topic=236410.msg2943090#msg2943090 date=1315848576]

substring works like this baa

DECLARE @StringTest char(10)
SET @StringTest = 'Robin '
SELECT SUBSTRING(@StringTest,3,LEN(@StringTest))



But i want to split where there is an _ ( underscore) in the string value

for ex : 120911_userid_afdb


I want to split the above like into three different strings ... dynamically I don't know where there will be an _ (underscore) in string value kadha...
[/quote]nee ques naku oka rakamga ardamayindi. nuvvu exactga .netlo ela ayte implement chestamo sql lo kooda ala emayina untunda ani adugutunnavu kada.

unfortunately we don have that. in sql we have to use substring method only.

if this particular functionality is repitetive write a function to split the string using the substring logic as per ur req and use where ever it is required S%Hi S%Hi S%Hi

Posted

[quote author=HS link=topic=236410.msg2943127#msg2943127 date=1315848833]
[url=http://sqltutorials.blogspot.com/2007/09/sql-function-split.html]http://sqltutorials.blogspot.com/2007/09/sql-function-split.html[/url]
idi sudu ba
[/quote] *=: *=: *=:

infact nuvvu url esavu nenu salaha ichanu s%H# s%H# s%H#

Posted

[quote author=Maddy_Rulez link=topic=236410.msg2943090#msg2943090 date=1315848576]

substring works like this baa

DECLARE @StringTest char(10)
SET @StringTest = 'Robin '
SELECT SUBSTRING(@StringTest,3,LEN(@StringTest))



But i want to split where there is an _ ( underscore) in the string value

for ex : 120911_userid_afdb


I want to split the above like into three different strings ... dynamically I don't know where there will be an _ (underscore) in string value kadha...
[/quote]once i used a .net script for this...may be we need to use cusrors...i will check...

Posted

[quote author=galigannarao link=topic=236410.msg2943135#msg2943135 date=1315848891]
*=: *=: *=:

infact nuvvu url esavu nenu salaha ichanu s%H# s%H# s%H#
[/quote] los@r mundnu nene vesa  H&T@ H&T@

Posted

[quote author=HS link=topic=236410.msg2943154#msg2943154 date=1315849038]
los@r mundnu nene vesa  H&T@ H&T@
[/quote][img]http://oi56.tinypic.com/d5qw8.jpg[/img]

Posted

[quote author=HS link=topic=236410.msg2943127#msg2943127 date=1315848833]
[url=http://sqltutorials.blogspot.com/2007/09/sql-function-split.html]http://sqltutorials.blogspot.com/2007/09/sql-function-split.html[/url]
idi sudu ba
[/quote]

single line command leda aa baa s%H#

Posted

[quote author=arey ooo samba link=topic=236410.msg2943166#msg2943166 date=1315849105]
single line command leda aa baa s%H#
[/quote][img]http://www.desigifs.com/sites/default/files/bemmi%20%284%29.gif?1290061501[/img][quote author=galigannarao link=topic=236410.msg2943163#msg2943163 date=1315849096]
[img width=228 height=182]http://oi56.tinypic.com/d5qw8.jpg[/img]
[/quote][img width=150 height=102]http://www.desigifs.com/sites/default/files/brahmam_style15_0.gif?1290348875[/img]

Posted

[quote author=arey ooo samba link=topic=236410.msg2943166#msg2943166 date=1315849105]
single line command leda aa baa s%H#
[/quote]ade seppindi  *7*^ *7*^ *7*^ ee function raasi inkekkadayina single line la vaduko @3$% @3$% @3$%

Posted

[quote author=HS link=topic=236410.msg2943174#msg2943174 date=1315849182]
[img]http://www.desigifs.com/sites/default/files/brahmam_style15_0.gif?1290348875[/img]
[/quote]atta raa dariki @3$% @3$% @3$%

×
×
  • Create New...