I'm trying to get the SQL Server version incorporated into some SP and I need to know what the exact use of
xp_msver. I'm looking to evaluate 8.xx or 7.xx
TIA
Mike Davis
Terry, Thanks for the info. I opted for the Substring instead because it was shorter.
Mike
Declare @Emsg varchar(200)
Set @Emsg='Please call Support for help adding a column.'
-- if version is less than 7.5 exit with error message
if convert(float,substring(@@version,22,4))<7.5
Begin
select @Emsg
Return
End
--Check to see if table Exist
Declare @id int
select @id=id from sysobjects where name='T4W_Users'
if @id is null
Begin
Select 'T4W_Users table does not exist'
return
End
--Check to see if column exist, if not add it
select @id=count(id) from syscolumns where id=
(select id from sysobjects where name='T4W_Users')
AND Name='OP__LASTLOGINDATETIME'
if @id=0
Begin
Alter Table T4W_Users add OP__LASTLOGINDATETIME Datetime null
Select 'Column Added'
End
Else
Select 'Column already exist'
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.