Is it possible to write a sql script that'll run some sql for 2000 if it's installed, or some other sql for 2005 or something else if version 7.. or something's installed - e.g. do nothing?
I can get the server version with @@VERSION, I think.
I can't seem to make it work in an if/else bit o' code.
What it's for:
For 2000 I'd do
--create some users:
EXEC sp_addlogin ...
EXEC sp_addlogin ...
but for 2005 I'd want to do :
create login ...
create login ...
At the moment I have 2 scripts - with only that bit different. - Can it be put into the same script so users only have to run one, without thinking (or knowing) which version of sql server they have installed?
I can get the server version with @@VERSION, I think.
I can't seem to make it work in an if/else bit o' code.
What it's for:
For 2000 I'd do
--create some users:
EXEC sp_addlogin ...
EXEC sp_addlogin ...
but for 2005 I'd want to do :
create login ...
create login ...
At the moment I have 2 scripts - with only that bit different. - Can it be put into the same script so users only have to run one, without thinking (or knowing) which version of sql server they have installed?