Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
IIF(,,) in an SQL Server SQL Statement
Message
From
19/04/2000 10:25:45
 
General information
Forum:
Microsoft SQL Server
Category:
SQL syntax
Miscellaneous
Thread ID:
00360347
Message ID:
00361254
Views:
11
>Jon,
>Isn't the extra CASE statement in your final working query the same as adding NewColumn > 0 to the WHERE clause? If so, it would read a hell of lot easier than the CASE.
snip...

This statement:
DECLARE @dNextChkDate DATETIME
SET @dNextChkDate = CONVERT(DATETIME, '04/21/2000',101)-(14*1)

SELECT Timehd.empid, Timehd.date,
CASE
WHEN Timeitms.timeout>17 AND Timeitms.timein>17 THEN Timeitms.timeout-Timeitms.timein
ELSE Timeitms.timeout-17 
END AS Newcolumn
FROM timehd INNER JOIN timeitms 
ON Timehd.timecrdno = Timeitms.timecrdno
WHERE Timehd.date = @dNextChkDate-6
AND Timeitms.jobno <> 'LUNCH'
AND Newcolumn >0
ORDER BY TIMEHD.EMPID
gives the error: "Server: Msg 207, Level 16, State 3, Line 4 Invalid column name 'Newcolumn'." It would be nice if SQL Server would allow it though, it only makes since
Thanks
Jon
Non-MVP Non-MCP Non-MCSE

Visual FoxPro, What else is there?
Previous
Reply
Map
View

Click here to load this message in the networking platform