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.
| 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_NAMEFROM EVENTSThanks 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_NAMEFROM EVENTS????Look at the hint link belowBrett8-)Hint: Want your questions answered fast? Follow the direction in this linkhttp://weblogs.sqlteam.com/brettk/archive/2005/05/25/5276.aspx |
 |
|
|
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.000How 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. |
 |
|
|
madhivanan
Premature Yak Congratulator
22864 Posts |
Posted - 2005-09-10 : 01:19:36
|
| You need to use Convert FunctionSELECT 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 EVENTSMadhivananFailing to plan is Planning to fail |
 |
|
|
|
|
|
|
|