Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2005 Forums
 SSIS and Import/Export (2005)
 Regarding destination db table!

Author  Topic 

bondwiththebest
Starting Member

46 Posts

Posted - 2008-09-23 : 20:42:57
Hi,

I two flat file sources and I have to merge the data and insert into a sql database. When I try to insert it will insert like shown belown:

1 null 41.6 null
2 20.5 null null
3 null null 8/8/2008

But i really like to have as a single row like this.

1 20.5 41.6 8/8/2008


Can you please help me??

I tried to merge/sort the datasets but none of it helps. I am not sure if i use a sql command in the destination, how to do that??? can you please give me an example???

thank you


sodeep
Master Smack Fu Yak Hacker

7174 Posts

Posted - 2008-09-23 : 21:21:33
One way is to load flat files into Staging table and manipulate and insert into Destination table.
Go to Top of Page

bondwiththebest
Starting Member

46 Posts

Posted - 2008-09-23 : 22:07:04
hey sodeep,

thanks for the reply, i am pretty new to SSIS , can you give me an example how we can use the staging table means??? Is it done with help of scripting ???
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2008-09-24 : 01:56:35
quote:
Originally posted by bondwiththebest

hey sodeep,

thanks for the reply, i am pretty new to SSIS , can you give me an example how we can use the staging table means??? Is it done with help of scripting ???


what is relationship on which you want merge data from two files?Have you tried using merge join task in data flow?
Go to Top of Page

bondwiththebest
Starting Member

46 Posts

Posted - 2008-09-24 : 12:45:10
There is no relationship between the two files. I get the date from first file and the remaining data from the second file.

Then i need to insert into a sql database as a single row!! can anyone give me an example of how to use a staging table?
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2008-09-24 : 13:05:55
quote:
Originally posted by bondwiththebest

There is no relationship between the two files. I get the date from first file and the remaining data from the second file.

Then i need to insert into a sql database as a single row!! can anyone give me an example of how to use a staging table?


then how will you decide which date goes with which data rows?
Go to Top of Page

bondwiththebest
Starting Member

46 Posts

Posted - 2008-09-24 : 20:41:07
I have a set of 10 files for each Item and the date comes from first file and the data should come from last file. So i used two flat file sources and tried to insert the data. But i really like to have the data as shown in first post.
Go to Top of Page

sky2aone
Starting Member

5 Posts

Posted - 2008-09-24 : 22:02:06
u need to compare with date and extract current day and month and find that row from file..u can do by conditional split it it is case of daily picking up file as date=today()
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2008-09-25 : 01:41:02
quote:
Originally posted by bondwiththebest

I have a set of 10 files for each Item and the date comes from first file and the data should come from last file. So i used two flat file sources and tried to insert the data. But i really like to have the data as shown in first post.


still how will you determine which data corresponds to which date? any columns by which two files relate?
Go to Top of Page

bondwiththebest
Starting Member

46 Posts

Posted - 2008-09-29 : 22:11:46
Hi everyone,

Thanks for all the previous post, I was able to get going with that files. I need some more help.

I have a linked tables in the destination database and I was able to insert the first table using script, but I am not sure how i can use the script to insert into second table (the first and second tables are linked!). Can you give me some example using script??
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2008-09-29 : 23:48:16
quote:
Originally posted by bondwiththebest

Hi everyone,

Thanks for all the previous post, I was able to get going with that files. I need some more help.

I have a linked tables in the destination database and I was able to insert the first table using script, but I am not sure how i can use the script to insert into second table (the first and second tables are linked!). Can you give me some example using script??


can you illustrate scenario with some sample data?
Go to Top of Page
   

- Advertisement -