473,320 Members | 2,071 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

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

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.(Although 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(count(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(STR(HoursWorked,9, 5), SPACE(1), '0') AS nchar(9)), HRAccountCode, CAST(REPLACE(STR(EmployeePayRate,18, 6), SPACE(1), '0') AS nchar(18)), 'A_STUDSUM', HRAccountCodeOverride
FROM db_owner.PS_HR_Hrs
WHERE reported is NULL


to get:

Header24HRBTCH

10068800 2007/06/04STSSH012.00000 A108145 00000000007.500000 A_STUDSUM

10068800 2007/06/05STSSH002.00000 A108145 00000000007.500000 A_STUDSUM ...
Aug 17 '07 #1
0 1328

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

Similar topics

1
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....
0
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....
0
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. ...
0
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
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...
0
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...
0
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...
2
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...
0
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...
0
by: DolphinDB | last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation. Take...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
0
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....

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.