sql server - using case and contains in SQL -
i have column x-property
has values xxx-abc
, xxx-def
, 123
, mno
....etc.
i have column isx
.
i wish update table fill column isx
such if row in x-property
column contains xxx
add together abc
, else add together xyz
.
i not have sql total text search in table.
any help appreciated.
instead of contains
utilize like
, because docs:
contains predicate used in clause of transact-sql select statement perform sql server full-text search on full-text indexed columns containing character-based info types.
this query:
update table set isx = case when x-property '%xxx%' 'abc' else 'xyz' end
sql sql-server sql-server-2008
No comments:
Post a Comment