Hi!!
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..
it's possible?
Thanks!!!
PS: I hope that you understand my problems..
I know poor english.. ;-)Why not post your DDL and DML...
Check out
SELECT Data_Row FROM (
SELECT '"Owner","Job"' As Data_Row, 1 AS Row_Group
UNION ALL
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|||thanks..
i've already done in that mode... ;-)sql
Showing posts with label appending. Show all posts
Showing posts with label appending. Show all posts
Tuesday, March 27, 2012
Wednesday, March 21, 2012
DTS- Data Driven Query Task
I use a data driven query task to perform row updates along with appending row data to a text file. In the source I use 'select top 1000 field1, ..., fieldn from table'. The package hangs when executing the data driven task. If I reduce the return count to 'select top 100...' the package execute with no problems. I can do that 10 times, with no problems. But anything more then 100 will hang the package at that task. Please help!
Thanks,
MoniqueTake help from PROFILER and see where it hangs.
The other method of limiting the size of a result set is to execute a SET ROWCOUNT n statement before executing a statement. SET ROWCOUNT differs from TOP.
The TOP clause applies to the single SELECT statement in which it is specified. SET ROWCOUNT remains in effect until another SET ROWCOUNT statement is executed, such as SET ROWCOUNT 0 to turn the option off.
Thanks,
MoniqueTake help from PROFILER and see where it hangs.
The other method of limiting the size of a result set is to execute a SET ROWCOUNT n statement before executing a statement. SET ROWCOUNT differs from TOP.
The TOP clause applies to the single SELECT statement in which it is specified. SET ROWCOUNT remains in effect until another SET ROWCOUNT statement is executed, such as SET ROWCOUNT 0 to turn the option off.
Sunday, March 11, 2012
DTS and appending to a text file
can I run a query within DTS and APPEND it to a text file?
please adviseRafael Chemtob wrote:
> can I run a query within DTS and APPEND it to a text file?
Yes. On the Connection toolbar select the "Text File (Destination)"
icon (it looks like a Text File icon w/ a left-pointing arrow).
MGFoster:::mgf00 <at> earthlink <decimal-point> net
Oakland, CA (USA)
please adviseRafael Chemtob wrote:
> can I run a query within DTS and APPEND it to a text file?
Yes. On the Connection toolbar select the "Text File (Destination)"
icon (it looks like a Text File icon w/ a left-pointing arrow).
MGFoster:::mgf00 <at> earthlink <decimal-point> net
Oakland, CA (USA)
DTS Advice - Appending to a Text File
Hi all,
I am having a problem with a DTS package I am writing. The package is getting text from a table and putting it out to a text file. I have most of it sorted, and contains text like this:
PN,GEN,T_KI-3,2006-01-24 00:30,480,2006-01-24 01:00,480
PN,GEN,T_KI-2,2006-01-24 00:40,484,2006-01-24 02:00,482
PN,GEN,T_KI-3,2006-01-24 00:50,490,2006-01-24 05:00,486
What I need is a line at the end of the text which is:
<EOF>
So the output from this will look like:
PN,GEN,T_KI-3,2006-01-24 00:30,480,2006-01-24 01:00,480
PN,GEN,T_KI-2,2006-01-24 00:40,484,2006-01-24 02:00,482
PN,GEN,T_KI-3,2006-01-24 00:50,490,2006-01-24 05:00,486
<EOF>
I am having problems adding the line at the end of the text file. Can anyone advice me of a good solution or show me where I amn going wrong?
TAI,
GeeI'm confused...you want the valeu "<EOF>" in the table?
Is it in the file.
Oh, and read my sig|||Sorry, I am sending the result of a query to a text file, and i want to end the text file with a final line that has <EOF> on it.|||Does anyone have an idea how I can add the text <EOF> to the bottom of a text file? I am sure this is simple but I just can't figure it out and it is making me go nuts! :(|||There are a number of ways to get there from here. I'd suggest that you re-read Brett's response and follow his suggestion if you want more detailed help.
If this is a "one off" kind of solution, you might consider using an Active-X script at the end of the DTS package that outputs the string for you. It is easy to add, and means no convoluted logic, just a "tag along" bit of trailer code.
-PatP
I am having a problem with a DTS package I am writing. The package is getting text from a table and putting it out to a text file. I have most of it sorted, and contains text like this:
PN,GEN,T_KI-3,2006-01-24 00:30,480,2006-01-24 01:00,480
PN,GEN,T_KI-2,2006-01-24 00:40,484,2006-01-24 02:00,482
PN,GEN,T_KI-3,2006-01-24 00:50,490,2006-01-24 05:00,486
What I need is a line at the end of the text which is:
<EOF>
So the output from this will look like:
PN,GEN,T_KI-3,2006-01-24 00:30,480,2006-01-24 01:00,480
PN,GEN,T_KI-2,2006-01-24 00:40,484,2006-01-24 02:00,482
PN,GEN,T_KI-3,2006-01-24 00:50,490,2006-01-24 05:00,486
<EOF>
I am having problems adding the line at the end of the text file. Can anyone advice me of a good solution or show me where I amn going wrong?
TAI,
GeeI'm confused...you want the valeu "<EOF>" in the table?
Is it in the file.
Oh, and read my sig|||Sorry, I am sending the result of a query to a text file, and i want to end the text file with a final line that has <EOF> on it.|||Does anyone have an idea how I can add the text <EOF> to the bottom of a text file? I am sure this is simple but I just can't figure it out and it is making me go nuts! :(|||There are a number of ways to get there from here. I'd suggest that you re-read Brett's response and follow his suggestion if you want more detailed help.
If this is a "one off" kind of solution, you might consider using an Active-X script at the end of the DTS package that outputs the string for you. It is easy to add, and means no convoluted logic, just a "tag along" bit of trailer code.
-PatP
Subscribe to:
Posts (Atom)