Wrox Home  
Search P2P Archive for: Go

  Return to Index  

asp_databases thread: SV: RE: SV: SV: RE: SQL Syntax Error


Message #1 by "Christian Dygaard" <cdygaard@w...> on Sat, 23 Feb 2002 01:37:09 +0100
Thanks Phil



But can you locate the error I'm getting in the stored procedure?



Regards Christian Dygaard



-----Oprindelig meddelelse-----

Fra: Phil Sayers [mailto:philipsayers@m...]

Sendt: 23. februar 2002 00:53

Til: ASP Databases

Emne: [asp_databases] RE: SV: SV: RE: SQL Syntax Error





No,

You can update multiple tables at a time in a stored procedure..



You can put in the whole range of SQL statements to perform whatever

task you design the procedure to do.



e.g



I am about to create a stored procedure that moves all the items in a

user shopping cart to a collection of tables that hold order

information.

This will all be done within one stored procedure, to make sure that all

the info carries across.

I will be performing several SELECTS, INSERTS and UPDATES within this

one procedure





-----Original Message-----

From: Christian Dygaard [mailto:cdygaard@w...]

Sent: Friday, February 22, 2002 6:40 PM

To: ASP Databases

Subject: [asp_databases] SV: SV: RE: SQL Syntax Error



Is it possible that when using stored procedures you can only update one

table at a time?

Regards Christian Dygaard



-----Oprindelig meddelelse-----

Fra: Christian Dygaard [mailto:cdygaard@w...]

Sendt: 23. februar 2002 00:17

Til: ASP Databases

Emne: [asp_databases] SV: RE: SQL Syntax Error





There are four fields that come from the Creditcard_T Table, which is:

Creditcard_Type_VC, Creditcard_Exp_Month_IN,

Creditcard_Exp_Year_IN, Creditcard_Number_UI



Regards Christian Dygaard





-----Oprindelig meddelelse-----

Fra: Breidenbach, Beth [mailto:Beth.Breidenbach@g...]

Sendt: 22. februar 2002 21:23

Til: ASP Databases

Emne: [asp_databases] RE: SQL Syntax Error





What's the purpose of the join to CreditCard_T?  Which fields come from

it?



-----Original Message-----

From: Christian Dygaard [mailto:cdygaard@w...]

Sent: Friday, February 22, 2002 12:06 PM

To: ASP Databases

Subject: [asp_databases] SQL Syntax Error





Hello fellow programmers



I get an error parsing this stored procedure:



CREATE PROCEDURE dbo.up_parmins_UserT_CCT

   (@Firstname VarChar(50),

    @Lastname VarChar(50),

    @EmailAddress VarChar(50),

    @Username VarChar(30),

    @Password VarChar(10),

    @CCType VarChar(20),

    @ExpMonth Int,

    @ExpYear Int,

    @CCNumber Uniqueidentifier,

    @Donations Money) AS

INSERT INTO User_T (First_Name_VC, Last_Name_VC,

Email_Address_VC, User_Name_VC, Password_VC,

Creditcard_Type_VC, Creditcard_Exp_Month_IN,

Creditcard_Exp_Year_IN, Creditcard_Number_UI,

Donations_MN) VALUES (@Firstname, @Lastname,

@EmailAddress, @Username, @Password, @CCType,

@ExpMonth, @ExpYear, @CCNumber, @Donations)

JOIN Creditcard_T ON

Creditcard_T.Creditcard_ID = User_T.Creditcard_ID

WHERE User_Name_VC = @Username AND

Password_VC = @Password



I get the error message:



Server: Msg 156, Level 15, State 1, Procedure up_parmins_UserT_CCT, Line

19

Incorrect syntax near the keyword 'JOIN'.



What's the problem?



Thanks in advance



Regards Christian Dygaard






$subst('Email.Unsub').






$subst('Email.Unsub').








$subst('Email.Unsub').








$subst('Email.Unsub').








$subst('Email.Unsub').



Message #2 by "Phil Sayers" <philipsayers@m...> on Fri, 22 Feb 2002 19:51:50 -0500
I'm not sure what you are trying to do with the stored procedure.



I would recommend breaking up the statement into 2 INSERTS, so you don't

have the join in there.





-----Original Message-----

From: Christian Dygaard [mailto:cdygaard@w...] 

Sent: Friday, February 22, 2002 7:37 PM

To: ASP Databases

Subject: [asp_databases] SV: RE: SV: SV: RE: SQL Syntax Error



Thanks Phil



But can you locate the error I'm getting in the stored procedure?



Regards Christian Dygaard



-----Oprindelig meddelelse-----

Fra: Phil Sayers [mailto:philipsayers@m...]

Sendt: 23. februar 2002 00:53

Til: ASP Databases

Emne: [asp_databases] RE: SV: SV: RE: SQL Syntax Error





No,

You can update multiple tables at a time in a stored procedure..



You can put in the whole range of SQL statements to perform whatever

task you design the procedure to do.



e.g



I am about to create a stored procedure that moves all the items in a

user shopping cart to a collection of tables that hold order

information.

This will all be done within one stored procedure, to make sure that all

the info carries across.

I will be performing several SELECTS, INSERTS and UPDATES within this

one procedure





-----Original Message-----

From: Christian Dygaard [mailto:cdygaard@w...]

Sent: Friday, February 22, 2002 6:40 PM

To: ASP Databases

Subject: [asp_databases] SV: SV: RE: SQL Syntax Error



Is it possible that when using stored procedures you can only update one

table at a time?

Regards Christian Dygaard



-----Oprindelig meddelelse-----

Fra: Christian Dygaard [mailto:cdygaard@w...]

Sendt: 23. februar 2002 00:17

Til: ASP Databases

Emne: [asp_databases] SV: RE: SQL Syntax Error





There are four fields that come from the Creditcard_T Table, which is:

Creditcard_Type_VC, Creditcard_Exp_Month_IN,

Creditcard_Exp_Year_IN, Creditcard_Number_UI



Regards Christian Dygaard





-----Oprindelig meddelelse-----

Fra: Breidenbach, Beth [mailto:Beth.Breidenbach@g...]

Sendt: 22. februar 2002 21:23

Til: ASP Databases

Emne: [asp_databases] RE: SQL Syntax Error





What's the purpose of the join to CreditCard_T?  Which fields come from

it?



-----Original Message-----

From: Christian Dygaard [mailto:cdygaard@w...]

Sent: Friday, February 22, 2002 12:06 PM

To: ASP Databases

Subject: [asp_databases] SQL Syntax Error





Hello fellow programmers



I get an error parsing this stored procedure:



CREATE PROCEDURE dbo.up_parmins_UserT_CCT

   (@Firstname VarChar(50),

    @Lastname VarChar(50),

    @EmailAddress VarChar(50),

    @Username VarChar(30),

    @Password VarChar(10),

    @CCType VarChar(20),

    @ExpMonth Int,

    @ExpYear Int,

    @CCNumber Uniqueidentifier,

    @Donations Money) AS

INSERT INTO User_T (First_Name_VC, Last_Name_VC,

Email_Address_VC, User_Name_VC, Password_VC,

Creditcard_Type_VC, Creditcard_Exp_Month_IN,

Creditcard_Exp_Year_IN, Creditcard_Number_UI,

Donations_MN) VALUES (@Firstname, @Lastname,

@EmailAddress, @Username, @Password, @CCType,

@ExpMonth, @ExpYear, @CCNumber, @Donations)

JOIN Creditcard_T ON

Creditcard_T.Creditcard_ID = User_T.Creditcard_ID

WHERE User_Name_VC = @Username AND

Password_VC = @Password



I get the error message:



Server: Msg 156, Level 15, State 1, Procedure up_parmins_UserT_CCT, Line

19

Incorrect syntax near the keyword 'JOIN'.



What's the problem?



Thanks in advance



Regards Christian Dygaard






$subst('Email.Unsub').






$subst('Email.Unsub').








$subst('Email.Unsub').








$subst('Email.Unsub').








$subst('Email.Unsub').








$subst('Email.Unsub').




  Return to Index