Go Premium for a chance to win a PS4. Enter to Win

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 234
  • Last Modified:

SQL Output Report

I would like to have a stored procedure to product an output report to a text file.  Is this possible?

Table1

PN               MonthGenerated
---               ---------------------
12345         Apr
22345         Apr
11111        Mar
22222        Mar
11211       Jun


Output report

"Monthly Generated Report"

Month                  Counts
-------                  ---------
Mar                     2
Apr                    2
Jun                     1
0
Fairfield
Asked:
Fairfield
  • 2
1 Solution
 
pssandhuCommented:
You can use the OSQL utility to do that. It is a command like utility that can run against your SQL server, store it as a batch file and schedule it through windows scheduler.
Here is more info on the OSQL utility: http://technet.microsoft.com/en-us/library/aa213090(SQL.80).aspx
Hope this helps.
P.
0
 
Aneesh RetnakaranDatabase AdministratorCommented:
usq sqlcmd utitliy
SQLCMD -S ServerName -d DatabaseName -E -Q"select * from tablename "  -o "E:\output.txt"
0
 
FairfieldAuthor Commented:
Is there a way to combing multiple reports into one single report?
0

Featured Post

Ask an Anonymous Question!

Don't feel intimidated by what you don't know. Ask your question anonymously. It's easy! Learn more and upgrade.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now