Wednesday, March 7, 2012

Problem with replace function

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!Hello,
Use CASE statement...
Thanks
Hari
"meendar" <askjavaprogrammers@.gmail.com> wrote in message
news:1176120159.024299.245830@.l77g2000hsb.googlegroups.com...
> 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!
>

No comments:

Post a Comment