Paulo Roberto Bianchi de Oliveira (poliveira@intectecnologia.local) writes:
> Is it possible to convert a sql2005 features to sql2000? Because the ISP
> server there's no way to install the 2k5 server. Or do you have a
> statment that can generate a table filled only with the workdays of a
> year on ms sql 2000. THank you very much
But for crying out loud! Find a new ISP, and the current rot away
with its SQL 2000!
In this particular case, it's fairly easy. Rather than using a number
of CTEs, use a number nested derived tables:
FROM (SELECT ...
FROM (SELECT ...
FROM ...) AS Years
CROSS JOIN (SELECT FROM ... ) AS Months
...) AS DatesRaw
LEFT JOIN ( ) As Holidays
But you cannot do recursive derived tables. But you can easily replace
them if you use a table number of numbers to span years, months and
days. See
http://www.sommarskog.se/arrays-in-sql-2005.html#tblnum
--
Erland Sommarskog, SQL Server MVP, esquel.RemoveThis@sommarskog.se
Links for SQL Server Books Online:
SQL 2008:
http://msdn.microsoft.com/en-us/sqlserver/cc514207.aspx
SQL 2005:
http://msdn.microsoft.com/en-us/sqlserver/bb895970.aspx
SQL 2000:
http://www.microsoft.com/sql/prodinfo/previousversions/books.mspx