user3423149
user3423149

Reputation: 159

How can I test the syntax on SQL Server 2005 without install it

I am using SQL Server 2008. Everything goes right in my local development.

But when I deploy the program and the stored procedure into client workstation which is using SQL Server 2005, errors are showing up.

I believe it is caused by the syntax problem between SQL Server 2005 and 2008 because I have fixed some of the parts and it can be fixed. It is quite time consuming when I using SQL Server 2008 and search the error one by one in the forum.

So is there any way I can use the SQL Server 2005 editor to write stored procedure without install it?

Thanks for your help

Upvotes: 3

Views: 1272

Answers (2)

marc_s
marc_s

Reputation: 755287

Using the compatibility level of your database, you can create a database in SQL Server 2008, but then make it look, feel and act like SQL Server 2005.

Steps:

  1. Create your database - either visually or with

    CREATE DATABASE MySampleDB
    

    This creates a database on your server, in the default compatibility level as defined by the model database on your server. On a SQL Server 2008 machine, this typically will be a compatibility level of 100.

  2. Check the compatibility level:

    USE MySampleDB
    GO
    SELECT name, compatibility_level
    FROM sys.databases
    WHERE database_id = DB_ID()
    
  3. Now set the compatibility level to 90 to emulate a SQL Server 2005 database:

    ALTER DATABASE MySampleDB
    SET COMPATIBILITY_LEVEL = 90
    

Now, you have a MySampleDB that is acting and looking like SQL Server 2005 - any T-SQL constructs that are not available in SQL Server 2005 should cause problems and errors in this database, too! (e.g. the DATE datatype or other things)

Upvotes: 1

Vignesh Subramanian
Vignesh Subramanian

Reputation: 7289

You can do it using sql fiddle

You can also use Vertabelo, which is very simple. It will generate query for designed tables automatically.

Upvotes: 1

Related Questions