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

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

ISQL & BCP in MS SQL 6.5

Hi, I'm a beginner using MS SQL 6.5. I need to seek help on some of the questions below:

1) How do I make use of ISQL and BCP to extract the results of a stored procedure to an Excel file format?

2) How do I create a stored procedure?

3) How do I create a batch file to run the query every day?

Kindly put in examples to simplify your help.
Thank You.
0
jensenaw
Asked:
jensenaw
1 Solution
 
TheSpiritCommented:
1) Don't think that ISQL or BCP will export in Excel format exactly BCP can be used to export to a text file which can then be imported into Excel.

2) Take a look at 'Create procedure' in Books on line

3) You would need to create a scheduled task to achieve this, there are a number of ways this task could work (either having a file that is run from a cmdexec task or just coding each tsql command in seperate job steps)

I would recommend having a look at books on line, its just packed with information.
0
 
chigrikCommented:
Regarding your first question:
you can use ExportToExcel stored procedure to insert the result set of the particular select statement into Excel file.
http://www.MSSQLCity.com/Scripts/SQL65/ExportToExcel.sql

With best regards,
Alexander Chigrik
http://www.MSSQLCity.com/ - all about MS SQL
(SQL Server Articles, FAQ, Scripts, Tips and Test Exams).
0
 
jensenawAuthor Commented:
Hi chigrik,

I have some questions on using your ExportToExcel stored procedure.

1) After putting in the data like server, query statement (I paste the whole query in) and the filename, the result I get is that "this command did not return any rows, or data". When I go and look for the file, I cannot find it.
0
 
CleanupPingCommented:
jensenaw:
This old question needs to be finalized -- accept an answer, split points, or get a refund.  For information on your options, please click here-> http:/help/closing.jsp#1 
EXPERTS:
Post your closing recommendations!  No comment means you don't care.
0
 
moduloCommented:
PAQ and points refunded

modulo

Community Support Moderator
Experts Exchange
0

Featured Post

New feature and membership benefit!

New feature! Upgrade and increase expert visibility of your issues with Priority Questions.

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