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.
Author |
Topic |
newnoise
Starting Member
3 Posts |
Posted - 2013-07-16 : 22:53:58
|
I'm having an issue when trying to import a SQL query into Excel. When importing a variable in that has a date or datetime format in SQL, Excel invariably imports the values as strings rather than as dates. I've tried using cast/convert to change the date format, but the same thing always happens: Excel imports the field with the new formatting attached to it, but regardless of its format, it comes into Excel as a string. This is causing problems, for example, when I try to apply filters to this newly imported field. A date field in Excel can be filtered by date component (years/months/days), but a string field shows all values as distinct rather than connecting, say, all values that have '2013' as their year. Does anyone know how to get a SQL Server date field to import AS A DATE into Excel? I'm using VBA to do the import, relying on a QueryTable and SQL string.SQL Server 2012 |
|
madhivanan
Premature Yak Congratulator
22864 Posts |
Posted - 2013-07-29 : 04:30:57
|
Did you format the cell as datetime?MadhivananFailing to plan is Planning to fail |
|
|
SwePeso
Patron Saint of Lost Yaks
30421 Posts |
Posted - 2013-07-29 : 05:27:18
|
Did you export the column as DATETIME? If not, make sure you are using hyphens to try to convince Excel the content is a date. Microsoft SQL Server MVP, MCT, MCSE, MCSA, MCP, MCITP, MCTS, MCDBA |
|
|
|
|
|
|
|