Script in SQL Server 2005 generic for all the databases

  • Hi all,

    I have few scripts in SQL server 2005 with 'inserts' and 'create tables', and i want to make it generic for oracle,my sql databases.

    Any suggestions would be thankful.

    Regards,

    - sridhar

  • I don't believe the CREATE TABLE scripts can be made generic, but I could be wrong. As to the INSERT scripts, just be sure you're, for want of a better way to describe it, taking away all useful functionality, meaning, don't have any SQL Server 2005 specific syntax. Keep the queries extremely simple: INSERT INTO (column list) VALUES (value list). Be sure to use the ANSI 89 syntax for joins, meaning, no use of INNER JOIN, LEFT JOIN, RIGHT JOIN, but instead list the tables in the FROM clause and use the WHERE clause to define the joins =, *=, =*. Except of course, you can't use *= in SQL Server 2005, so OUTER joins are off the list. Good luck!

    "The credit belongs to the man who is actually in the arena, whose face is marred by dust and sweat and blood"
    - Theodore Roosevelt

    Author of:
    SQL Server Execution Plans
    SQL Server Query Performance Tuning

  • Hi,

    Below mentioned are the few sample scripts:

    INSERT INTO [Sch1].[dbo].[Table]

    ([ID]

    ,[ParentID]

    ,[Name]

    ,[Description]

    ,[IsReseller])

    VALUES

    ('F0C4567-D3E6-490d-86BA-557F7896FEF9'

    ,null

    ,'Uramium'

    ,'Uranium root Data'

    ,1)

    /

    Any advises would be thankful.

    Regards,

    - sridhar

  • The basic syntax will work in Oracle, but you can't have the brackets.

    "The credit belongs to the man who is actually in the arena, whose face is marred by dust and sweat and blood"
    - Theodore Roosevelt

    Author of:
    SQL Server Execution Plans
    SQL Server Query Performance Tuning

Viewing 4 posts - 1 through 3 (of 3 total)

You must be logged in to reply to this topic. Login to reply