how to use (with) statment in sql 2000 ??
how to use (with) statment in sql 2000 ??
i have this code in sql 2008 but it dos't work in sql 2000
how to make it work without i losse my time to make new view
code in 2008
{
CREATE VIEW [dbo].[QRateDefMonumPrice]
AS
WITH ETC AS (SELECT RateDefID, SUM(Admission) AS SumAdmission
FROM dbo.QRateDefMonumDaysPrice
GROUP BY RateDefID)
SELECT RateDefID, SumAdmission, CASE WHEN [SumAdmission] != (FLOOR([SumAdmission])) THEN (FLOOR([SumAdmission]) + 1) ELSE (FLOOR([SumAdmission]))
END AS FixSumAdmission
FROM ETC AS ETC_1
GO
}
with dos't work in sql 2000
August 11th, 2012 5:35am
The right forum to post T-SQL queries would be:
http://social.msdn.microsoft.com/Forums/en-US/transactsql/threads
As for your question, there is no "WITH" statement support in SQL 2000 but you can achieve exactly the same thing in SQL2000 by rewriting you statement as:
SELECT RateDefID, SumAdmission, CASE WHEN [SumAdmission] != (FLOOR([SumAdmission])) THEN (FLOOR([SumAdmission]) + 1) ELSE (FLOOR([SumAdmission]))
END AS FixSumAdmission
FROM (
SELECT RateDefID, SUM(Admission) AS SumAdmission
FROM dbo.QRateDefMonumDaysPrice
GROUP BY RateDefID
) AS ETC
Please mark the post as answered if it answers your question
Free Windows Admin Tool Kit Click here and download it now
August 11th, 2012 5:57am