importing date formatted column names

3 posts / 0 new
Last post
idemnos's picture
idemnos
Offline
Joined: 06/17/2016 - 13:25
importing date formatted column names

Hey there.
I'm trying to import a data table from sql server which has at least 42 columns. These columns represent the date of the last of 36 months. Now every column title has its name like this 2015-02-28,...,2018-08-31.
In my first run I just paste Select * from table in Idea to import the data, all the columns got imported, but the 42 columns was titled Column1, Column2,..., Column42.
So I tried to import the data again whith this query:
SELECT  OP, Budget, Product,[2015-02-28],[2015-03-31],[2015-04-30],[2015-05-31],[2015-06-30],[2015-07-31],[2015-08-31],[2015-09-30],[2015-10-31],[2015-11-30],[2015-12-31],[2016-01-31],[2016-02-29],[2016-03-31],[2016-04-30],[2016-05-31],[2016-06-30],[2016-07-31],[2016-08-31],[2016-09-30],[2016-10-31],[2016-11-30],[2016-12-31],[2017-01-31],[2017-02-28],[2017-03-31],[2017-04-30],[2017-05-31],[2017-06-30],[2017-07-31],[2017-08-31],[2017-09-30],[2017-10-31],[2017-11-30],[2017-12-31],[2018-01-31],[2018-02-28],[2018-03-31],[2018-04-30],[2018-05-31],[2018-06-30],[2018-07-31],[2018-08-31] FROM table
And with this one:
SELECT  OP, Budget, Product,"2015-02-28","2015-03-31","2015-04-30","2015-05-31","2015-06-30","2015-07-31","2015-08-31","2015-09-30","2015-10-31","2015-11-30","2015-12-31","2016-01-31","2016-02-29","2016-03-31","2016-04-30","2016-05-31","2016-06-30","2016-07-31","2016-08-31","2016-09-30","2016-10-31","2016-11-30","2016-12-31","2017-01-31","2017-02-28","2017-03-31","2017-04-30","2017-05-31","2017-06-30","2017-07-31","2017-08-31","2017-09-30","2017-10-31","2017-11-30","2017-12-31","2018-01-31","2018-02-28","2018-03-31","2018-04-30","2018-05-31","2018-06-30","2018-07-31","2018-08-31" FROM table
Result: The same. Date titled columns where imported with Column1, etc.
Can you guys give me any advice related to this matter?
Thanks in advance,

Brian Element's picture
Brian Element
Offline
Joined: 07/11/2012 - 19:57

It is because the first letter of the field must be a character, yours start with a number so that is why it is defaulting to Column1, Column2, etc as this is the default.  Try adding a character before the date and that should hopefully fix the problem.

idemnos's picture
idemnos
Offline
Joined: 06/17/2016 - 13:25

Thanks. I've got it.