Creating A Dynamic Excel File
Nov 17, 2006
Is it possible that i can create a dynamic excel file (destination)
ex, i want to create a Dyanamic Excel destination file with a filename base on the date
this will run on jobs. Is this possible?
11172006.xls, 11182006.xls
View 43 Replies
ADVERTISEMENT
Mar 2, 2014
I am trying to create an ssis package with dynamic csv file as output. and out format contains query output.
sample file name:
Unique identifier + query output + systemdate();
The expression is looking like this.
@[User::FilePath] + @[User::FileName] + ".CSV"
-- user filepath is a variable from ssis package. File name is the output from SQL query. using script task i have assigned the values to @[User::FileName] .
When I debugged the script task the value getting properly but same variable am using for Flafile destination. but its not working.
View 3 Replies
View Related
May 21, 2002
I am somewhat new to DTS packages - please bear with me...
:: Overview:
From a web page, I need to create a text file on a User's mapped drive drive (note: the mapped drive is always the same and it is a drive that the IIS cannot see, and FTP is not an option here). One of the parameters I need to pass from the web page (to the DTS) is the text file name.
Currently, I have a stored procedure that creates my dataset for my text file, and I can create the text file from the web page onto the IIS server, but this does not solve my problem.
My dilemma is how do I create the dynamic text onto the mapped drive? The SQL server CAN see the mapped drive.
Can I bring together what the Stored Procedure creates AND pass thru the dataset and the dynamic name to a DTS so it can create and save the file?
Can the Stored Procedure be eliminated and it all be done via DTS?
What about passing in parameters directly to a DTS from the web page? I'm not finding much help on this portion
Any help and/or direction would be appreciated as I am on a tight deadline!
View 1 Replies
View Related
Feb 13, 2007
I have a SSIS Package that exports data from Sql Server to an Excel file.
I need help figuring out how to have the file name be "Report_02132007.xls". Basically I want to append the date to the file name.
Any ideas?
View 1 Replies
View Related
Aug 23, 2006
Hi,
I've seen a number of posts similar to this but i still cannot figure out what i need to do to get it working. So here goes with a couple of newbie questions.
Question 1:
Once created how do i go about executing a SSIS package. I want to be able to call it from a C# application from which i pass in a couple of parameters?
Question 2:
How do i go about setting the file path of my Excel source to a dynamic value passed at runtime. I want to be able to loop through a number of Excel files and do some processing on them. I've set up a variable (which i think i need to do) after that i get stuck however. Some other posts suggest configuration packages but i cannot get my head around how they work?
Any help on this matter would be gratefully recieved.
Thanks in advance,
Grant
View 5 Replies
View Related
Jan 23, 2008
Hello, I have a situation in which I need to use a foreach iterator that will perform a transformation on each excel file in a directory. The file names will change, but the structure will stay the same.
I was able to get this working by assigning the file path for each iteration to a variable, and then using that variable to set the excelfilepath in the Excel connection manager. However, for this to work I have to assign the variable to a default file.
Because of this, when I try to deploy the package I need to also add a configuration property for the variable, otherwise the first run will fail. The dummy file doesn't even really need to exist - I just have to put in a valid path, and then use any name that has an .xls extension. After that it runs fine regardless of what is in the directory.
This seems odd that I would need to do this - am I missing something? Apart from creating the Excel Connection Manager programatically (which I'm guessing might solve this), is there a way to avoid having to specify this dummy file?
Thanks
View 7 Replies
View Related
Feb 13, 2006
Hi
Some one Please guide me... How to create a Excel File Dynamically in DTS.
Once i run my DTS Package the result should be moved to a new Excel sheet( This should be created dynamically).
I tries in this way but it says....Syntax error at the DTS GlobalVariables.....
Function Main()
Dim appExcel
Dim newBook
Dim oSheet
dim oPackage
dim oConn
Set appExcel = CreateObject("Excel.Application")
Set newBook = appExcel.Workbooks.Add
Set oSheet = newBook.Worksheets(1)
oSheet.Range("A1").Value = "au_lname"
oSheet.Range("B1").Value = "au_fname"
oSheet.Range("C1").Value = "phone"
oSheet.Range("D1").Value = "address"
oSheet.Range("E1").Value = "city"
DTSGlobalVariables("fileName").Value = "C:\" & Month(Now) & "-" &
Day(Now) & "-" & Year(Now) & "-" & Hour(Time) & "-" &Minute(Time) & "-" &
Second(Time) & ".xls"
With newBook
.SaveAs DTSGlobalVariables("fileName").Value
.save
End With
appExcel.quit
set oPackage = DTSGlobalVariables.parent
set oConn = oPackage.connections(2)
oConn.datasource = DTSGlobalVariables("fileName").Value
set oPackage = nothing
set oConn = nothing
Main = DTSTaskExecResult_Success
End Function
View 2 Replies
View Related
Oct 20, 2004
Hi,
I have a created a DTS packges which is reading data from sql server table, manipulate this data as required and then create a text file with that data. I created the text file using FileSystemObject. I was writing one field at a time to the text file.
I need to same thing but instead of creating text file, I need to create a excel file with each column from database going to separate column in excel sheet. I tried to do this with FileSystemObject, but it was wrting all the columns from database to one cell in excel sheet. How can I fix this problem?
Thanks!
View 8 Replies
View Related
Nov 11, 2014
I have an excel file which has dynamic columns
i.e. Col1, Col2, Col3 this week. next week i will have a new Col4 in the sheet. This will keep on adding every week.
My problem is to Unpivot the data
Date 8/2/2013 8/9/2013 8/16/2013
Stock 1,561 1,661 1,761
i.e. the abobe table should become as
Date Stock
8/2/2013 1561
8/9/2013 1661
8/16/2013 1,761
How can I unpivot the dynamic columns given that the columns will keep on increasing every week.
View 1 Replies
View Related
Aug 25, 2007
Hi Craig/Kamal,
I got your email address from your web cast. I really enjoyed the web cast and found it to be
very informative.
Our company is planning to use SSIS (VS 2005 / SQL Server 2005). I have a quick question
regarding the product. I have looked for the information on the web, but was not able to find
relevant information.
We are getting Source data from two of our client in the form of Excel Sheet. These Excel sheets
Are generated using reporting services. On examining the excel sheet, I found out that the name
Of the columns contain data itself, so the names are not static such as Jan 2007 Sales, Feb 2007 Sales etc etc.
And even the number of columns are not static. It depends upon the range of date selected by the user.
I wanted to know, if there is a way to import Excel sheet using Integration Services by defining the position
Of column, instead of column name and I am not sure if there is a way for me to import excel with dynamic
Number of columns.
Your help in this respect is highly appreciated!
Thanks,
Hi Anthony, I am glad the Web cast was helpful.
Kamal and I have both moved on to other teams in MSFT and I am a little rusty in that area, though in general dynamic numbers of columns in any format is always tricky. I am just assuming its not feasible for you to try and get the source for SSIS a little closer to home, e.g. rather than using Excel output from Reporting Services, use the same/some form of the query/data source that RS is using.
I suggest you post a question on the SSIS forum on MSDN and you should get some good answers.
http://forums.microsoft.com/msdn/showforum.aspx?forumid=80&siteid=1
http://forums.microsoft.com/msdn/showforum.aspx?forumid=80&siteid=1
Thanks
Craig Guyer
SQL Server Reporting Services
View 12 Replies
View Related
Mar 13, 2008
Hi,
I am creating an SSIS package witha a Dataflow task, which reads from an Excel source and then uses script component to dumpt the data to multiple tables in Sql Server database
I need to some how make my Excel source dynamic, that is my excel template which i would be using to map the excel columns to script component's input columns would be dynamic..
In other words, I should be able to define the Excel Source, Column Mapping Information, Precedence constraint to the Script component dynamically
Please suggest how could i accomplish this
Regards,
Kalyan
View 8 Replies
View Related
Jul 20, 2006
I have the Excel Connection Manager and Source to read the contents from an Excel file. For some reason couple of numeric fields from the Excel worksheet are brought over as nulls even though they have a value of 300 and 150. I am not sure why this is happening. I looked into the format of the fields and they are set to General in Excel, I tried setting them to numeric and that did not help.
All the other content from the excel file is coming thru except for the 2 numeric fields.
I tried to bring the contents from the excel source to a text file in csv format and for some reason the 2 numeric fields came out as blank.
Any inputs on getting this addressed will be much appreciated.
Thanks,
Manisha
View 5 Replies
View Related
Jul 14, 2015
Is there anyway to send excel file from ssis using send mail task without saving the excel file locally. I need to automate the process which involves loading the excel file from the database and send it to some people.
View 6 Replies
View Related
Oct 29, 2007
Hello all,
I have the following situation.
Our customer would like to generate a raw data export report from specific customer databases.
I have an administrative database with a customer table. In this customer table each customer has it's on specific
customerId guid.
Each customer also has it's own customer database that is named: Customer_ + guid of the customer in the admin
database (eg: Customer_982240e79f424fb0a1d4bed16267245d).
This customer database has 1 main table (dbo.Data), but the design can be different depending on the customer.
Our customer would like to have the possibility to select specific fields from the table to export to an excel file.
So i never know in advance how much fields there will be in the table.
What i want to achieve is to generate a report where i can select a specific customer from a list (from the admin database). Then be able to view all the available fields inside the table (like a dataset or something) and then let the
customer select which fields he wants in his data export report.
Can this be achieved in RS2005?
Greetz
Vinnie
View 3 Replies
View Related
Jul 26, 2007
I have the following dataset using dynamic SQL which works when i execute it, when i try to create a table using this dataset i cant see any fields. Does anyone know why dynamic SQL doesnt work ?
Declare @TopRange int
Declare @BottomRange int
Declare @SQL Varchar(1000)
IF @Param_leadage = '91+'
SET @TopRange = 91
ELSE
Set @TopRange = RTRIM(LEFT(REPLACE(@Param_leadage,'-',''),2))
IF @Param_leadage = '91+'
SET @BottomRange = 4000
ELSE
Set @BottomRange = LTRIM(RIGHT(REPLACE(@Param_leadage,'-',''),2))
SET @SQL = 'SELECT dbo.tblCustomer.idStatus, dbo.tblCustomer.idCustomer, dbo.tblCustomer.DateSigned' +
' FROM dbo.tblCustomer' +
' WHERE DateDiff(day, dbo.tblCustomer.DateSigned, GetDate()) >= ' + convert(varchar,@TopRange) + ' AND DateDiff(day,dbo.tblCustomer.DateSigned, GetDate()) <= ' + convert(varchar,@BottomRange)
IF @Param_status = 'Online Churn'
SET @SQL = @SQL + ' AND dbo.tblCustomer.idStatus = 4 or dbo.tblCustomer.idStatus = 5 or dbo.tblCustomer.idStatus = 11'
ELSE
SET @SQL = @SQL + ' AND dbo.tblCustomer.idStatus = ' + @Param_idstatus
EXEC(@SQL)
View 6 Replies
View Related
Apr 22, 2007
Hello.
I wanted to know a way to create dynamic reports using reporting / analysis services in SQL Server 2005 / SSIS tool.
I want user to give inputs and generate reports based on those inputs.
Please guide me on this issue.
Thank you.
Regards,
Prathamesh
View 1 Replies
View Related
Jan 9, 2007
I can create static report with Report Server, but wanted if anyone can help me create a report that is dynamic and regenerates with new data as it comes in.
Thanks so much!
View 1 Replies
View Related
Oct 11, 2007
I have a procedure that creates a large dynamic view of several tables. The view is a union view of up to 15 tables. The table names are all <name>_DDMM where name is the standard table name and ddmm is the day and month of the tables data. The tables are created by a software supplied by another company, so I can not ensure that the tables will always have exactly the same fields or number of fields. Sometimes the company will add more fields to the tables in thier updates. So, I have to include the field names in the SQL exec command to create the query. This makes for a very long exec command and depending on the number of tables it needs to include, it can require upwards of a 16,000 character string. Obviously, this can't work, so I had to break up the variable in order to create the procedure. However, I'm wondering if there isn't a better method than creating three different 8000 varchar variables and having overflow write to the next variable in line. Especially if the number of tables needs to be expanded, it could be a problem. Is there a better way to run a create view exec command on a large number of characters?
EDIT: Changed the title to read Procedurally generating a large view.
View 14 Replies
View Related
May 28, 2014
I am trying to use a first_name , Last_name and append this as username something like mike test and create username like 'Mtest@123'. and password as well.
The first_name, last_name comes from a table called "person".
Right now the user name and password is hard coded and I need to make this dynamically generated, is that possible within SQL?
How can I do this within SP? Below is my sp:
Alter PROCEDURE PatientEnroll (@person_id AS uniqueidentifier)
AS
BEGIN
SET NOCOUNT ON
INSERT INTO dbo.ngweb_bulk_enrollments(row_id, person_id,practice_id,
[Code] ....
View 2 Replies
View Related
Jul 25, 2015
Trying to upload excel in server where excel is not installed. BIDs was there in the server, when i am trying to craete Excel source I am not able.what the workround for this.. How to upload excel without excel installed on the server.
View 4 Replies
View Related
Nov 19, 2007
I am using a Excel Source to get the data from an excel file to sql server 2005 table. A couple columns are coming in a double precision float, but some values have characters in them, but those values are coming out as null, even though I changed the datatype from float to unicode string. Any inputs on resolving this will be much appreciated.
Thanks,
Manisha
View 4 Replies
View Related
Sep 13, 2015
We have 10 sheets in Excel File and 10 sheet contains errror data. How to load 9 sheets data in to 1 destination and error data in to other destination?
View 4 Replies
View Related
Dec 18, 2006
i have an SSIS package that exports to an excel file. This works fine. the problem is that it appends the data instead of overwriting the file. Is there any way to overwrite the file like you can with a flat file? I have to email the file everyweek and don't want to have to clear it out manually. Any help would be appreciated
View 2 Replies
View Related
May 17, 2004
Hi
I have developed an application in ASP/SQL server 7.
Ths system is single user. One of the tables is updated by usr actions( say Table A).
To make it multi user. I want to create table such as A_Username.
How can query be written for this. Also there are many stored procedures which will access this table. In these stored procedures i will send username as an input. Then the query in the stored procedure shd access the table as A_Username .
Such dynamic table name refrencing , how can it be done.. Is creating a string for the query and then executing it using sp_exec the only option?
pls suggest
View 6 Replies
View Related
Jul 20, 2007
Do you guys have any good links or suggestions relative to this?
View 1 Replies
View Related
Mar 26, 2008
Hi there,
I have one table which holds all the information for the forms and i have another table which holds list of all the form fields. Now these two tables are mapped and that table give me list of all the fields in any forms.
To get the information about the users who filled different forms first i need to query the tblFormsToFormFields and get the list of all the fields for that form and then use that fields list in the select query to get the result.
In my report i need to provide the drop down with the list of all the forms and then display the information for all the customers for that particular form with the list of the form fields.
Is there in SSRS 2005 i can use C# or any programming language to create Columns in the report dynamically as there will be different fields for each form.
Please advice.
Thanks
Danny
View 7 Replies
View Related
Jan 29, 2004
Hello everybody .
I am building DTS transfer data from
SQL server into Excel file
source query constant ,but destination will be supplied by parameter
At design time I created destination
excel file and saved a copy of it like
C: empl_excel.xls
presently dts work in following order
1. set datasource of destination
from global varaibale(@@X)
2. execute xp_cmdshell to copy
C: empl_execel.xls to file in @@X
3.Run transformation
How to eliminate step 2 ?
If I run step 1 and 3 ,I get error "table does not exist"
How dynamicly create table in excel and map columns for transfer
Thank you
alex
View 3 Replies
View Related
Feb 13, 2006
Please help....
I have different files that are sent from our vendors. Some are TXT and some are XLS. Some will have the same structure. I plan on grouping these together as best as I can.
My main problem is that I would like to go from one source that matches a group of files to a single SQL table. I'm still learning about SSIS and its capabilities. If I can get pointed in the right direction or have an example to work from, that would be great.
I've tried googl'ing to find some step by step, examples, and hints to do this right, but so far I'm at a bit of an impasse.
Thanks,
Dave
View 4 Replies
View Related
Jul 2, 2014
I am having trouble figuring out why the following code throws an error:
declare
@cols nvarchar(50),
@stmt nvarchar(max)
select @cols = ('[' + W.FKStoreID + ']') from (select distinct FKStoreID from VW_PC_T) as W
select @stmt = '
select *
[Code] ...
The issue that I am having is:
Msg 245, Level 16, State 1, Line 4
Conversion failed when converting the varchar value '[' to data type int.
I know that I have to use the [ ] in order to run the dynamic sql. I am not sure what is failing and why as the syntax seems to be clean to me (obviously it is not).
View 6 Replies
View Related
May 13, 2015
I have a question regarding the dynamic sql. I have a script which which deletes all the foreign keys and re- creates it. So, I have created a table instead of a temp table. Now I need to create that foreign keys table in such a way that in which ever database I run the script, this foreign keys table should be created in that particular database.
For example:
IF OBJECT_ID('tempdb..keys','U') IS NOT NULL
DROP TABLE keys
CREATE TABLE keys.[@sourceserver],[@database]. (RowId INT PRIMARY KEY IDENTITY(1, 1),
ForeignKeyConstraintName NVARCHAR(200),
ForeignKeyConstraintTableSchema NVARCHAR(200),
ForeignKeyConstraintTableName NVARCHAR(200),
ForeignKeyConstraintColumnName NVARCHAR(200)
View 2 Replies
View Related
Jul 24, 2015
Need to know how I can get the dynamic filename created in the FlatFile destination for insert into a package audit table?
Scenario: Have created a package that successfully outputs Dynamiclly named flat files { Format: C:Test’Comms_File_’ + ‘User::FileNumber’+’_’+Date +’.txt’
E.g.: Comms_File_1_20150724.txt, Comms_File_2_20150724.txt etc} using Foreach Loop Container :
* Enumerator Set to: “Foreach ADO Enumerator” with the ADO object source variable selected to identify how many total loop iterations there are i.e. Let’s say 4 thus 4 files to be created
*Variable Mappings : added the User::FileNumber – indicates which file number current loop iteration is i.e. 1,2,3,4
For the DataFlow task have a OLDBSource and a FlatFile Destination where Flat File ConnectionString is set up as:
@[User::Output_Path] + "Comms_File"+ @[User:: FileNumber] +"_" + replace((DT_WSTR, 10) (DT_DBDATE) GETDATE(),"-","")+ ".txt"
All this successfully creates these 4 files:
Comms_File_1_20150724.txt, Comms_File_2_20150724.txt, Comms_File_3_20150724.txt, Comms_File_4_20150724.txt
Now the QUESTION is how do I get these filenames as I need to insert them into a DB Audittable. The audit table looks like this:
CREATE TABLE dbo.MMMAudit
(
AuditID INT IDENTITY(1, 1) NOT NULL,
PackageName VARCHAR(100) NULL,
FileName VARCHAR(100) NULL,
LoadTime DATETIME NULL,
NumberofRecords INT NULL
)
To save the Filename & how many records in each file in our Audit Table, am using an Execute SQL Task and configuring it as this:
Execute SQL Task
Parameter mapping - Mapped the User Variable (RecordsInserted) and System Variable( PackageName) to Insert statement as shown below
SQLStatement: INSERT INTO [dbo].[MMMAudit] (
PackageName,NumerofRecords,LoadTime)
(?,?.GETDATE)
Again this all works terrific & populates the dbo.MMMAudit table as shown below BUT I also need to insert the respsctive file name – How do I do that?
AuditID PackageName FileName NumberOfRecords
1 MMM NULL 12
2 MMM NULL 23
3 MMM NULL 14
4 MMM NULL 1
View 2 Replies
View Related
Oct 9, 2006
I am having an issue with the File System Task.
I was wondering if there is a way to 'Move File' with the File System Task inside of a For Each Loop container but to dynamically set the Destination path variable.
Currently, this is what I have:
FileDestinationPath variable - set to C:TestFiles
FileSourcePath variable - set to C:TestFiles
FileNameAndLocation variable - set to blank
For Each Loop Container Iterates through a folder C:TestFiles that has .txt files in it with dates in the file name. Ex: Test_09142006.txt. Sets the file path (fully qualified) to the Variable Mapping FileNameAndLocation.
Script Task (within For Each Loop, first step) Sets the FileDestinationPath to the correct dated folder within C:TestFiles. For example, if the text files I want to move are for the 14th of September, it takes FileDestinationPath and appends the date folder to the end of it. The text files have a date in the file name (test_09142006.txt) and I am picking this apart (from FileNameAndLocation in the For Each Loop) to get the folder date. (dts.Variables(User::FileDestinationPath?).Value = dts.Variables(User::FileDestinationPath?).Value & ? Month & _? & Day & _? & Year & ?) which gives me C:TestFiles 9_14_2006?.
File System Task (within For Each Loop, second step) This is where the action is supposed to occur. I want it to take the FileDestinationPath and move the FileNameAndLocation file (from the For Loop) into this folder for each run.
Now as for my problem. I want this package to run everyday but it has to set the FileDestinationPath variable dynamically according to that days date. Basically, how do I get this to work since I cant hard code the destination path variable from the start? I have the DestinationVariable on the File System Task set to the FileDestinationPath variable, after the script task builds it. However, using FileNameAndLocation as the SourceVariable on my File System Task tells me that the Variable FileNameAndLocation? is used as a source or destination and is empty.?
Let me know if I need to clarify further...I may be missing something very simple. Any help would be greatly appreciated!
View 10 Replies
View Related
Feb 26, 2008
Hi All, i've been reading this article http://rafael-salas.blogspot.com/2006/12/import-header-line-tables-_116683388696570741.html
in regards to creating an excel spreadsheet dynamically in SQL Server 2005 SSIS. However, i'm constantly getting an where the tab is created but not being populated. Can somebody post up a clearer example?
The problem I'm trying to solve is to automate the export of a query onto a new dynamic spreadsheet each time I run this SSIS package.
Any help would be greatly appreciated.
Thank you.
View 3 Replies
View Related