Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2005 Forums
 SQL Server Administration (2005)
 Check SQLServer Version from Command Line?

Author  Topic 

jeff00seattle
Starting Member

5 Posts

Posted - 2008-11-17 : 12:46:30
Hi

I wish to check from the command line what is the current version of an installed SQLServer given its Host Name?


DECLARE @VersionCurrent VARCHAR(20),
@idSchema INT
SET @idSchema = 8
SET @VersionCurrent = '5.02.00003'

IF EXISTS (SELECT [VersionCurrent] FROM [dbo].[SchemaCurrentVersion] WHERE [idSchema] & @idSchema = @idSchema AND [VersionCurrent] != @VersionCurrent)
BEGIN
RAISERROR ('Invalid database version, expected: %s', 16, 127, @VersionCurrent)
END
GO


Thanks

Jeff in Seattle

lionofdezert
Aged Yak Warrior

885 Posts

Posted - 2008-11-18 : 00:07:15
SELECT @@VERSION
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2008-11-18 : 01:01:00
Also

SELECT SERVERPROPERTY('ProductVersion')
Go to Top of Page

lionofdezert
Aged Yak Warrior

885 Posts

Posted - 2008-11-18 : 05:04:20
visakh statement is more effective according to your requirements.
Go to Top of Page
   

- Advertisement -