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
 simple sub routine?

Author  Topic 

Cheryl01
Starting Member

5 Posts

Posted - 2008-12-07 : 14:23:33
This is my first sub routine..can anyone tell me what I'm doing wrong? I have a ASP.net 2.0 web page that will call it from a button click(VB) anyway I wrote the subroutine in SQL 2005 and when I try to execute I get the error: must declare the scalar variable@sq..

alter PROCEDURE [dbo].[getquotes]
@sq.Accepted bit
as
begin

SELECT sq.QuoteID, sq.QuoteDate, sq.CustID, sq.TypeID, sq.ContactMethID, sq.Accepted, sq.Comments, sq.Type, cm.ContactMethod
FROM tblServiceQuote sq
LEFT OUTER JOIN tblContactMethod cm ON sq.ContactMethID = cm.ContactMethID
LEFT OUTER JOIN tblServiceType st ON sq.TypeID = st.TypeID
WHERE sq.Accepted = @sq.Accepted
order by sq.quoteid

end

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2008-12-07 : 15:02:13
It's possible that you are having issues due to the period in the variable name. Try @sqAccepted or maybe even @Accepted.

Tara Kizer
Microsoft MVP for Windows Server System - SQL Server
http://weblogs.sqlteam.com/tarad/

Subscribe to my blog
Go to Top of Page
   

- Advertisement -