473,651 Members | 2,647 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 1338

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

Similar topics

1
4234
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
1823
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
1713
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
3090
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
10492
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
2319
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
1061
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
3371
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
3210
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
8347
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8694
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...
1
8457
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
1
6157
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
4143
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
4280
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2696
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
1
1905
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
2
1585
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.