I've a "little" problem...
I must generate a txt file with this structure:
- one header
- n details
Header and details have different structure and i must write header before details.. I've already a table with details.. i could create table for header, but this table design it's too different than details design.. and i can't use the union statement in the output query..
Can i write the header line and write details in append on a txt file??
with data pump i can create and replace file.. but not append??
I know that i could use the filesystem object to modify the file, but i would bypass it with tasks of SQL server..
PS: I hope that you understand my problems..
I know poor english.. ;-)
SELECT Data_Row FROM (
SELECT '"Owner","Job"' As Data_Row, 1 AS Row_Group
SELECT '"' + l.Name+ '","' + j.Name + '"', 2 AS Row_Group
FROM msdb..sysjobs j
INNER JOIN master..syslogins l
ON l.sid = j.owner_sid
) AS XXX
ORDER BY Row_Group