473,324 Members | 2,567 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,324 software developers and data experts.

Stored procedure syntax

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

--
Message posted via DotNetMonster.com
http://www.dotnetmonster.com/Uwe/For...p-net/200511/1
Nov 27 '05 #1
2 1059
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

"martinharvey via DotNetMonster.com" <u14945@uwe> wrote in message
news:57fae29f49e0b@uwe...
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

--
Message posted via DotNetMonster.com
http://www.dotnetmonster.com/Uwe/For...p-net/200511/1

Nov 27 '05 #2
Eliyahu Goldin wrote:
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


--
Message posted via http://www.dotnetmonster.com
Nov 27 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: Toonman | last post by:
I'm trying to use a couple of variables in a stored procedure. Things work fine when I hard code the data into the variables and also work fine when I use the variable in the WHERE clause and hard...
4
by: marc | last post by:
I've been developing a stored procedure that uses a user defined function in the query portion of the procedure. However, since the end product needs to allow for dynamic table names, the UDF will...
0
by: billmiami2 | last post by:
Perhaps many of you MS Access fanatics already know this, but it seems that stored procedures and views are possible in Jet. I thought I would leave this message just in case it would help anyone....
9
by: Frawls | last post by:
Hi I Am am having problems with a stored Procedure that i wrote. Basically whats happening is that the Stored procedure Runs fine when i EXECUTE it in SQL Query analyzer. But when i debug...
7
by: eholz1 | last post by:
Hello PHP group, Could someone help me out? I have PHP 5.2, Apache 2.0, and MySQL 5.0 running on Linux (Redhat Fedora Core 6). All that works fine. I would like to be able to "call" a stored...
5
by: Dennis | last post by:
Hi I'm trying to alter my stored procedure to take a parameter for the Database Name, but as usual the syntax is killing me. Thanks for any help Dennis ...
5
by: bbawa1 | last post by:
I have the following stroed procedue. But whebnnI execute it it gives me following errors. Could you please tell me what is wrong Msg 156, Level 15, State 1, Procedure usp_DateDiff, Line 43...
20
by: billmaclean1 | last post by:
I need to write a stored procedure that selects from a table and returns the result set. I don't always know the TableSchema that I need to use when qualifying the table at run-time Example:...
6
Soniad
by: Soniad | last post by:
Hello, I am excecuting a stored procedure in my ASP page , it has one out parameter (@confirm) . after executing the procedure i want to retreive this out parameter and assign it to variable...
2
by: priyamtheone | last post by:
I'm trying to create a stored procedure in MSSQL Server 2005 that'll perform the following jobs: 1) Create a login. 2) Create an user in TestDB database for the login created in step 1. 3) Assign...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.