Hi All
Currently I'm generating some sort of reports using SQL Query and have difficulty in adding 2 fields that has different formatting
1 Field is with Date Formatting while the others is numeric
Below will show clear illustrations
Basically I want to add 2 fields (Invoice Date & Payment Due) to produce report like this
I try using query as follow but it failed.
SELECT T1.InvDate, T1.PymntDue, T1.InvDate + T1.PymntDue AS 'Payment Due Date'
FROM INV T1
It produce the following errors.
Conversion failed when converting date and/or time from character string
I've try convert them but no success. Appreciate your help
Thank You
Regards Gerald
Slight shot in the dark, but based on your error it appears that PymntDue
is not actually numeric, it is a string.
If that is the case, then you should be able to do:
InvDate + CAST(PymntDue AS int)
Or:
DATEADD(DAY,CAST(PymntDue AS int),InvDate)
Or, change the column datatype for PymntDue
to int/numeric