Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 Help please

Author  Topic 

JasonCamara82
Starting Member

5 Posts

Posted - 2007-01-16 : 13:10:44
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

38200 Posts

Posted - 2007-01-16 : 13:14:02
CREATE PROC SomeProc
AS

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

...

Tara Kizer
Go to Top of Page

X002548
Not Just a Number

15586 Posts

Posted - 2007-01-16 : 13:14:23
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 - 2007-01-16 : 13:29:14
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 - 2007-01-16 : 14:01:30
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
   

- Advertisement -