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
 Transact-SQL (2000)
 DTS help

Author  Topic 

techrookie
Starting Member

6 Posts

Posted - 2005-09-09 : 15:27:20
I have the following DTS Transact-SQL statement, and I need help converting the CATEGORY column from INT to a string of characters - i.e. I want it to say "LOGON/LOGOFF'. How do I accomplish this?

SELECT EVENT_DATE AS DATE, CATEGORY AS CATEGORY, USERID,
USERNAME, COMPUTER, EVENT_TIME, SOURCE, IN_WORK_HOURS,
SCANNED_COMPUTER, RULE_NAME
FROM EVENTS

Thanks in advance.

X002548
Not Just a Number

15586 Posts

Posted - 2005-09-09 : 16:09:06
SELECT EVENT_DATE AS [DATE], CASE CATEGORY WHEN 0 THEN 'LOGOFF' ELSE 'LOGON' END AS CATEGORY, USERID,
USERNAME, COMPUTER, EVENT_TIME, SOURCE, IN_WORK_HOURS,
SCANNED_COMPUTER, RULE_NAME
FROM EVENTS

????

Look at the hint link below



Brett

8-)

Hint: Want your questions answered fast? Follow the direction in this link
http://weblogs.sqlteam.com/brettk/archive/2005/05/25/5276.aspx
Go to Top of Page

techrookie
Starting Member

6 Posts

Posted - 2005-09-09 : 17:56:39
Thank you for that boolean function. Now, the EVENT_TIME column is returning 1999-10-30 01:08:52.000
How do I convert this to regular time i.e. hh:mm:ss? I want to get rid of the 1999-10-30


Thanks again in advance.
Go to Top of Page

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2005-09-10 : 01:19:36
You need to use Convert Function

SELECT EVENT_DATE AS [DATE], CASE CATEGORY WHEN 0 THEN 'LOGOFF' ELSE 'LOGON' END AS CATEGORY, USERID,USERNAME, COMPUTER, Convert(varchar,EVENT_TIME,108), SOURCE, IN_WORK_HOURS,
SCANNED_COMPUTER, RULE_NAME FROM EVENTS


Madhivanan

Failing to plan is Planning to fail
Go to Top of Page
   

- Advertisement -