cancel
Showing results for 
Search instead for 
Did you mean: 

Approval query problem

kjetil_sandvik2
Participant
0 Kudos

Hi
,

Basically the problem is that my query is returning day instead of month...

Select MONTH($[OPOR.DocDueDate])


When I run this query on a PO with DocDueDate 22.05.14 (22nd of May) it will find that 22 is the month and give this error message:

Microsoft SQL Server - The conversion of a nvarchar data type to datetime data type resulted in an out-of-range-value

Any ideas?

BR
Kjetil Sandvik

Accepted Solutions (1)

Accepted Solutions (1)

kothandaraman_nagarajan
Active Contributor
0 Kudos

Hi,

Try this:

Select MONTH($[OPOR.DocDueDate.date])

Thanks & Regards,

Nagarajan

kjetil_sandvik2
Participant
0 Kudos

Thanks!

Answers (2)

Answers (2)

former_member186712
Active Contributor
0 Kudos


Hi Kjetil,

This works,

Select SUBSTRING(CONVERT(VARCHAR(10),$[OPOR.DocDueDate], 112), 4, 2)

Hope it helps

Regards,

Augusto

Johan_H
Active Contributor
0 Kudos

Hi Kjetil,

Could you please test this syntax ?

SELECT DATEPART(MONTH, $[OPOR.DocDueDate])

Regards,

Johan

kjetil_sandvik2
Participant
0 Kudos

It gives the same error...