cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

Question on Subtraction Date

geraldhans
Explorer
0 Kudos
384

Hi All

I want to seek some inquiries. I try to query to see the days difference between my Document Date and UDF section called BL Date. Here the query I wrote

SELECT DATEDIFF(DAY, $[OINV.U_ETD], $[OINV.U_ETD]) AS 'Lead Time'

So for example if my Document Date is 20th March 2023 the UDF is 23th March 2023, It will calculated the difference automatically. I assigned this FMS on UDF called Lead Time. If this query works, 3 will be displayed. However I was prompted with this errors

1). [Microsoft][SQL Server Native Client 11.0][SQL Server]Conversion failed when converting date and/or time from character string. '' (SWEI)

The main reason why I wrote this Query is I want to generate Due Date on AR Invoice automatically. Yes I know its possible to do this via Payment Terms on Business Partner, however due to unexpected payment terms on some customers we need to this query.

Apprecaite your help

Regards

Gerald

View Entire Topic
kothandaraman_nagarajan
Active Contributor
0 Kudos

Hi,

Try this,

SELECT DATEDIFF(DAY, $[OINV.DocDate], $[OINV.U_ETD]) AS 'Lead Time'
geraldhans
Explorer
0 Kudos

Hi Nagarajan

Thanks for your reply. I think I miswrote the Query above. Yes its supposed to be

SELECT DATEDIFF(DAY, $[OINV.DocDate], $[OINV.U_ETD]) AS 'Lead Time'

However same errors appear as below

1). [Microsoft][SQL Server Native Client 11.0][SQL Server]Conversion failed when converting date and/or time from character string. '' (SWEI)