How should I write code so that I can run it on every version?
If I developed the code on SQL Server 2008, can I run the same code without making any changes in 2000 and 2005?
Let’s say multiple insert in a single insert statement are possible in 2008 but not in 2005 & 2000.
Can I run the same code in 2005 & 2000 ?
Here is the code:
create table MergeMe (
id int identity(1,1),
Sname varchar(100),
dtDate datetime default getdate(),
)
insert into MergeMe values('Vikrant More',null),('Shrikant Gavli',null),('Saurabh Yete',null)
You have to test the code for all versions is SQL Server you want the code to run on. Otherwise you can never be sure that it will work.
To make your example work on 2005 and 2000 you can use a series of
union allinstead.