Solved

MS SQL breaking script results into different files?

Posted on 2014-02-03
3
167 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 39

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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
SQL Server 2008 R2 - Execution Plan 3 56
Joining Two Tables In SQL and combining records 6 52
Filtered index 5 55
Implementing SQL Server Data Files in Azure 1 35
There have been several questions about Large Transaction Log Files in SQL Server 2008, and how to get rid of them when disk space has become critical. This article will explain how to disable full recovery and implement simple recovery that carries…
In this article I will describe the Detach & Attach 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.
Here's a very brief overview of the methods PRTG Network Monitor (https://www.paessler.com/prtg) offers for monitoring bandwidth, to help you decide which methods you´d like to investigate in more detail.  The methods are covered in more detail in o…
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …

919 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

14 Experts available now in Live!

Get 1:1 Help Now