Solved

MS SQL breaking script results into different files?

Posted on 2014-02-03
3
170 Views
Last Modified: 2014-02-04
There is a table that I have to work with that has data which is sorted by Bill To Manufacture Name (BillToMfgName) and a Manufacture Name (MfgName).  Any time the BillToMfgName and/or MfgName changes I need to put the data in a new results section.  Is there any way to do this?  Or to write each of the results set to a new csv file?

Thanks, John
0
Comment
Question by:j_heck
3 Comments
 
LVL 40

Expert Comment

by:lcohan
ID: 39830329
You can do both those things via SQL Server table TRIGGERS where you check if the INSERTED value for the specific column is different that the DELETED the either populate the results column(or another table/column) with data or pipe the result out to a csv file - I would not recommend the second option with the CSV file.

http://msdn.microsoft.com/en-us/library/ms189799(v=sql.105).aspx
0
 
LVL 65

Accepted Solution

by:
Jim Horn earned 500 total points
ID: 39830505
>Any time the BillToMfgName and/or MfgName changes I need to put the data in a new results section.
If by 'results section' you mean how the data is viewed, then this should really be handled by whatever reporting app you're using, and not by T-SQL or in the data.
0
 

Author Closing Comment

by:j_heck
ID: 39832607
Thanks Jim, that is what I thought.
0

Featured Post

Free Tool: Postgres Monitoring System

A PHP and Perl based system to collect and display usage statistics from PostgreSQL databases.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In this article I will describe the Backup & Restore method as one possible migration process and I will add the extra tasks needed for an upgrade when and where is applied so it will cover all.
In this article I will describe the Copy Database Wizard method as one possible migration process and I will add the extra tasks needed for an upgrade when and where is applied so it will cover all.
I've attached the XLSM Excel spreadsheet I used in the video and also text files containing the macros used below. https://filedb.experts-exchange.com/incoming/2017/03_w12/1151775/Permutations.txt https://filedb.experts-exchange.com/incoming/201…

685 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