Monday, March 26, 2012

Help on print report or export to a file

Hi,
I'm new to SQL programming. I'm using MS SQL 2000, and I like to schedule a
job to print a report which has information pulling from tables.
For example,
select * from customer where status='yes'
I like to retrieve this list either on a printer or to a file.
Is that possible? If this needs to be coded, can you please give me some
example?
Thanks so much in advance,
SarahHi,
I wanted to add more information to my question. Or how to save the results
of stored procedure to a file to print to a printer.
Thanks,
Sarah
"Sarah" <sguo@.coopervision.com> wrote in message
news:%23bcqFfUFGHA.140@.TK2MSFTNGP12.phx.gbl...
> Hi,
> I'm new to SQL programming. I'm using MS SQL 2000, and I like to schedule
> a job to print a report which has information pulling from tables.
> For example,
> select * from customer where status='yes'
> I like to retrieve this list either on a printer or to a file.
> Is that possible? If this needs to be coded, can you please give me some
> example?
> Thanks so much in advance,
> Sarah
>|||You can use bcp and xp_cmdshell to write the results of a query to a text fi
le.
Here is a link that explains the process.
http://www.sqlteam.com/item.asp?ItemID=4722
Ryan Powers
Clarity Consulting
http://www.claritycon.com
"Sarah" wrote:

> Hi,
> I wanted to add more information to my question. Or how to save the result
s
> of stored procedure to a file to print to a printer.
> Thanks,
> Sarah
> "Sarah" <sguo@.coopervision.com> wrote in message
> news:%23bcqFfUFGHA.140@.TK2MSFTNGP12.phx.gbl...
>
>|||> I like to retrieve this list either on a printer or to a file.
You can send to a file easily... some simple examples here:
http://www.aspfaq.com/2482
Unfortunately, SQL Server has no idea what a printer is. Might be better
suited for an external app (or maybe reporting services?).|||Thanks Aaron and Ryan, that's great help.
Sarah
"Aaron Bertrand [SQL Server MVP]" <ten.xoc@.dnartreb.noraa> wrote in message
news:uIv9aGVFGHA.2856@.TK2MSFTNGP12.phx.gbl...
> You can send to a file easily... some simple examples here:
> http://www.aspfaq.com/2482
> Unfortunately, SQL Server has no idea what a printer is. Might be better
> suited for an external app (or maybe reporting services?).
>

No comments:

Post a Comment