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 2000 Forums
 SQL Server Development (2000)
 Trying to get clear results

Author  Topic 

AskSQLTeam
Ask SQLTeam Question

0 Posts

Posted - 2002-02-12 : 09:12:36
Teresa writes "I am running a SQL Server Agent job --

EXEC xp_sendmail @recipients = 'TeresaCleland@yahoo.com',
@query = 'SELECT Project,Date, Status FROM Development.dbo.Test WHERE Status=1 or Status=2',
@subject = 'SQL Server Report',
@message = 'The contents of Test Table:',
@attach_results = 'TRUE', @width = 250

Works great, first time every time.

My question is -- how do I return a value for 'Status' rather than the '1' or '2'? For Example how do I return

Project Date Status
Development 01/06/02 Submitted (rather than 1)
Development 01/06/02 Re-submitted (rather than 2)

Appreciate your help."

izaltsman
A custom title

1139 Posts

Posted - 2002-02-12 : 09:22:20
Change your query parameter to something like:

@query = 'SELECT Project,Date, CASE Status WHEN 1 THEN ''Submitted'' WHEN 2 THEN ''Re-submitted'' END as stat FROM Development.dbo.Test WHERE Status=1 or Status=2'

Go to Top of Page
   

- Advertisement -