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'
Return
--End of Script