This is a discussion on Problem with replace function within the SQL Server forums, part of the Microsoft SQL Server category; --> Hi, Please find the below scenario Original Table course branch_exist BY 0 UI 1 PO 1 LI 0 MK ...
| |||||||
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| ||||
| Hi, Please find the below scenario Original Table course branch_exist BY 0 UI 1 PO 1 LI 0 MK 1 select REPLACE(branch_exist,1,'yes') as branch from university; displays course branch_exist BY 0 UI Yes PO Yes LI 0 MK Yes What i need is course branch_exist BY No UI Yes PO Yes LI No MK Yes Sql-Server replace function only accepts three arguments, any suggestions will be greatly welcomed! |
| |||
| > What i need is: > course branch_exist > BY No > UI Yes > PO Yes > LI No > MK Yes select CAST branch_exist WHEN 1 THEN 'yes' WHEN 0 'no' ELSE '?' END as branch from university; -- Tom http://kbupdate.info/ | http://suppline.com/ |
| |||
| Oops, typo happens. Right version is: select CASE branch_exist WHEN 1 THEN 'yes' WHEN 0 THEN 'no' ELSE '?' END as branch from university; -- Tom http://kbupdate.info/ | http://suppline.com/ |
| ||||
| On Apr 9, 5:37 pm, "kb" <a...@kbupdate.info> wrote: > Oops, typo happens. Right version is: > > select > CASE branch_exist > WHEN 1 THEN 'yes' > WHEN 0 THEN 'no' > ELSE '?' > END as branch > from university; > > -- > Tomhttp://kbupdate.info/|http://suppline.com/ Hi Kb, Thanks you ! |