I have this codec and I need to make it into a stored procedure. I know the basics of it and am still new to the concept so I apologize for asking but once I see my error I can take it into a good learning experience if anyone can help solve my problem. This is the codec I have.
CREATE PROC spGetCancelDate
AS
Begin
SELECT c.program_id, d.dealer_code,b.last_name As DealerName, a.account_no, a.vin, ((e.last_name)+','+(e.first_name)) As Name,
a.cancel_refund_date, a.purchase_date,a.miles, a.duration,a.sale_price,a.number_of_payments, a.sales_tax, a.downpayment
from tDealer d
Join tContact b ON d.contact_id = b.contact_id
Join tContract a On d.dealer_id = a.dealer_id
Join tCompany c ON d.company_id= c.company_id
Join tContact E On e.contact_id = a.contact_id
Where c.program_id = @program And a.cancel_refund_date Between @BeginDate And @Endate
End
It's difficult to test a stored procedure and syntax ect when you have nothing to run it off.
Read through the following link and learn about how they are made.
Once you have created the proc because you aren't creating/updating anything you can have a play around until it works worry free.
Basically a stored procedure is a saved script for either selecting, updating, inserting or deleting records. Very useful if you are going to execute the same SQL over and over again.
Creating: http://dev.mysql.com/doc/refman/5.0/en/create-procedure.html
Altering: http://dev.mysql.com/doc/refman/5.0/en/alter-procedure.html
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.