ayha1999
asked on
Max(date)
the following command returns even the default '1900-01-01 00:00:00.000'. how can I avoid returning the default date?
isnull(convert(datetime, max(compDate),103),'') as 'Exp. comp. date'
thanks
isnull(convert(datetime, max(compDate),103),'') as 'Exp. comp. date'
thanks
Try:
SELECT isnull(convert(datetime, max(compDate),103),'') as 'Exp. comp. date'
FROM table_name WHERE compDate <> '1900-01-01 00:00:00.000'
SELECT isnull(convert(datetime, max(compDate),103),'') as 'Exp. comp. date'
FROM table_name WHERE compDate <> '1900-01-01 00:00:00.000'
ASKER
hi kaminda,
Incorrect syntax near the keyword 'convert'. with the statement.
Incorrect syntax near the keyword 'convert'. with the statement.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
still same error
Incorrect syntax near the keyword 'convert'.
Incorrect syntax near the keyword 'convert'.
try
convert(varchar, max(compDate),103) as 'Exp. comp. date'
or
isnull(convert(varchar, max(compDate),103),'') as 'Exp. comp. date'
convert(varchar, max(compDate),103) as 'Exp. comp. date'
or
isnull(convert(varchar, max(compDate),103),'') as 'Exp. comp. date'
ASKER
hi ralmda,
same error returned.
same error returned.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Open in new window