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 Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

if statement not working

Status
Not open for further replies.

junkmail

Programmer
Jan 7, 2001
134
US
if (@salesrepcode = '765') begin

select salesrepcode from orderheader where jobnumber=@jobnumber
@salesrepcode= salesrepcode
end

Msg 102, Level 15, State 1, Procedure fs_enterpriseupdate, Line 62
Incorrect syntax near '@salesrepcode'.

can't seem to figure out what is wrong.
 
The problem here isn't with the if statement.. it's with your select statement. You do not have an AND between your two qualifiers.
Where jobnumber=@jobnumber @salesrepcode = salesrepcod
This will always return an error.
 
Try
select @salesrepcode = salesrepcode from orderheader where jobnumber=@jobnumber
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top