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

stored procedure issue

Status
Not open for further replies.

oakpark5

Programmer
Sep 2, 2004
81
US
I keep getting bad syntax next to the @Bdate and @edate, I doint see where the there is a syntax proble. For reference the pkpro..artran and pro30..artran are tables from different databases. Thanks in advance.

CREATE PROCEDURE spArtran
@bdate as smalldatetime(4)
@edate as smalldatetime(4)
AS
select t1.invno, t1.item, t1.custno, t1.cost, t1.price, t1.qytord, t1.qtyshp, t1.invdte, t1.extprice, t1.salesmn, t1.disc, t1.disc2, t1.disc3, t1.unitax, t1.taxitem from pkpro..artran as t1 where invdte between @bdate and @edate
union all
select t2.invno, t2.item, t2.custno, t2.cost, t2.price, t2.qytord, t2.qtyshp, t2.invdte, t2.extprice, t2.salesmn, t2.disc, t2.disc2, t2.disc3, t2.unitax, t2.taxitem from pro30..artran as t2 where invdte between @bdate and @edate
order by invno
GO

Software Engineer
Team Lead
damn bill gates, he has everything
 
Code:
[Blue]CREATE[/Blue] [Blue]PROCEDURE[/Blue] spArtran 
   [Gray]([/Gray]@bdate [Blue]AS[/Blue] [Blue]smalldatetime[/Blue][Gray],[/Gray]
    @edate [Blue]AS[/Blue] [Blue]smalldatetime[/Blue][Gray])[/Gray]
[Blue]AS[/Blue]
Try that.
-Karl

[red] Cursors, triggers, user-defined functions and dynamic SQL are an axis of evil![/red]
[green]Life's uncertain...eat dessert first...www.deerfieldbakery.com[/green]
 
It looks good, I think you just need to add a comma after the @bdate as smalldatetime(4). donutman's way will probably work as well.
 
I'm losin' it, thanks!

Software Engineer
Team Lead
damn bill gates, he has everything
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top