Quantcast
Channel: Transact-SQL forum
Viewing all articles
Browse latest Browse all 23857

How do you test a varchar column value to check for a coma

$
0
0

Could someone please help.  I am trying to come up with a way to test a varchar(40) type column for a ',' coma in it's value.  What I would like to do is inclose the string in double quotes if it contains a coma or leave it as is if it does not contain a coma. 

This is a query of what I would like to do but when I run it I get this error.

Msg 7601, Level 16, State 2, Line 1
Cannot use a CONTAINS or FREETEXT predicate on table or indexed view 'Customer' because it is not full-text indexed.

SELECT DISTINCT (CASE WHEN CONTAINS(CustName,',') THEN '"' + CustName + '"' ELSE CustName END) + '-' +
                City AS CustCity, STATE FROM Customer WHERE cono = 1 ORDER BY CustCity

Any help would be greatly appreciated

Thanks in advance


Viewing all articles
Browse latest Browse all 23857

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>