dbTalk Databases Forums  

saving SELECT results to excel -NEWBIE

microsoft.public.sqlserver.dts microsoft.public.sqlserver.dts


Discuss saving SELECT results to excel -NEWBIE in the microsoft.public.sqlserver.dts forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
TC
 
Posts: n/a

Default saving SELECT results to excel -NEWBIE - 07-26-2004 , 10:00 AM






Ok, I'm a relative newbie to dts...

I need to take several relatively simple SELECT statements,

i.e., select * from table_xyz where code = 'a'

and insert the results into different cells within an excel row.
The excel file is used by salespeople and others and the dts
package of which the select statements are a part runs on a
daily basis. Each row is a different day...

Thanks in advance.



Reply With Quote
  #2  
Old   
Allan Mitchell
 
Posts: n/a

Default Re: saving SELECT results to excel -NEWBIE - 07-26-2004 , 10:05 AM






If by "different cells" you mean that you need to insert the values returned
all over the Excel workbook then DTS is not really your tool.
You need to use the Excel object model by the sounds of it.

DTS sure can take a rowset from a query such as yours and insert into a
named range/table but if those cells is distributed about the workbooko then
IMHO you are better off using the Excel Object model from probably Excel.

--
--

Allan Mitchell MCSE,MCDBA, (Microsoft SQL Server MVP)
www.SQLDTS.com - The site for all your DTS needs.
www.konesans.com - Consultancy from the people who know


"TC" <spam (AT) yahoo (DOT) com> wrote

Quote:
Ok, I'm a relative newbie to dts...

I need to take several relatively simple SELECT statements,

i.e., select * from table_xyz where code = 'a'

and insert the results into different cells within an excel row.
The excel file is used by salespeople and others and the dts
package of which the select statements are a part runs on a
daily basis. Each row is a different day...

Thanks in advance.





Reply With Quote
  #3  
Old   
TC
 
Posts: n/a

Default Re: saving SELECT results to excel -NEWBIE - 07-26-2004 , 10:17 AM



*groan*
I've had to learn waaay too much over the past two weeks...
Before I go trotting down excel object lane, let me clarify,
and see if you still concur about the excel object...

I have 5 different SELECT statements, each which tallies a
different quantity. In the spreadsheet, a row represents a
day. As the package runs each day, an operator would have
to go back, run each of the statements separately and enter
them into that days row. i.e., query 1 total goes in 1st cell,
query 2 total goes in 2nd cell, etc...

I was hoping there was some simplistic way for dts to find
the next blank row and insert the data from the queries in
each cell.

Does it still sound as if I need excel object model?

"Allan Mitchell" <allan (AT) no-spam (DOT) sqldts.com> wrote

Quote:
If by "different cells" you mean that you need to insert the values
returned
all over the Excel workbook then DTS is not really your tool.
You need to use the Excel object model by the sounds of it.

DTS sure can take a rowset from a query such as yours and insert into a
named range/table but if those cells is distributed about the workbooko
then
IMHO you are better off using the Excel Object model from probably Excel.

--
--

Allan Mitchell MCSE,MCDBA, (Microsoft SQL Server MVP)
www.SQLDTS.com - The site for all your DTS needs.
www.konesans.com - Consultancy from the people who know


"TC" <spam (AT) yahoo (DOT) com> wrote

Ok, I'm a relative newbie to dts...

I need to take several relatively simple SELECT statements,

i.e., select * from table_xyz where code = 'a'

and insert the results into different cells within an excel row.
The excel file is used by salespeople and others and the dts
package of which the select statements are a part runs on a
daily basis. Each row is a different day...

Thanks in advance.







Reply With Quote
  #4  
Old   
Allan Mitchell
 
Posts: n/a

Default Re: saving SELECT results to excel -NEWBIE - 07-26-2004 , 10:29 AM



Ah OK So say your workboox looks like this


DateRun,Value1, Value2, Value3


If you ran it today you would want say

DateRun,Value1, Value2, Value3
20040726,1,2,3


Next week you want

DateRun,Value1, Value2, Value3
20040726,1,2,3
20040802,1,2,3


etc etc.

Am i right?

In which case you can use DTS. The Excel way of doing stuff is to append.
The structure of

DateRun,Value1, Value2, Value3

will appear as a table to DTS.




--
--

Allan Mitchell MCSE,MCDBA, (Microsoft SQL Server MVP)
www.SQLDTS.com - The site for all your DTS needs.
www.konesans.com - Consultancy from the people who know


"TC" <spam (AT) yahoo (DOT) com> wrote

Quote:
*groan*
I've had to learn waaay too much over the past two weeks...
Before I go trotting down excel object lane, let me clarify,
and see if you still concur about the excel object...

I have 5 different SELECT statements, each which tallies a
different quantity. In the spreadsheet, a row represents a
day. As the package runs each day, an operator would have
to go back, run each of the statements separately and enter
them into that days row. i.e., query 1 total goes in 1st cell,
query 2 total goes in 2nd cell, etc...

I was hoping there was some simplistic way for dts to find
the next blank row and insert the data from the queries in
each cell.

Does it still sound as if I need excel object model?

"Allan Mitchell" <allan (AT) no-spam (DOT) sqldts.com> wrote in message
news:Om8oCIycEHA.2352 (AT) TK2MSFTNGP09 (DOT) phx.gbl...
If by "different cells" you mean that you need to insert the values
returned
all over the Excel workbook then DTS is not really your tool.
You need to use the Excel object model by the sounds of it.

DTS sure can take a rowset from a query such as yours and insert into a
named range/table but if those cells is distributed about the workbooko
then
IMHO you are better off using the Excel Object model from probably
Excel.

--
--

Allan Mitchell MCSE,MCDBA, (Microsoft SQL Server MVP)
www.SQLDTS.com - The site for all your DTS needs.
www.konesans.com - Consultancy from the people who know


"TC" <spam (AT) yahoo (DOT) com> wrote in message
news:2mkklmFma1nhU1 (AT) uni-berlin (DOT) de...
Ok, I'm a relative newbie to dts...

I need to take several relatively simple SELECT statements,

i.e., select * from table_xyz where code = 'a'

and insert the results into different cells within an excel row.
The excel file is used by salespeople and others and the dts
package of which the select statements are a part runs on a
daily basis. Each row is a different day...

Thanks in advance.









Reply With Quote
  #5  
Old   
TC
 
Posts: n/a

Default Re: saving SELECT results to excel -NEWBIE - 07-26-2004 , 10:43 AM



Quote:
Am i right?

Bingo!




Reply With Quote
  #6  
Old   
TC
 
Posts: n/a

Default Re: saving SELECT results to excel -NEWBIE - 07-26-2004 , 04:08 PM



Quote:
In which case you can use DTS. The Excel way of doing stuff is to append.
The structure of

DateRun,Value1, Value2, Value3

will appear as a table to DTS.
Hey, could you get post a code example or provide a link for any information
describing this procedure?

Are you saying to somehow create a table identical to the excel spreadsheet,
then somehow save the table as the spreadsheet, overwriting it each time?
Thanks.




Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.