Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 select with Header and detail

Author  Topic 

Vack
Aged Yak Warrior

530 Posts

Posted - 2014-09-16 : 15:26:25
I have a flat file I need to generate, wanted to create my file from a SQL view.

Is there a way to have a Header and Detail Record for each Record in my view?


Fields would be:

Line no type period ref amt date Inv_no
0 M 1 3/3/2014
1 M Pay inv: 400.00 12345


where 0 is the header and 1 is the detail. Only certain fields will be in the header and others in the detail.

Or is there a better way of doing this?

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2014-09-16 : 15:48:42
Sure you can do that. How it'll be done will be dependent upon the database design.

Tara Kizer
SQL Server MVP since 2007
http://weblogs.sqlteam.com/tarad/
Go to Top of Page
   

- Advertisement -