Link to home
Start Free TrialLog in
Avatar of j_heck
j_heck

asked on

MS SQL breaking script results into different files?

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
Avatar of lcohan
lcohan
Flag of Canada image

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
ASKER CERTIFIED SOLUTION
Avatar of Jim Horn
Jim Horn
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of j_heck
j_heck

ASKER

Thanks Jim, that is what I thought.