JICGreg
Technical User
- Mar 14, 2007
- 34
I'm missing something, what I think is easy, here that hopefully someone can help me with
I'm connecting to an excel 2007 file to bring in data. The following code, when hardcoded works (there is obviously more to the code but this is the relevant part)
store '"2009_3_distinct_portfolios$"' TO sheetname
lcSQLCmd = [Select * FROM &sheetname]
I may be hard to see on the screen so it is single quote, double quote, 2009....., doublequote, singlequote
Problem, is I need the flexability to change the sheetname as dates change. So I have created:
STORE '"' + ALLTRIM(STR(year)) + "_" + alltrim(STR(month)) + "_distinct_portfolios$" + '"' TO sheetname1
(double quote + year_month_distinctportfolios + doublequote
STORE "'" + sheetname1 + "'" to sheetname
(single quote + sheetname1 + single quote
When I print it out to the screen, it looks like the hardcoded version. However, it does not work in the select statement. My best guess is that it has something to do with the single and/or double quotes.
Can anyone provide help
Problem is it is data specfic so I am trying to change it to be date agnostic. The code I came up with is this:
STORE '"' + ALLTRIM(STR(year)) + "_" + alltrim(STR(month)) + "_distinct_portfolios$" + '"' TO sheetname1
STORE "'" + sheetname1 + "'" to sheetname
It looks like (whne I print it to the screen) it should work. But it does not. Can you tell me what i'm doing wrong.
Greg
I'm connecting to an excel 2007 file to bring in data. The following code, when hardcoded works (there is obviously more to the code but this is the relevant part)
store '"2009_3_distinct_portfolios$"' TO sheetname
lcSQLCmd = [Select * FROM &sheetname]
I may be hard to see on the screen so it is single quote, double quote, 2009....., doublequote, singlequote
Problem, is I need the flexability to change the sheetname as dates change. So I have created:
STORE '"' + ALLTRIM(STR(year)) + "_" + alltrim(STR(month)) + "_distinct_portfolios$" + '"' TO sheetname1
(double quote + year_month_distinctportfolios + doublequote
STORE "'" + sheetname1 + "'" to sheetname
(single quote + sheetname1 + single quote
When I print it out to the screen, it looks like the hardcoded version. However, it does not work in the select statement. My best guess is that it has something to do with the single and/or double quotes.
Can anyone provide help
Problem is it is data specfic so I am trying to change it to be date agnostic. The code I came up with is this:
STORE '"' + ALLTRIM(STR(year)) + "_" + alltrim(STR(month)) + "_distinct_portfolios$" + '"' TO sheetname1
STORE "'" + sheetname1 + "'" to sheetname
It looks like (whne I print it to the screen) it should work. But it does not. Can you tell me what i'm doing wrong.
Greg