Stored procedure syntax

  • Thread starter martinharvey via DotNetMonster.com
  • Start date
M

martinharvey via DotNetMonster.com

This is probably a very simple question but i am having problems with a
stored procedure syntax.

I want to insert fields with preset values (DateCreated/OrderVerified)

and two values (Name/ Address1) from a databletable called
"Customer" and insert both of these into a datatable called "Orders"



I have tried the following syntax but it is not working. Can anyone tell me
where i am going wrong


CREATE PROCEDURE SP_CreateOrder

(@CustomerID Varchar(50))

AS
INSERT INTO Orders (DateCreated, Verified)
VALUES ( GETDATE(), 0,)
AND INSERT Into Orders (Name, Address)
SELECT (Customer.Name, Customer.Address)
FROM Customer

WHERE CustomerID = @CustomerID


Many thanks martin
 
E

Eliyahu Goldin

CREATE PROCEDURE SP_CreateOrder

(@CustomerID Varchar(50))

AS
INSERT Into Orders (DateCreated, Verified, Name, Address)
SELECT ( GETDATE(), 0, Customer.Name, Customer.Address)
FROM Customer

WHERE CustomerID = @CustomerID

Eliyahu
 
M

martinharvey via DotNetMonster.com

Eliyahu said:
CREATE PROCEDURE SP_CreateOrder

(@CustomerID Varchar(50))

AS
INSERT Into Orders (DateCreated, Verified, Name, Address)
SELECT ( GETDATE(), 0, Customer.Name, Customer.Address)
FROM Customer

WHERE CustomerID = @CustomerID

Eliyahu
many thanks

martin
This is probably a very simple question but i am having problems with a
stored procedure syntax.
[quoted text clipped - 22 lines]
Many thanks martin
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,770
Messages
2,569,583
Members
45,073
Latest member
DarinCeden

Latest Threads

Top