显示标签为“automatically”的博文。显示所有博文
显示标签为“automatically”的博文。显示所有博文

2012年2月25日星期六

bcp column names

I am trying to run a query and put the results into an excel spreadsheet
automatically using bcp command.
bcp "sql query" queryout C:\testing.xls -c -Sservername -Uusername -Ppassword
The command works beautifully except that it overwrites the header column of
the excel file as well. Is there anyway in bcp to have the results be written
leaving the header column intact. Alternatively, I would like the results to
be written along with the column names.
ThanksUse a select union statement, the first select will be your header names
and the second select will be your results, this should work just fine
seeing that you are already outputting character data.
bcp "SELECT CONVERT(varchar(50),'COUMUMN_A') as 'a',
CONVERT(varchar(50),'COUMUMN_B') as 'b', CONVERT(varchar(50),'COUMUMN_C') as
'c' UNION SELECT CONVERT(varchar(50),X.id), CONVERT(varchar(50),X.name),
CONVERT(varchar(50),X.value) FROM DatabaseName.Owner.TableName X" queryout
C:\testing.xls -c -Sservername -Uusername -Ppassword
"inquisite" wrote:
> I am trying to run a query and put the results into an excel spreadsheet
> automatically using bcp command.
> bcp "sql query" queryout C:\testing.xls -c -Sservername -Uusername -Ppassword
> The command works beautifully except that it overwrites the header column of
> the excel file as well. Is there anyway in bcp to have the results be written
> leaving the header column intact. Alternatively, I would like the results to
> be written along with the column names.
> Thanks
>

2012年2月13日星期一

Batch Printing

Has anyone been able to automatically print via reporting services? I have
subscriptions set up that produce PDF files, but I have to go in and manually
print them. There's gotta be a better way.> Has anyone been able to automatically print via reporting services? I have
> subscriptions set up that produce PDF files, but I have to go in and
> manually
> print them. There's gotta be a better way.
I took a long and serious look at this problem and didn't come up with any
snappy solution.
Problems you are facing are mainly the following:
1) Delivering the PDFs to a specific folder, either by manually printing
from the client, or by some automatically scheduled job.
This one I solved with SSIS (Integration Services), which is watching a
"printing command table" in my SQL database, and invoking the report(s)
based on the info from new lines in the table.
Then using a Script task in SSIS, you can invoke the report from SSRS and
get a raw PDF back which SSIS then writes to a PDF file.
2) A PDF printing utility that can be invoked through the command line.
Acrobat reader does NOT handle this from the command line. Some versions of
Acrobat reader are said to handle it via an undocumented commandline switch,
but I found this to be Acrobat version dependent and gave up.
Found a PDF Printing utility from VeryPDF.COM where you can buy a single
server commandline utility for $199
3) Some kind of watching mecanism for the PDF folder which invokes the
PDFPrinting program.
This can be done which ever way you find suitable. It can even be done by
batch file programming, which I did for starters in my implementation.
All in all, a really cumbersome way of delivering reports directly to
printer from a product called "Reporting Services", but it works!
Regards,
Palli

Batch Printing

Hi All
I have a customer report that I need to automatically print at the end of
each month. What is the best way to programmatically print the report? Is
it also possible to specify the customers so that the report gets printed for
say all customers with a transaction in the last 30 days?
ThanksHi David,
Try adding a subscription to a file system for a report which prints all
statements and then have a windows scheduled job which pick up the PDF and
automatically print it. There are a number of windows script files which will
print all PDF's in a directory.
"David" wrote:
> Hi All
> I have a customer report that I need to automatically print at the end of
> each month. What is the best way to programmatically print the report? Is
> it also possible to specify the customers so that the report gets printed for
> say all customers with a transaction in the last 30 days?
> Thanks|||I've set up subscriptions but I have to go into the server and manually print
the PDF files. I'm being told by my vendor that I have to purchase a
supplemental program that costs 13K in order to print them automatically.
Isn't there an easier way?
"Jeremy Bentvelzen" wrote:
> Hi David,
> Try adding a subscription to a file system for a report which prints all
> statements and then have a windows scheduled job which pick up the PDF and
> automatically print it. There are a number of windows script files which will
> print all PDF's in a directory.
> "David" wrote:
> > Hi All
> >
> > I have a customer report that I need to automatically print at the end of
> > each month. What is the best way to programmatically print the report? Is
> > it also possible to specify the customers so that the report gets printed for
> > say all customers with a transaction in the last 30 days?
> >
> > Thanks