January 14, 2005 at 7:44 am
Hi experts,
I don't know if this is possible, but can I have a default value in my select query?
I want to return "No Data Transmit" if the Transmit_Date returns null from the select query : "SELECT Batch_Num,DD_File_Name,Transmit_Date FROM Epay_Batch_Table"
Is it possible? How to do it?
Thank you.
January 14, 2005 at 7:46 am
Did ISNULL ( check_expression , replacement_value ) not work?
I wasn't born stupid - I had to study.
January 14, 2005 at 8:55 am
Farrell, thank you it works. But I still have a question:
Transmit_Date is a smalldatetime, which should display 1/14/2005 12:00AM. After I casted to varchar, it displays Jan 14, 2005 12:00AM, how can I display it as 1/14/2005 only????
SELECT Batch_Num, DD_File_Name, ISNULL(CAST(Transmit_Date AS VARCHAR(30)), 'No Data') AS TransDate
FROM Epay_Batch_Table
January 14, 2005 at 9:15 am
Never mind, I got it work:
ISNULL(CAST(CONVERT(CHAR(8), F.Transmit_Date, 10) AS VARCHAR(30)), 'Not Transmit Yet') AS TransDate
Thank you.
Viewing 4 posts - 1 through 3 (of 3 total)
You must be logged in to reply to this topic. Login to reply