Larry Brister
asked on
MS SQL Server update on datacolumn type text
I have a table with a columns datatype TEXT
I am trying to run an update ...
If I do the select on it the data comes up
It just won't update.
UPDATE dbo.cmsEmailTemplates
SET Qualifications = replace(CAST(Qualification s AS VARCHAR(MAX)), '[NOTCOSTART]', '[QUALNOTCOSTART]')
WHERE Qualifications LIKE '%[NOTCOSTART]%'
I am trying to run an update ...
If I do the select on it the data comes up
It just won't update.
UPDATE dbo.cmsEmailTemplates
SET Qualifications = replace(CAST(Qualification
WHERE Qualifications LIKE '%[NOTCOSTART]%'
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Brackets are special chars in a LIKE pattern, so you need to escape them to find an actual bracket. Try this instead:
WHERE Qualifications LIKE '%\[NOTCOSTART\]%' ESCAPE '\'
The original code should match any text that has any 'A' or 'C' or 'N' or 'O' or 'R' or 'S' or 'T' in it, which is probably just about every line. It would likely take much, much longer to run.
WHERE Qualifications LIKE '%\[NOTCOSTART\]%' ESCAPE '\'
The original code should match any text that has any 'A' or 'C' or 'N' or 'O' or 'R' or 'S' or 'T' in it, which is probably just about every line. It would likely take much, much longer to run.
ASKER
Taking a look shortly guys
lrbrister, do you still need help with this question?
ASKER
Hey guys...
So sorry for the late get back... was out of country.
Was out of town....
It appears that Christopher Gordon's answer meets my needs.
I tried to break it several ways but it continues to work fine..
Without objection... I will award him the points
So sorry for the late get back... was out of country.
Was out of town....
It appears that Christopher Gordon's answer meets my needs.
I tried to break it several ways but it continues to work fine..
Without objection... I will award him the points
ASKER
Sure enough...
I was barely unpacked and they sent me ... not out of town...
But out of country
Sorry for late award.
No more traveling this year.
I was barely unpacked and they sent me ... not out of town...
But out of country
Sorry for late award.
No more traveling this year.
Select replace(CAST(Qualification
from dbo.cmsEmailTemplates
WHERE Qualifications LIKE '%[NOTCOSTART]%'