Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Store procedures in SQL Server 7.0

Status
Not open for further replies.

Fursten

Programmer
Joined
Dec 27, 2000
Messages
403
Location
PT
Hi,

I have a few classes (or a classe it doesn´t metter) that do a lot of selects and then do some calculations over that data and, at last, write to a text file....

Because this makes a lot of calls to the database I thought of put this code as a store procedure or something like that, but I don´t no if is possible to generate a text file using store procedures... Am I thinking in a completed wrong way?


Thank you in advance,

Sergio Oliveira
 
If you running SQL Server 7.0 or higher have you considered possibly using DTS??

i.e.

1) You have a Stored Procedure which runs all your SQL

2) Step 1 in the DTS package then executes the SP.

3) Step 2 in the DTS package transfers to a text file.

Rick.
 
Hi,

I´never did suchthing, but I have some ideias. However I have another doubt...

Those 3 steps need to be done record by record... for instance, after the first selects I get the first line to put on my text file. Then I will do the same Select in another records of the same table and I will get the second line to put in the text file... this is a while cycle.

So is that possible to do those 3 steps like a cycle? About the resources and time that it spends... is it better than doing all of that in the client? I ask this because I don´t have any ideia of how sql server manage it´s resources with store procedures and DTS...

Thank you again.

Sergio Oliveira
 
Without more details it's hard to guess the best approach here. But it looks to me as though you should be creating a temporary table or a holding table.

Insert all your records into this table and then have a final Select * from table with the results being directed into your text file.

Rick.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top