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 |
|
ZMike
Posting Yak Master
110 Posts |
Posted - 2010-01-13 : 10:09:12
|
| I'm pulling data from Microsoft Sharepoint on SQL Server. I'm Pulling a multi colum field and in SQL Server it will show just in one field which is fine. I want to do a replace of the return commands '<div>' OR '</div>'I would like to do something like this REPLACE (dbo.UserData.ntext2,'<div>' OR '%</div>%' ,'') AS CommentsAny Suggestions ? |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2010-01-13 : 10:25:28
|
| you need to do it in stepsREPLACE(REPLACE (dbo.UserData.ntext2,'<div>' ,''),'</div>','') |
 |
|
|
ZMike
Posting Yak Master
110 Posts |
Posted - 2010-01-13 : 10:42:57
|
| visakh16Thanks for the advice..... I get the following error.Msg 8116, Level 16, State 1, Line 1Argument data type ntext is invalid for argument 1 of replace function.IT looks like it doesnt like the field that I'm searching dbo.UserData.ntext2I just looked up that field and it's a NText which isnt a field I'm used to using... Any ideas ? |
 |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2010-01-13 : 10:44:49
|
quote: Originally posted by ZMike visakh16Thanks for the advice..... I get the following error.Msg 8116, Level 16, State 1, Line 1Argument data type ntext is invalid for argument 1 of replace function.IT looks like it doesnt like the field that I'm searching dbo.UserData.ntext2I just looked up that field and it's a NText which isnt a field I'm used to using... Any ideas ?
then cast to varchar(max) and then replace |
 |
|
|
ZMike
Posting Yak Master
110 Posts |
Posted - 2010-01-13 : 12:56:11
|
| Thanks Visakh16REPLACE(REPLACE(CAST(dbo.UserData.ntext2 AS VARCHAR), '<div>', ''), '</div>', '') AS CommentsThat worked for me.Thank you very much |
 |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2010-01-13 : 12:57:17
|
| welcomeSQL Server MVP |
 |
|
|
|
|
|
|
|