Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people, just like you, are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
Solved

MS SQL breaking script results into different files?

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

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
replicated - directional or bidirectional? 3 34
SQL Syntax: How to force case sensitive query? 2 44
PolyServe for SQL server 12 30
Negative isnull? 3 14
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.
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.

789 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