Showing posts with label jscript. Show all posts
Showing posts with label jscript. Show all posts

Monday, March 26, 2012

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_IDENTIFIER 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,Type1,RawMat1,Preset1,Message1
fromFormulas
whereFormulas.FormulaNumber = @.RecipetoCopy

SELECT * from Formulas
whereFormulas.FormulaNumber = @.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,Type1,RawMat1,Preset1,Message1
fromFormulas
whereFormulas.FormulaNumber = @.RecipetoCopy

SELECT * from Formulas
whereFormulas.FormulaNumber = @.RecipeNew
GO
__________________________________________________ _______

Quote:

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_IDENTIFIER 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,Type1,RawMat1,Preset1,Message1
fromFormulas
whereFormulas.FormulaNumber = @.RecipetoCopy

SELECT * from Formulas
whereFormulas.FormulaNumber = @.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,Type1,RawMat1,Preset1,Message1
fromFormulas
whereFormulas.FormulaNumber = @.RecipetoCopy

SELECT * from Formulas
whereFormulas.FormulaNumber = @.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])|||SQL server 2003 ?

From where you got that ?|||

Quote:

Originally Posted by

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.|||SQL server 2005 not 2003