473,888 Members | 1,376 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Need to insert a header in a tsql select to run in an SSIS package

1 New Member
Hi!
I'm new to sql 2005 and need to run an automated report that is a fairly simple fixed width ragged right report. Problem is I need a header in the report that has static text, plus the rowcount of the report.
I am using an SSIS package to call the script. I think that's the way to go because I need it to run on Friday's at 3:00. Then I'll have a scheduled event to fire it off via sFTP from my server.(Althoug h Im opent to ANY Suggestions)

Is there a way to write out the header in the one tsql statement, then write out the second select to the same file? Or do I need to set up SSIS to run 2 TSQL scripts (The header and the report) and write them out to the same file?

I gotta think it SHOULD be as easy as

SELECT 'Headerrowcount '+ltrim(Str(cou nt(UserName))) + 'HRBATCH' AS header
FROM db_owner.PS_HR_ Hrs
WHERE Reported is NULL

Then do some sql magic code here to append the following select file




SELECT EmplID, Convert(VarChar ,DateWorked,111 ),'STSSH', CAST(REPLACE(ST R(HoursWorked,9 , 5), SPACE(1), '0') AS nchar(9)), HRAccountCode, CAST(REPLACE(ST R(EmployeePayRa te,18, 6), SPACE(1), '0') AS nchar(18)), 'A_STUDSUM', HRAccountCodeOv erride
FROM db_owner.PS_HR_ Hrs
WHERE reported is NULL


to get:

Header24HRBTCH

10068800 2007/06/04STSSH012.0000 0 A108145 00000000007.500 000 A_STUDSUM

10068800 2007/06/05STSSH002.0000 0 A108145 00000000007.500 000 A_STUDSUM ...
Aug 17 '07 #1
0 1348

Sign in to post your reply or Sign up for a free account.

Similar topics

1
4247
by: Rohit Raghuwanshi | last post by:
Hello all, we are running a delphi application with DB2 V8.01 which is causing deadlocks when rows are being inserted into a table. Attaching the Event Monitor Log (DEADLOCKS WITH DETAILS) here. From the log it looks like the problem happens when 2 threads insert 1 record each in the same table and then try to aquire a NS (Next Key Share) lock on the record inserterd by the other thread. Thanks Rohit
0
1844
by: AMAN | last post by:
Hi all, I am a newbie to SSIS.Need a solution to couple of issues I am currently facing while developing ETL in SSIS 1) Under SSIS Package Folder I have defined mappings for 17 dimensions. 1st Dimension say Account has been Set up as a startup object. Now when I run the package ir runs only my account dimension and loads the target,other dimensions are not run at all!
0
1730
by: fboweb.com | last post by:
Hey there! I have a DTS import package from an old SQL server that takes flat text files, does some munging on the columns using ActiveX scripts and imports those flat files to various tables. The package itself is rather tedious because it does this munging on a number of large files with a number of different fields. When I bring the package in via SSIS, importing/migrating the
0
3099
by: ansonee | last post by:
I am encountering a weird issue with SSIS. I have a very simple SSIS package that executes a .bat file. Here's the actual file it executes: @Echo Off c: F: cd ReportingServicesScripts
9
10520
by: gelangov | last post by:
I have 2 variables, one is the column name of the table and the other one is the table name and I need to write this in the "Execute SQL task" of a "For each loop" container in a ssis package like this: Truncate table <tableName> Insert into <tableName> Exec (' select from '+ ?) It gives me error message when I try run the ssis. However if I put the above statements into a stored procedure and wrote look this, it
0
2331
by: rmsterling | last post by:
DSN ODBC pwd not saved when SSIS package imported SQL Server 2005 SP2 (Windows 32bit version) Implemented and FULLY tested a SSIS package with BIDs. This package uses a Data Reader object using a ODBC data source with a stored username (uid) and password (pwd). These are saved with the package locally. I then import the package directly in to SQL Server. I then create a scheduled SQL Agent job to run this package daily. When I look...
0
1074
by: bhu | last post by:
I converted sql 2000 package to ssis. I had flat file to table and i had some activex script for formatting of columns in the dts. hence when i migrated to sql 2005 ssis those steps are converted to execute sql 2000 package task and when i try to execute the package from vba all other steps execute except these steps. Can anybody can tell how to make this step run from VB or how to run the dtexec from VB. thanks Bhu
2
3380
by: pvong | last post by:
I'm new to SSIS. Can someone point me in the right direction on how to execute an SSIS package from a button OnClick? With DTS in SQL2000, I just created a job that ran the DTS package and then ran the job from a Stored Procedure. Thanks! Phil
0
3233
by: pinky22 | last post by:
I am calling SSIS package from a .Net windows UI. Both SSIS & .Net app are created in 2008. The SSIS package is stored in file system. When I ran .Net app I got error- The package failed to load due to error 0xC0011008 "Error loading from XML. No further detailed error information can be specified for this problem because no Events object was passed where detailed error information can be stored.". This occurs when CPackage::LoadFromXML...
0
9800
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10778
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
10439
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
7990
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
7148
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5824
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
6014
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4642
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
4247
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.