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)
 text manipulation

Author  Topic 

skysyb
Starting Member

16 Posts

Posted - 2008-04-30 : 08:18:16
Hi, is there a way i can replace multiple white spaces & tabs into one , on a TEXT column ?

I am using replace function and trying to store the result into a varchar variable and the TEXT being truncated after 255 charecters.

for example, I tried this :

declare @str varchar(4000)
select @str = replace(cast(textcolumn as varchar(4000)), ' ', NULL)

I understand t-SQL dml statement(s)
will automatically truncate after 255 chars in a long string. But, seeking for other options here pls.

thanks for ur help..

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2008-04-30 : 08:29:29
Try using varchar(max). ALso change options of sql management studio to increase the number of characters of string result to be displayed.
Go to Top of Page

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2008-04-30 : 08:45:57
What does Print @str return?

Madhivanan

Failing to plan is Planning to fail
Go to Top of Page

skysyb
Starting Member

16 Posts

Posted - 2008-04-30 : 09:15:57
hi Madhavianan , print @str is also returning the same 255 chars of the @str
hi Visakh16, i can't use varchar(MAX) apparently the parituclar datatype is not supproted in ASE.

I can actually use writetext if am able to store the return value of @str for more than 255 charecters. but the whole problem is i am not able to store the result of replace() into @str for more than 255 chars and I can't define local variable as text datatype. so struggling a little bit here.

any further help would be appreciated.
Go to Top of Page

RyanRandall
Master Smack Fu Yak Hacker

1074 Posts

Posted - 2008-04-30 : 09:26:46
Are you using Microsoft SQL Server?

Ryan Randall
Solutions are easy. Understanding the problem, now, that's the hard part.
Go to Top of Page

skysyb
Starting Member

16 Posts

Posted - 2008-04-30 : 09:54:22
no, i am using sybase 12.5. I know this forum is for sqlserver. but trying my luck here as the t-sql commands are almost the same in both sqlserver & sybase. cheers.
Go to Top of Page

SwePeso
Patron Saint of Lost Yaks

30421 Posts

Posted - 2008-04-30 : 10:13:01
Yes, and both Queen Mary 2 and my daughter's playstation have a joystick.

If you replace any part of a string with NULL, the enttire string evaluates as NULL.



E 12°55'05.25"
N 56°04'39.16"
Go to Top of Page
   

- Advertisement -