Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Error in my Stored Procedure

Status
Not open for further replies.

astrodestino

IS-IT--Management
Feb 19, 2005
179
AR
Hi!
I'm do not program SQL and I need to create a stored procedure from this sql syntax:
Code:
varDate = date()
varDay = DatePart("d",varDate)
varMonth = DatePart("m", varDate)
varYear = DatePart("yyyy", varDate)
"SELECT * FROM adefemerides where mes="&varmonth&" and dia=" &varday &" and ano="&varYear

With some help from you guys I got this syntax:
Code:
CREATE PROCEDURE sp_adefemerides AS
select *
from adefemerides
where mes = month(getdate())
   and dia = day(getdate())
   and ano = year(getdate())
go

But I get this error when I try to create it:
Incorrect Syntax Near 'GO'

What am I doing wrong?

Tnx for your help!!!
 
You dont need the go if running it in Query Analyser. And I cut and paste your procedure and no problems.
Is this the exact code? (also what version of SQL server are you running?

"I'm living so far beyond my income that we may almost be said to be living apart
 
i dont see anything wrong with your sp. I tested and no errors....

-DNG
 
Tnx guys, I am not writing it from the query analizer I am creating it thru a visual basic net application. I've tryed other SP and I they worked. Do you think that if I remove the GO it will work?
Tnx!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top