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
 SQL Server 2012 Forums
 Transact-SQL (2012)
 select statement help

Author  Topic 

ahanekom
Starting Member

1 Post

Posted - 2014-10-23 : 08:10:17
I have the following script :

SELECT Invoiced,DeliveryNoteNo,DocumentNo,ORIGTYPE,OrderNo,Shipdate,CustNo,CUSTNAME,ItemNo,ITEMDESC
FROM dbo.RPTDeliveryNotes

I get the output on the Invoiced fields as 2 and 3. How do I convert the 2 for Invoiced and the 3 for Not Invoiced?

sunder.bugatha
Yak Posting Veteran

66 Posts

Posted - 2014-10-23 : 08:38:20
Can you share the output?

Hema Sunder
Go to Top of Page

stuwannop
Starting Member

3 Posts

Posted - 2014-10-24 : 09:43:19
Try:
SELECT
CASE Invoiced
WHEN 2 THEN 'Invoiced'
WHEN 3 THEN 'Not Invoiced'
ELSE 'Unknown'
END AS Invoiced,
DeliveryNoteNo, etc... etc.

The else is there just in case your data contains something that isn't 2 or 3.

That help?

Never underestimate the power of stupid people in large groups...
Go to Top of Page
   

- Advertisement -