Compiler Conditional statements in t-SQL?
What I am trying to do is this:
Some of our customers have SQL server 2000 databases and some have 2005.
Can we create a stored procedure that is put on both systems but has a compiler conditional statement that includes a call to a system function that only exists in SQL server 20005? Thus, if that stored procedure is created on an SQL sever 2000 database, it will not fail to create? When it runs, it simply skips over the bit call to the call to the non-existance system function (because it is wrapped in compiler conditional logic).
Is this possible?
Re: Compiler Conditional statements in t-SQL?
The first way I can think of doing that is to put the SQL 2005 specific function call into another function or stored procedure.
On the 2005 box you simply call that udf/sproc.
On the 2000 box you have an "empty" routine in the udf/sproc - so calling it does nothing.
Or you could actually create the "name" of the 2005 system sproc on the 2000 machine - although that seems intrusive.
Re: Compiler Conditional statements in t-SQL?
That would still require me having seperate scripts for 2000 and 2005 servers. I would like to avoid that if attall possible.