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 |
|
crugerenator
Posting Yak Master
126 Posts |
Posted - 2010-03-02 : 12:30:35
|
| replace(user_notes, CHAR(13) + CHAR(10) ,'<br />')^ w/ the above in a query I get an error saying that argument data type is invalid for argument 1 of replace function. Though, argument 1 (user_notes field) is type of text, which I understand should be fine.Any ideas?Actual error msg:Msg 8116, Level 16, State 1, Line 1Argument data type text is invalid for argument 1 of replace function. |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2010-03-02 : 12:33:28
|
| and if you're by any chance using sql 2005 & above please dont use text,ntext etc as they're deprecated. use varchar(max),nvarchar(max) instead . it supports almost all functions of character datatypes------------------------------------------------------------------------------------------------------SQL Server MVPhttp://visakhm.blogspot.com/ |
 |
|
|
crugerenator
Posting Yak Master
126 Posts |
Posted - 2010-03-02 : 12:53:55
|
quote: Originally posted by visakh16 and if you're by any chance using sql 2005 & above please dont use text,ntext etc as they're deprecated. use varchar(max),nvarchar(max) instead . it supports almost all functions of character datatypes------------------------------------------------------------------------------------------------------SQL Server MVPhttp://visakhm.blogspot.com/
Thanks for the knowledge, I'm on the younger side and never spent any real amt of time w/ 2000, so I don't really know the differences between 2000 and 2005. The DB is running on 2005 but whoever created this table must not have known this info either. Anyway, to avoid actually updating the field in fear of breaking any existing code that might actually need the carriage returns, I did this:replace(cast(user_notes as varchar(max)), CHAR(13) + CHAR(10) ,'<br />')^returns exactly what I need.Thanks again! |
 |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2010-03-02 : 12:55:49
|
| cool. thats only solution if you've inherited this and wants to avoid any possibility of breaking earlier code------------------------------------------------------------------------------------------------------SQL Server MVPhttp://visakhm.blogspot.com/ |
 |
|
|
|
|
|
|
|