Solved

SQL Output Report

Posted on 2009-07-10
4
222 Views
Last Modified: 2012-05-07
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
Comment
Question by:Fairfield
  • 2
4 Comments
 
LVL 17

Expert Comment

by:pssandhu
ID: 24824190
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
 
LVL 75

Accepted Solution

by:
Aneesh Retnakaran earned 500 total points
ID: 24824192
usq sqlcmd utitliy
SQLCMD -S ServerName -d DatabaseName -E -Q"select * from tablename "  -o "E:\output.txt"
0
 

Author Comment

by:Fairfield
ID: 24824403
Is there a way to combing multiple reports into one single report?
0
 
LVL 17

Expert Comment

by:pssandhu
ID: 24824489
0

Featured Post

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

Occasionally there is a need to clean table columns, especially if you have inherited legacy data. There are obviously many ways to accomplish that, including elaborate UPDATE queries with anywhere from one to numerous REPLACE functions (even within…
In this article we will get to know that how can we recover deleted data if it happens accidently. We really can recover deleted rows if we know the time when data is deleted by using the transaction log.
When you create an app prototype with Adobe XD, you can insert system screens -- sharing or Control Center, for example -- with just a few clicks. This video shows you how. You can take the full course on Experts Exchange at http://bit.ly/XDcourse.
This tutorial demonstrates a quick way of adding group price to multiple Magento products.

746 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now