Edit query in Excel

V

Vandy

Hi
I am trying to pull information from SQL server by editing a existing
query in excel. I could able to pull data but the format is changing
from the existing format.

My format will be like this

coulmN-A coulmN-B coulmN-c coulmN-D

I need only CoulmnA, ColumnB and ColumnD from SQL server. ColumnC will
be manually entered. After editing query the data is filling to first 3
coulmns not 1st two and fourth columns.

Could you please advice how to tackle this problem.

Thanks in advance.
 
G

Guest

Try something like this:

Edit the query in MSQuery
Click the [SQL] button

Manually enter a new field where you want it to appear, using this syntax
'' AS 'InputCol'
(Replace InputCol with whatever field name you want to appear in the
worksheet.

Example:

Starting with this SQL:
SELECT
rngDatesString.MyDates
, rngDatesString.MyStrings
FROM
`C:\ExcelQueries\Lists`.rngDatesString rngDatesString

I inserted the sample field as follows:
SELECT
rngDatesString.MyDates
, '' AS 'InputCol'
, rngDatesString.MyStrings
FROM
`C:\ExcelQueries\Lists`.rngDatesString rngDatesString

Note: when manually entered fields are imported to Excel, they display with
the single quotes. In my version of Excel (2002), I don't think there's a
way to avoid that.

Does that help?
***********
Regards,
Ron

XL2002, WinXP
 
C

chinna sankar

Hi Ron

Thanks for the reply. I have already title under column D
But the data is sitting under column C after the query.
The column D is shifting right side.

Do you have any suggestion on this?

Thanks
Chinna
 
G

Guest

I may have misunderstood your request.
If you have manually entered values in Col_C, the data import will overwrite
them with blanks or move Col_C over to the right, depending on the table
options you select. There's no way to have the data import fill columns A,
B, and D without impacting Col_C, if that's what you were hoping for.

There may be other possibilities, via MS Query...depending on the specifics
of your structure.

Can you describe how you use (or hope to use) the data?
***********
Regards,
Ron

XL2002, WinXP
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top