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.

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 Change number to word in query output

Author  Topic 

MistaT2000
Starting Member

3 Posts

Posted - 2009-01-22 : 11:02:30
Hi Folks,

I'm a SQL n00b and need a hand with a simple query..

Here is my query in my SqlDataSource:

SELECT "DATESTAMP", "QUICKCALL_KEY", "DESCRIPTION", "TYPE" FROM "SERVICEREQ" WHERE ("QUICKCALL_KEY" = :QUICKCALL_KEY) AND "DATESTAMP" > (SELECT TRUNC(SYSDATE) FROM "DUAL")

What i need to do is this:

if (TYPE=='3'){
channel="Phone";
}

elseif (TYPE=='0'){
channel="E-Mail";
}

elseif (TYPE=='8'){
Channel="SMS";
}

Any help would be superb Amigos!!

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2009-01-22 : 11:06:21
not sure if you're using sql server (seeing syntax). if yes, try this

SELECT DATESTAMP, QUICKCALL_KEY, DESCRIPTION, TYPE,
CASE WHEN TYPE='3' THEN 'Phone'
WHEN TYPE='0' THEN 'E-Mail'
WHEN TYPE=='8' THEN 'SMS'
END AS Channel
FROM SERVICEREQ WHERE (QUICKCALL_KEY = QUICKCALL_KEY) AND DATESTAMP >
(SELECT TRUNC(SYSDATE) FROM DUAL)
Go to Top of Page

MistaT2000
Starting Member

3 Posts

Posted - 2009-01-22 : 11:15:31
Hey visakh16,

Thanks for the reply, i think this may be better off in the Asp.net forum I'm using a SqlDataSource in a asp.net page to retrieve data to display in a RadGrid, just not sure of the syntax to achieve what i want to do

Thanks anyway though!!
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2009-01-22 : 11:22:59
then post in ASP.NET forum in sql team
Go to Top of Page
   

- Advertisement -