Import A Dynamic File Name Into A Known Table

Sep 26, 2006

How would I import a dynamic file name into a known table?
I have the file name in a variable. So what object in SSIS do I use to do this.
 
Thanks

View 2 Replies


ADVERTISEMENT

BCP Task And Dynamic Import And Export Of A File Via Package Variables

Jul 3, 2006

I have a requirement to create many SSIS packages and no datatransform is required so the BCP task looks a good contender providing it can do both import & export

is it possible to parse the values in bold as package variables into the BCP task. If so how?

BULK INSERT ipcs_wvg.dbo.extract
FROM 'D:IPCSextract.csv'
WITH (FORMATFILE = 'D:ipcsqueryextract.xml');

Thanks in advance

Dave

I have a global database called ETL Configuration for all my SSIS packages that uses a single table. So I can create three global variables

USE [ETLConfiguration]
CREATE TABLE [dbo].[SSIS Configurations](
[ConfigurationFilter] [nvarchar](255) COLLATE Latin1_General_CI_AS NOT NULL,
[ConfiguredValue] [nvarchar](255) COLLATE Latin1_General_CI_AS NULL,
[PackagePath] [nvarchar](255) COLLATE Latin1_General_CI_AS NOT NULL,
[ConfiguredValueType] [nvarchar](20) COLLATE Latin1_General_CI_AS NOT NULL
) ON [PRIMARY]

Here is the data I would put in here

ConfigurationFilter = 'MySSISPackageName'

ConfiguredValue = 'D:IPCSextract.csv'

PackagePath = 'Package.Variables[User::gsFileName].Properties[Value]'

ConfiguredValueType = 'String'



ConfigurationFilter = 'MySSISPackageName'

ConfiguredValue = 'D:ipcsqueryextract.xml'

PackagePath = 'Package.Variables[User::gsFormatFile].Properties[Value]'

ConfiguredValueType = 'String'

ConfigurationFilter = 'MySSISPackageName'

ConfiguredValue = 'ipcs_wvg.dbo.extract'

PackagePath = 'Package.Variables[User::gsTableName].Properties[Value]'

ConfiguredValueType = 'String'



--Database connection info

ConfigurationFilter = 'MySSISPackageName'

ConfiguredValue = '.mssql2005'

PackagePath = 'Package.Connections[MyDatabaseName].Properties[ServerName]'

ConfiguredValueType = 'String'



ConfigurationFilter = 'MySSISPackageName'

ConfiguredValue = 'MyDatabaseName'

PackagePath = 'Package.Connections[MyDatabaseName].Properties[InitialCatalog]'

ConfiguredValueType = 'String'



I have looked at lots of options to automaticly create SSIS packages and have a hunch that that simple can be better: All these solutions look way to complex to what I want to achieve--

http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=17484&SiteID=1

http://lakshmik.blogspot.com/2005/05/how-to-programmatically-create-ssis.html

Create DataFlow Package Sample
http://msdn2.microsoft.com/en-us/library/ms161541.aspx

SMOTableList Sample
http://msdn2.microsoft.com/en-us/library/ms161564.aspx

View 4 Replies View Related

SQL 2012 :: Creating Dynamic SSIS File Format - Dynamic CSV File As Output

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

Storing A Dynamic File Name Table

Apr 17, 2014

I have a file that is automatically generated by an external process that will always have the same name + a date stamp.I will say test_(Datestamp).txt

what i am trying to do is use sql to bulk insert this file but i will not know the full file name as the date stamp is also includes time. What my script is doing is taking this file everyday storing its contents temporarily in a table where i then use a trigger to edit and repopulate the table and kick out a new file that another external process uses.

View 4 Replies View Related

Import Txt File Into Sql Table Using Vb.net

May 3, 2007

hi!
my problem both concerns vb and sql. the problem is I have a text file delimited with semicolon. I have to enter this data into Sql table.
for example;
item description  ;code1;code2;code3;
there are too many lines like this. The code should enter the table these values.Table name is products, column names are desc,code1,code2,code3
I am using vb.net and sql server
thanks all!
 

View 13 Replies View Related

How To Import CSV File In To SQL Table

Apr 7, 2004

Any body know How to Import CSV file in to SQL table using asp.net

View 13 Replies View Related

Import Table To Csv File

May 28, 2008

hi
can any help
i have import table to csv file to append , replace, delete condition

View 5 Replies View Related

Import Csv File To Table

Nov 7, 2007

Hi.I would like to import the pprice.csv to table test3 on test database.
I've run this query:

BULK INSERT test..test3 FROM 'c:pprice.csv'
WITH (
FIRSTROW = 2,
MAXERRORS = 0,
FIELDTERMINATOR = ',',
ROWTERMINATOR = ' '
)


It has no error.but 0 rows effected.it means doesnt work correct.
what should I do?
thanks.
Amen

View 5 Replies View Related

How To Import Csv File Into A Table

Mar 18, 2008

hi,
i have a project requirement that i need to import csv file data into a table.
Please help me out?




Raghu sunkara.

View 3 Replies View Related

SQL 2012 :: Import XML File In Table

Jan 23, 2015

I want to import an XML file in an Table. The XML file is on an Other Network location than the Database server I’m connected to and I have access to this location with my windows Credential.

I connect from my local PC to the Database server “RS1” with my Windows Credentials.

There I run this script

CREATE TABLE XMLwithOpenXML
(
Id INT IDENTITY PRIMARY KEY,
XMLData XML,
LoadedDateTime DATETIME
)
INSERT INTO XMLwithOpenXML(XMLData, LoadedDateTime)
SELECT CONVERT(XML, BulkColumn) AS BulkColumn, GETDATE()
FROM OPENROWSET(BULK '<Networkname><MAP>Name_.xml', SINGLE_BLOB) AS x;

I Get the error:

Msg 4861, Level 16, State 1, Line 10
Cannot bulk load because the file "<Networkname><MAP>Name_.xml'" could not be opened. Operating system error code 5(Access is denied.).

(<Networkname><MAP>Name_.xml' is not the real name )

So it looks like the openrowset connects to the network location with other credentials.

Where I can find (and change) the credentials which is used to connect to the network location?

I found this article on MSDN (Security Considerations) but cannot find solution [URL] .....

View 1 Replies View Related

To Import CSV File Into Database Table

Jun 3, 2008

Hai all.,
Im trying to import the CSV file values using bulk insert but im getting an error in my code .so can anyone help me on this.
the following is the coding i have created
--create table
CREATE TABLE CSVTest
(ID INT,
FirstName VARCHAR(40),
LastName VARCHAR(40),
BirthDate SMALLDATETIME
)
--import from CSV using bulk insert

BULK
INSERT CSVTest
FROM 'c:csvtest.txt'
WITH
(
FIELDTERMINATOR = ',',
ROWTERMINATOR = ''
)
GO

im gettin an error like
Msg 4860, Level 16, State 1, Line 1
Cannot bulk load. The file "c:csvtest.txt" does not exist

The thing is i have created a CSV file in C drive with some values.

Thanks in advance

View 6 Replies View Related

Import Excel File Into Table Via T-SQL?

Jun 6, 2008

Hi folks. I am having an excel file. I need to import this file to database and update some other tables with data contained in this file. I would like to automate this process as much as possible.
Now, I am just using SQL Server Import Wizard to create a table and then I am running an update query. Is there any (more automate) way to do this?

Thanks for your time.

View 3 Replies View Related

How Import XML File In A Table With Trigger.

May 10, 2007

Hello,I'm trying to import a Xml file in a table.It's working find, but when the data are inserted, my trigger on thistable doesn't work ?I put my code below.Best regardsThank'sDavidXml file :<?xml version="1.0" encoding="ISO-8859-1" standalone="yes"?><RTAVIS><FILENAME>03-05-073.PDF</FILENAME><idvir>1030</idvir><code>9219142</code><mnt>4337,88 </mnt></RTAVIS>Xsd file :<?xml version="1.0" ?><Schema xmlns="urn:schemas-microsoft-com:xml-data"xmlns:dt="urn:schemas-microsoft-com:xml:datatypes"xmlns:sql="urn:schemas-microsoft-com:xml-sql" ><ElementType name="FILENAME" dt:type="string" /><ElementType name="idvir" dt:type="string" /><ElementType name="code" dt:type="string" /><ElementType name="mnt" dt:type="string" /><ElementType name="RTAVIS" sql:relation="ac_export_and_path"><element type="FILENAME" sql:field="path" /><element type="idvir" sql:field="numero_virement" /><element type="code" sql:field="code_affilie" /><element type="mnt" sql:field="montant_remise" /></ElementType></Schema>Vbs file:Set objBL = CreateObject("SQLXMLBulkLoad.SQLXMLBulkLoad")objBL.ConnectionString = "provider=SQLOLEDB.1;datasource=*****;database=*****;uid=*****;pwd=*****"objBL.ErrorLogFile = "C:Temperror.xml"objBL.SchemaGen = TrueobjBL.CheckConstraints = TrueobjBL.KeepIdentity = FalseobjBL.BulkLoad = trueobjBL.Execute "C:Temp9219142_MAPPING.xsd", "C:Temp9219142.xml"Set objBL = NothingTrigger source code :CREATE TRIGGER [dbo].[trg_ac_export_and_path] ONdbo.ac_export_and_pathFOR INSERTASDECLARE @id AS varchar(50)SELECT @id = 'A'+convert(varchar, [id]) FROM insertedINSERT INTO ac_path([id], [path]) SELECT @id, path FROM insertedEND

View 4 Replies View Related

How To Create Table On Text File Import?

Sep 27, 2007

Hey guys,
I have a dilemma and hope someone can help.

I don't know of any utilities or commands in SQL that do this but I hope someone does.

What I need to do is something like a bcp import a text file in. I can do that with DTS as well. But what I wanted to do is create a table on the import. So lets say, I am importing a tab-delimited file with column names as the first row that is called ax.txt. On import, it would create the table ax with the column names in the file and then import the data into that table.

I hope I explained it clearly. Please let me know if there is anything I can use to do this without writing lots of code.

I have an idea how to do it the long way but hope there is a utility that already does it.

Thanks in advance.

View 10 Replies View Related

Import A CSV Delimited Text File Into A Table

Jan 18, 2007

Hi,

Could you help me to write a script to import a CSV delimited text file into a sql server table.?

Thanks,



carlos

View 2 Replies View Related

Import A Text File To A SQL Table Question

Feb 6, 2008

Greetings all!

I am a relative newbie to SQL but I've written many queries for vb.net/.net code...I'm not an absolute beginner.

I'd like to import a text file into a sql database so that I can use SQL Reporting Services to report on the data. Here is a sample of the first 8 textfile records. All of the 6 potential database fields are separated by a comma and no spaces:

1,12/4/06 4:12:11 PM,67.13,70.50,71.56,8.23
2,12/4/06 4:17:11 PM,67.13,70.50,71.56,8.33
3,12/4/06 4:22:11 PM,67.19,70.69,71.69,8.19
4,12/4/06 4:27:11 PM,67.19,70.63,71.69,8.18
5,12/4/06 4:32:11 PM,67.19,70.69,71.75,8.05
6,12/4/06 4:37:11 PM,67.19,70.69,71.69,8.03
7,12/4/06 4:42:11 PM,67.19,70.63,71.69,8.05
8,12/4/06 4:47:11 PM,67.19,70.63,71.63,8.02

The description for field datatypes of the first record above is:

1 (this is an autonumber, should be a number for ordering)
12/4/06 4:12:11 PM (date and time, can be converted to text if necessay)
67.13 (number, 2 decimal spaces)
70.50 (number, 2 decimal spaces)
71.56 (number, 2 decimal spaces)
8.23 (number, 2 decimal spaces)

The textfile is big, 97K records. I have SQL 2005 installed on my PC.

Can anyone out there please help me with the import or SQL statement to create a SQL table from this? Any help would be greatly appreciated!

Thanks and have a great day - gad1



View 5 Replies View Related

Integration Services :: How To Load Data From CSV File To Dynamic Table

Jun 11, 2015

I have a requirement to load bulk of csv files to sql table. some times, some columns could not come in csv file(some times 100 columns and some times 80 cloumns). That time the package is getting failed. How to create a table dynamically based on csv file structure.

View 8 Replies View Related

Import Text File To Sql Table In Sql Server 2005

Mar 7, 2008

hi guys
i need  to import text file to sql table in sql server 2005 ...using query how do i import text file to sql table .......................
 i need query
i dont want go Import/export options

View 1 Replies View Related

Looking For SQL To Import Asii File Data Into Vendors Table

Sep 16, 2005

I have tried  my file name vendor_insertFromFile2.sqlBULK INSERT  (dbo.vendors VendorName, Street, City, Region, Country, PostalCode, Telephone, PortalId, Fax, Email, Website, CreatedDate, Unit, LastName, Cell) from 'D:AccessNAICSxPortal0_SampleData.txt'error messageServer: Msg 170, Level 15, State 1, Line 2Line 2: Incorrect syntax near '('.Data in the "CompanyName","Address","City","State","country","fullzip","FullPhone","Portal","Fullfax","Email","URL","date","ID","Contact_1","800No""DAVID STRAWN","460 FLOWERING TRL","GRAYSON","GA","United States","30017?,"770-277-8709",0,"“,"bkroom@bellsouth.net","WWW.BACKROOM4MEN.COM","09/02/05",1,"DAVID STRAWN","BRADRUSS","3353 S MAIN ST STE 130","SALT LAKE CITY","UT","United States","84115?,"801-975-0374",0,"“,"rusbrad@msn.com","WWW.BADANDNASTY.COM","09/02/05",2,"BRAD JENSEN",Thanks in advance on what is wrong or a link with working examples

View 2 Replies View Related

How Can I Export/import Data On Table To/from Text File

Dec 24, 1998

I needs export data on table to text file so I can process this data
with another database engine ie. Informix.

Can anybody help me to solve this problem ?

View 2 Replies View Related

Stored Procedure - Import CSV File Into Table In Excel

Mar 3, 2014

I have the following code to import .csv file into my table in excel. It's being inserted into a table. dbo.ImportedPromoPricing. Table and the .csv file have 3 fields price, code and selling price.

Once import is completed I want to use the data in my dbo.ImportedPromoPricing to update another table dbo.MasterPricing. Records need to be compared and updated or appended if needed. in case of update only price will be updated. this is the beginning of my code

USE [Reporting]
GO
/****** Object: StoredProcedure [dbo].[ImportPromoPricing] Script Date: 03/03/2014 14:04:01 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON

[Code] .....

View 2 Replies View Related

SQL 2012 :: Import Txt Data File Into Temp Table?

Sep 30, 2014

In Access, I can import a txt file data(e.g. Claims.txt) as below specifications:

Choose the delimiter that separates your fields: Other (|)
First row contains field name: Yes
Text Qualifier:"

I need to create a store procedure to read txt file data (d:cliamcliams.txt) first column (ClaimNumber) into a temp table (#claim)

(This #claim table will use for my .Net program)

There about 5 txt files need to process every day.

View 1 Replies View Related

How To Import Data Using Bcp Without A Format File Or Table Layout

Mar 20, 2008

I have several bcp output files I need to import into tables. I do not have format files for them. As far as I know they are in native format. I do not know the layout of the destination table they would populate.

1) how can I determine from the bcp file itself the schema of the destination table? Once I know that I should be able to import the data into the table.

Thanks

View 6 Replies View Related

How To Import Text File Using The Exising Table Schema

May 28, 2008

Hello;

I have table schema and text data file. After create the table, and then import the text data file. However, the text file always overwrite the table schema.

How could I using existing table schema to import the text file?

Thanks,

View 10 Replies View Related

Import Data From Text File Into A Temp Table In Stored Proc

Oct 1, 2001

Hey,
can one of you please show me how to import data from a text file into a temp table in a stored proc.
thanks
Zoey

View 1 Replies View Related

How Do I Import A Varying Column Width Flat File Into A Table Using SSIS?

Apr 24, 2008

How do i import a Varying Column Width Flat file into a Table using SSIS?


I have a flat file that has 4 columns with varying width
Like I should read the file as
Col 1 - (1 to 10 Characters)
Col 2 - (12 to 21 Characters)
Col 3 - (22 to 35 Characters)
Col 4 - (36 to 38 Characters)
At the end of the record is a "LF"


I think "Fixed Width" Columns allow me to define a standard column length for all the columns.. Right?

Any thoughts on how to?

View 9 Replies View Related

Integration Services :: How To Import Filenames And File Creation Date Into Table

Apr 20, 2015

I am importing Differennt Excels Files into table. my require ment is after importing completed I need to insert all these Filenames ,File creation date into table. (for Auditing).

View 9 Replies View Related

Integration Services :: SSIS - Import Date From File CSV Into Table If It Doesn't Exist

May 6, 2015

I created a simple SSIS package that takes a Flat File Source (CSV file) and Imports it into a OLE DB Destination ([TestCSVImport].dbo.Table1). I have other CSV files I'd like to import, but I don't want to import entries where column "ordereID" (PK) are the equal. Just want to import the new data found in the CSV files. I tried adding a Lookup in-between the Flat File Source and the OLE DB Destination, but I'm not sure how to accomplish only importing new data.

View 2 Replies View Related

SQL Server 2008 :: Bulk Import And Create New Table Based On Header Fields Of Imported File (XLXS)

Sep 11, 2015

I have a record in an Excel format (Excel 2010) and I would like to bulk import that into SQL Server 2008 and also while importing, SQL Server will automatically create a new table based on the header fields or row of the source file.

I am not sure if SQL Server 2008 has this capabilities.

View 0 Replies View Related

Error Regarding File Import Through Import Wizard

Jan 12, 2006

Hi all,

when trying to ímport files to our database server from a client, I keep getting an error:

- Validating (Error)
Messages
Error 0xc00470fe: Data Flow Task: The product level is insufficient for component "Source_txt" (1).
 (SQL Server Import and Export Wizard)
 
Error 0xc00470fe: Data Flow Task: The product level is insufficient for component "Data Conversion 1" (175).
 (SQL Server Import and Export Wizard)

... doing the same import when logged on the server, hasn't been giving me any errors, how come. I can from my client without trouble import tables from other DB servers but when ever it is files it won't do it.

 

I tried as mentioned in other threads rerun setup to re-install SSIS, but as it was already installed it wouldn't re-install. My next move would be to make a clean install, but not sure it would help, as I think this is a buck.

best regards

 

Musa Rusid

View 1 Replies View Related

Dynamic Import From Excell

Sep 14, 2005

hello All,
Am not sure if this is the right forum to post this. But here goes

I have a phone book, which users could enter numbers via a web interface and a SP.

However i was wondering how to generate a bulk insert script, that would

Import from an uploaded excell workbook to MS SQL
How could this be done

NOTE: Am doing an upload via an ASP page, then hoping that either the ASP page, via a SP or an SQL command Statement do a bulk copy for the user who uploaded it to my SQL table

difficult ???

Thanks Anyway
Afrika

View 5 Replies View Related

Dynamic Data Import

Oct 15, 2007

I've finally made some great headway on my import package and am close to the end. I am trying to do the following:

1. Automatically FTP down CSV files.
2. Loop through the directory and get the latest CSV file (filename has date in it)
3. Do a data conversion and insert - Flat file source to Ole DB destination

In my development I was able to get all this to work, but only when I explicitly set the flat file source. When I set an expression for the connection string, I get a "external metadata column collection is out of synch" error. Is there any way to preserve the column mappings when using a dynamic flat file connection?

Thanks.

View 3 Replies View Related

Help With Dynamic Import Of Data Into Excel.

Apr 3, 2008

I set up a external data connection to a reporting services report via excel but because my report is paginated it will only retrieve data for the first page. Is there a way to make the report render on 1 page only?

or is there an easier way to do what i'm trying to do?

View 1 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved