SQL Server Forums
Profile | Register | Active Topics | Members | Search | Forum FAQ
 
Register Now and get your question answered!
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 Help please
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

JasonCamara82
Starting Member

5 Posts

Posted - 01/16/2007 :  13:10:44  Show Profile  Reply with Quote
I am new to SQL server and I need help with a problem I am having, I need to create a stored procedure to insert a transaction into a database I am working on.
I have a transactions table already created with the following colums
TransactionID int not null
TransactionIDType int not null
TransactionDate datetime not null
CustomerID int not null
InvoiceNumber int not null
PaymentDueDate datetime not null
Status bit not null

I know how to start to create a stored procedure but I don't know how to get it to insert a transaction into the table

Any help would be greatly appreciated

tkizer
Almighty SQL Goddess

USA
37134 Posts

Posted - 01/16/2007 :  13:14:02  Show Profile  Visit tkizer's Homepage  Reply with Quote
CREATE PROC SomeProc
AS

INSERT INTO SomeTable (ColumnList...)
VALUES(...)

...

Tara Kizer
Go to Top of Page

X002548
Not Just a Number

15586 Posts

Posted - 01/16/2007 :  13:14:23  Show Profile  Reply with Quote
I think you are confusing the term transaction and row.

Where does the "Transaction" come from?

From what I gather, you might want a trigger




Brett

8-)

Hint: Want your questions answered fast? Follow the direction in this link
http://weblogs.sqlteam.com/brettk/archive/2005/05/25/5276.aspx

Add yourself!
http://www.frappr.com/sqlteam



Go to Top of Page

JasonCamara82
Starting Member

5 Posts

Posted - 01/16/2007 :  13:29:14  Show Profile  Reply with Quote
what I am doing is I am creating a database for a company, and I need a stored procedure to get the information from a transaction
and insert that information into the Transactions table
Go to Top of Page

X002548
Not Just a Number

15586 Posts

Posted - 01/16/2007 :  14:01:30  Show Profile  Reply with Quote
quote:
Originally posted by JasonCamara82

what I am doing is I am creating a database for a company, and I need a stored procedure to get the information from a transaction
and insert that information into the Transactions table



Well, that's what I gather...sounds like what you want is to capture a DML operation against a table, in which case you want a trigger to fire and place the "transaction" into a transaction, or history table

That about right?



Brett

8-)

Hint: Want your questions answered fast? Follow the direction in this link
http://weblogs.sqlteam.com/brettk/archive/2005/05/25/5276.aspx

Add yourself!
http://www.frappr.com/sqlteam



Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
 Printer Friendly
Jump To:
SQL Server Forums © 2000-2009 SQLTeam Publishing, LLC Go To Top Of Page
This page was generated in 0.06 seconds. Powered By: Snitz Forums 2000