Maximo List Archive

This is an archive of the Maximo Yahoo Community. The content of this pages may be a sometimes obsolete so please check post dates.
Thanks to the community owner Christopher Wanko for providing the content.



SQL 2005 Error

From: George (2011-11-22 12:25)

Hello everyone,
I'm having an issue in SQL 2005 Here is what I have, when I try to execute this I get an error of this:
Msg 102, Level 15, State 1, Line 5
Incorrect syntax near ':'.
I don't understand now what went wrong can someone help please.
select ponum,description,vendor,companies.name,orderdate,totalcost,status
from po
left outer join
companies on po.vendor = companies.company
where DATEPART (mm,PO.ORDERDATE)= :Mnth
I know its probably something simple but I'm still learning.
thx,
mrggutz


From: wwilliams (2011-11-22 05:26)

It had been a while since I use SQL Server, but variables use @ sign, Oracle uses :
 
-Wes
Wes Williams
http://www.weswilliams.net
http://www.williamsconnell.com
From: George <ggutierrez@pasadenarefining.com>
To: MAXIMO@yahoogroups.com
Sent: Tuesday, November 22, 2011 6:25 AM
Subject: [MAXIMO List] SQL 2005 Error
 
Hello everyone,
I'm having an issue in SQL 2005 Here is what I have, when I try to execute this I get an error of this:
Msg 102, Level 15, State 1, Line 5
Incorrect syntax near ':'.
I don't understand now what went wrong can someone help please.
select ponum,description,vendor,companies.name,orderdate,totalcost,status
from po
left outer join
companies on po.vendor = companies.company
where DATEPART (mm,PO.ORDERDATE)= :Mnth
I know its probably something simple but I'm still learning.
thx,
mrggutz


From: elcleaner (2011-11-22 15:55)

Hello,
You need to add all the table that you are selecting data to the FROM
line.
select ponum,description, vendor,companies .name,orderdate, totalcost,
status
from po ,companies
left outer join
companies on po.vendor = companies.company
where DATEPART (mm,PO.ORDERDATE) = :Mnth
''
I hope this helps.
--- In MAXIMO@yahoogroups.com, "George" <ggutierrez@...> wrote:
>
> Hello everyone,
> I'm having an issue in SQL 2005 Here is what I have, when I try to
execute this I get an error of this:
> Msg 102, Level 15, State 1, Line 5
> Incorrect syntax near ':'.
>
> I don't understand now what went wrong can someone help please.
>
>
> select
ponum,description,vendor,companies.name,orderdate,totalcost,status
> from po
> left outer join
> companies on po.vendor = companies.company
> where DATEPART (mm,PO.ORDERDATE)= :Mnth
>
> I know its probably something simple but I'm still learning.
>
> thx,
> mrggutz
>


From: cbrandon63 (2011-11-22 16:11)

Hello,
You SQL statement looks good. The question is where are you trying to run this SQL statement? Is the :mnth supposed to be a passed parameter or what?
The following version of you code will give you all records for the current month (regardless of year):
select ponum,description,vendor,companies.name,orderdate,totalcost,status
from po
left outer join
companies on po.vendor = companies.company
where DATEPART (mm,PO.ORDERDATE)= datepart (mm,getdate())
don't know what you are going for with the ":"
Hope this helps.
--- In MAXIMO@yahoogroups.com, "George" <ggutierrez@...> wrote:
>
> Hello everyone,
> I'm having an issue in SQL 2005 Here is what I have, when I try to execute this I get an error of this:
> Msg 102, Level 15, State 1, Line 5
> Incorrect syntax near ':'.
>
> I don't understand now what went wrong can someone help please.
>
>
> select ponum,description,vendor,companies.name,orderdate,totalcost,status
> from po
> left outer join
> companies on po.vendor = companies.company
> where DATEPART (mm,PO.ORDERDATE)= :Mnth
>
> I know its probably something simple but I'm still learning.
>
> thx,
> mrggutz
>


From: ggutierrez (2011-11-22 10:49)

Thank you all for the respone's on my little error

Here is what I had to do. Had to actually add = 10
In the reports data it can be = :Mnth


select ponum, description,vendor,companies.name,orderdate,totalcost,status
from po LEFT OUTER JOIN
companies ON po.vendor = companies.company
where DATEPART(mm,PO.ORDERDATE) = 10 --:Mnth
and DATEPART(yyyy, PO.ORDERDATE) = 2011 --:Year
and status not in ('CAN')




Thank You,

George Gutierrez Jr.
Maximo Administration
Pasadena Refining Systems
713.920.3908 Direct
832.473.5330 Cell
U1O2 - Chave



"cbrandon63"
<cbrandon63@yahoo.co
m> To
Sent by: MAXIMO@yahoogroups.com
MAXIMO@yahoogroups.c cc
om
Subject
[MAXIMO List] Re: SQL 2005 Error
11/22/2011 10:11 AM


Please respond to
MAXIMO@yahoogroups.c
om









Hello,

You SQL statement looks good. The question is where are you trying to run
this SQL statement? Is the :mnth supposed to be a passed parameter or what?


The following version of you code will give you all records for the current
month (regardless of year):

select ponum,description,vendor,companies.name,orderdate,totalcost,status
from po
left outer join
companies on po.vendor = companies.company
where DATEPART (mm,PO.ORDERDATE)= datepart (mm,getdate())

don't know what you are going for with the ":"

Hope this helps.

--- In MAXIMO@yahoogroups.com, "George" <ggutierrez@...> wrote:
>
> Hello everyone,
> I'm having an issue in SQL 2005 Here is what I have, when I try to
execute this I get an error of this:
> Msg 102, Level 15, State 1, Line 5
> Incorrect syntax near ':'.
>
> I don't understand now what went wrong can someone help please.
>
>
> select ponum,description,vendor,companies.name,orderdate,totalcost,status
> from po
> left outer join
> companies on po.vendor = companies.company
> where DATEPART (mm,PO.ORDERDATE)= :Mnth
>
> I know its probably something simple but I'm still learning.
>
> thx,
> mrggutz
>





From: Chris Brandon (2011-11-22 08:51)

The statement is correct up to the ":mnth".  All the tables do not need to be on the first line for a join.
________________________________
From: elcleaner <elcleaner@sbcglobal.net>
To: MAXIMO@yahoogroups.com
Sent: Tuesday, November 22, 2011 9:55 AM
Subject: [MAXIMO List] Re: SQL 2005 Error
 
Hello,
You need to add all the table that you are selecting data to the FROM
line.
select ponum,description, vendor,companies .name,orderdate, totalcost,
status
from po ,companies
left outer join
companies on po.vendor = companies.company
where DATEPART (mm,PO.ORDERDATE) = :Mnth
''
I hope this helps.
--- In MAXIMO@yahoogroups.com, "George" <ggutierrez@...> wrote:
>
> Hello everyone,
> I'm having an issue in SQL 2005 Here is what I have, when I try to
execute this I get an error of this:
> Msg 102, Level 15, State 1, Line 5
> Incorrect syntax near ':'.
>
> I don't understand now what went wrong can someone help please.
>
>
> select
ponum,description,vendor,companies.name,orderdate,totalcost,status
> from po
> left outer join
> companies on po.vendor = companies.company
> where DATEPART (mm,PO.ORDERDATE)= :Mnth
>
> I know its probably something simple but I'm still learning.
>
> thx,
> mrggutz
>