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 2005 Forums
 Transact-SQL (2005)
 sql query to split strings ...

Author  Topic 

yasinirshad
Starting Member

18 Posts

Posted - 2010-07-05 : 12:38:41
Hi,
I have a table 'ABC' which has a column 'XYZ' and value in this column is a lenghty sentence like Below :

Give meaningful title appropriate to the subject of your message. Give meaningful title appropriate to the subject of your message. Give meaningful title appropriate to the subject of your message.


How can I split this into 2 sentences either by having a delimiter(.) or without delimiter ...

I want my o/p to be like below

Give meaningful title appropriate to the subject of your message.
Give meaningful title appropriate to the subject of your message.
Give meaningful title appropriate to the subject of your message.


can anyone give me sql query to achieve this?can we do this without writing any function n jus by sql query?

Thanks...


SwePeso
Patron Saint of Lost Yaks

30421 Posts

Posted - 2010-07-05 : 12:40:12
Seek dbo.fnSplitString


N 56°04'39.26"
E 12°55'05.63"
Go to Top of Page

webfred
Master Smack Fu Yak Hacker

8781 Posts

Posted - 2010-07-05 : 12:54:58
How should your output look like if there is no delimiter?
Why not writing/using a function?


No, you're never too old to Yak'n'Roll if you're too young to die.
Go to Top of Page

Kristen
Test

22859 Posts

Posted - 2010-07-05 : 13:12:23
REPLACE the "." delimited with "." + LineBreak? Or is that too simplistic? (i.e. do you need 3 rows returned in your resultset, or are you just looking to add some formatting?)
Go to Top of Page

yasinirshad
Starting Member

18 Posts

Posted - 2010-07-05 : 16:08:49
well ..its just for formatting on my webform ...

how to REPLACE the "." delimited with "." + LineBreak?

Go to Top of Page

webfred
Master Smack Fu Yak Hacker

8781 Posts

Posted - 2010-07-06 : 01:40:17
For example in HTML:
select
replace(youColumn,'.','.<br>')
from yourTable


No, you're never too old to Yak'n'Roll if you're too young to die.
Go to Top of Page

yasinirshad
Starting Member

18 Posts

Posted - 2010-07-06 : 04:05:28
Thank U webfred ...
Go to Top of Page

webfred
Master Smack Fu Yak Hacker

8781 Posts

Posted - 2010-07-06 : 04:20:28
welcome


No, you're never too old to Yak'n'Roll if you're too young to die.
Go to Top of Page
   

- Advertisement -