Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 Excel treating a decimal as a date

Author  Topic 

stamford
Starting Member

47 Posts

Posted - 2011-10-03 : 07:58:58

Hi
I have a stored procedure in MS SQL Server which creates and exports a table, via a VB.net file, into Excel and the table has a column which contains decimals.
When the table opens in Excel any decimal is being treated as a date. e.g. 1.7 become 01/07/2011. I have tried concatenating the decimal so it is preceded by a single quotation mark but this doesn't work. Is there a way around this please?

Thanks

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2011-11-15 : 06:08:49
Did you try formatting the EXCEL cell as Number before inserting data into it?

Madhivanan

Failing to plan is Planning to fail
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2011-11-15 : 06:44:08
are you using bcp for export? if yes, try using format file and specify column type as decimal

------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/

Go to Top of Page
   

- Advertisement -