INSERT works in SQL server 2003 but NOT in SQL server 2000

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • MMCI
    New Member
    • Sep 2007
    • 3

    INSERT works in SQL server 2003 but NOT in SQL server 2000

    I am new to Infopath 2003, SQL server 2000 and SQL server 2003. I am calling up a stored procedure with 2 variables from jscript in infopath 2003 to run a stored procedure in SQL server 2003 to copy a record (@RecipetoCopy) and insert it with a new name(@RecipeNew ). It works fine with SQL 2003 but it will not work in SQL 2000. Below is my stored procedure for both.


    Code for 2005 work fine:
    _______________ _______________ _______________ _____________
    set ANSI_NULLS ON
    set QUOTED_IDENTIFI ER ON
    go

    CREATE PROCEDURE [dbo].[CopyInsert]@RecipetoCopy varchar(10), @RecipeNew varchar(10)

    AS

    INSERT INTO [Epmar].[dbo].[Formulas]
    ([FormulaNumber],[Type1],[RawMat1],[Preset1],[Message1])

    SELECT @RecipeNew,Type 1,RawMat1,Prese t1,Message1
    from Formulas
    where Formulas.Formul aNumber = @RecipetoCopy

    SELECT * from Formulas
    where Formulas.Formul aNumber = @RecipeNew
    _______________ _______________ _______________ _______________



    Code for SQL 2000 does not work
    _______________ _______________ _______________ _______________
    CREATE PROCEDURE CopyInsert @RecipetoCopy varchar(10), @RecipeNew varchar(10)

    AS

    INSERT Formulas
    ([FormulaNumber],[Type1],[RawMat1],[Preset1],[Message1])

    SELECT @RecipeNew,Type 1,RawMat1,Prese t1,Message1
    from Formulas
    where Formulas.Formul aNumber = @RecipetoCopy

    SELECT * from Formulas
    where Formulas.Formul aNumber = @RecipeNew
    GO
    _______________ _______________ _______________ ____________
  • DonlonP
    New Member
    • Jul 2007
    • 25

    #2
    Originally posted by MMCI
    I am new to Infopath 2003, SQL server 2000 and SQL server 2003. I am calling up a stored procedure with 2 variables from jscript in infopath 2003 to run a stored procedure in SQL server 2003 to copy a record (@RecipetoCopy) and insert it with a new name(@RecipeNew ). It works fine with SQL 2003 but it will not work in SQL 2000. Below is my stored procedure for both.


    Code for 2005 work fine:
    _______________ _______________ _______________ _____________
    set ANSI_NULLS ON
    set QUOTED_IDENTIFI ER ON
    go

    CREATE PROCEDURE [dbo].[CopyInsert]@RecipetoCopy varchar(10), @RecipeNew varchar(10)

    AS

    INSERT INTO [Epmar].[dbo].[Formulas]
    ([FormulaNumber],[Type1],[RawMat1],[Preset1],[Message1])

    SELECT @RecipeNew,Type 1,RawMat1,Prese t1,Message1
    from Formulas
    where Formulas.Formul aNumber = @RecipetoCopy

    SELECT * from Formulas
    where Formulas.Formul aNumber = @RecipeNew
    _______________ _______________ _______________ _______________



    Code for SQL 2000 does not work
    _______________ _______________ _______________ _______________
    CREATE PROCEDURE CopyInsert @RecipetoCopy varchar(10), @RecipeNew varchar(10)

    AS

    INSERT Formulas
    ([FormulaNumber],[Type1],[RawMat1],[Preset1],[Message1])

    SELECT @RecipeNew,Type 1,RawMat1,Prese t1,Message1
    from Formulas
    where Formulas.Formul aNumber = @RecipetoCopy

    SELECT * from Formulas
    where Formulas.Formul aNumber = @RecipeNew
    GO
    _______________ _______________ _______________ ____________

    You've missed out the INTO on your INSERT statement in SQL 2000. It should be:

    INSERT INTO Formulas
    ([FormulaNumber],[Type1],[RawMat1],[Preset1],[Message1])

    Comment

    • debasisdas
      Recognized Expert Expert
      • Dec 2006
      • 8119

      #3
      SQL server 2003 ???

      From where you got that ?

      Comment

      • MMCI
        New Member
        • Sep 2007
        • 3

        #4
        You've missed out the INTO on your INSERT statement in SQL 2000. It should be:

        INSERT INTO Formulas
        ([FormulaNumber],[Type1],[RawMat1],[Preset1],[Message1])

        It still does not work with the INSERT INTO Formulas.

        Comment

        • MMCI
          New Member
          • Sep 2007
          • 3

          #5
          SQL server 2005 not 2003

          Comment

          Working...