I'm building a function that is supposed to work on both Sql Server 7 and 2000, when run in a Sql 7 enviroment I get "'SERVERPROPERTY' is not a recognized function name."
And this is ok since there is no such thing on Sql 7, but the SERVERPROPERTY function will never be executed on Sql 7 like in the example code bellow.
How can I work around this so I get a generic script that will work on both Sql Server versions ??
Declare @SQLVersion varchar(26)
SET @SQLVersion = LEFT(@@version, 26)
If @SQLVersion = 'Microsoft SQL Server 7.00' Begin
SELECT @@version AS 'Version', 'N/A' AS 'Collation'
SELECT @@version AS 'Version', SERVERPROPERTY ('Collation') AS 'Collation'