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 |
mr_evans2u
Starting Member
2 Posts |
Posted - 2013-01-16 : 12:36:21
|
I want to replace an unknown string from HomeMDB with "YES" in my select statement.Since I don't know what the value is or the exact length how do I replace the string with my own value?SELECT TOP(250)Data.id, Data.HomeMDBFrom DataWhere id = '%'So lets say this query came back as:id HomeMDB11 CN=FLDPHIK09-12,ou=something,etc,etc,etc,etc12 NULLHow can I get it to look like:id HomeMDB11 YES12 ---I know how to change the NULL value to '---' |
|
djj55
Constraint Violating Yak Guru
352 Posts |
Posted - 2013-01-16 : 12:43:18
|
How about something like:SELECT TOP(250)Data.id, CASE WHEN Data.HomeMDB IS NULL THEN '---' ELSE 'YES' END AS HomeMDBFrom DataWhere id = '%' djj |
|
|
mr_evans2u
Starting Member
2 Posts |
Posted - 2013-01-16 : 12:46:04
|
djj55 that is perfect!!!Thank you very much |
|
|
|
|
|