开发者

SQL and Excel Import

Please read my post if you have enough time,

I have requirement, I have a table in which there is column of Type DateTime, It should be accept null values.

When this table data is being display in ASPX Page, I have an option to export the data into EXCEL 2003 Spread Sheet.

If there is a null value for a record, When I export the Data into Excel Sheet, This field is not being Exported.

If I don't check for a null Value in The Stored procedure while Loading Data into Excel Spreadsheet, It pushes 1/1/1990 by default for all null Values into excel sheet.

What is best way for me to finsih this task where I开发者_如何学JAVA have to replace the Null Date Value with a Empty Date and can be exported to excel sheet without 1/1/1990.

If anyone who is kind enough to answer this question , Please ask me for more information.

Thank You Hari Gillala


Excel treats null dates as 1/1/1990. When you run the query to extract the information, I'd suggest using a CASE to handle the date.

Select 
    (CASE WHEN myDate IS NULL then '' ELSE Convert(Varchar(10), myDate, 101) END) as myDate
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜