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.
| Author |
Topic |
|
ratheeshsql
Starting Member
17 Posts |
Posted - 2006-09-21 : 02:56:08
|
| hi all..i have a text field which has to be shown in the result of a query execution as several lines..eg: the result should be like this8STK :: L/2 : M/2 : S/1Original string is stored as "8STK :: L/2 : M/2 : S/1"expect a positive reply soon..thanx.. |
|
|
SwePeso
Patron Saint of Lost Yaks
30421 Posts |
Posted - 2006-09-21 : 03:39:05
|
| select originalstring, replace(originalstring, ' : ', CHAR(10) + ': ')from yourtablePeter LarssonHelsingborg, Sweden |
 |
|
|
khtan
In (Som, Ni, Yak)
17689 Posts |
Posted - 2006-09-21 : 04:00:43
|
quote: Originally posted by Peso select originalstring, replace(originalstring, ' : ', CHAR(10) + ': ')from yourtablePeter LarssonHelsingborg, Sweden
Shouldn't it be the CR char(13) ? KH |
 |
|
|
harsh_athalye
Master Smack Fu Yak Hacker
5581 Posts |
Posted - 2006-09-21 : 04:26:23
|
quote: Originally posted by khtan
quote: Originally posted by Peso select originalstring, replace(originalstring, ' : ', CHAR(10) + ': ')from yourtablePeter LarssonHelsingborg, Sweden
Shouldn't it be the CR char(13) ? KH
Both works!print 'accc' + char(13) + 'baaa' -- Line feed charprint 'accc' + char(10) + 'baaa' -- Carriage return char ...although there is technical difference between the two.Harsh AthalyeIndia."Nothing is Impossible" |
 |
|
|
khtan
In (Som, Ni, Yak)
17689 Posts |
Posted - 2006-09-21 : 04:33:13
|
quote: Originally posted by harsh_athalye
quote: Originally posted by khtan
quote: Originally posted by Peso select originalstring, replace(originalstring, ' : ', CHAR(10) + ': ')from yourtablePeter LarssonHelsingborg, Sweden
Shouldn't it be the CR char(13) ? KH
Both works!print 'accc' + char(13) + 'baaa' -- Line feed charprint 'accc' + char(10) + 'baaa' -- Carriage return char ...although there is technical difference between the two.Harsh AthalyeIndia."Nothing is Impossible"
You got it the other way round. 13 is CR, 10 is LF  KH |
 |
|
|
harsh_athalye
Master Smack Fu Yak Hacker
5581 Posts |
Posted - 2006-09-21 : 04:41:13
|
quote: You got it the other way round. 13 is CR, 10 is LF 
Yeah....my mistake Harsh AthalyeIndia."Nothing is Impossible" |
 |
|
|
ratheeshsql
Starting Member
17 Posts |
Posted - 2006-09-21 : 05:38:19
|
thanx...i fixed that problem with char(13).. |
 |
|
|
|
|
|
|
|