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)
 excel to SQL server 2005

Author  Topic 

ronedin
Starting Member

29 Posts

Posted - 2007-10-15 : 22:54:16
Hi friends,

I am facing a problem. I have a excel sheet with a 'single cell' displayed like this :

List of Employees FirstName
Arranged StateWise
California
97 Kathy
101 Jack
102 Suzanne
Texas
103 Gonzalles
104 Ricardo
111 Kate
Virginia
125 Jim
126 Rocky

and so on..where California is the state, 97 is empid and Kathy is empname

This has to be populate in a table

Employee
Empid
EmpFName
Stateid

State
StateId
StateName

So during populating, we need to compare "California" against the statename field of State and pick up id and then populate the Employee table in sql server 2005

EXPECTED Output

97 Kathy 01
101 Jack 01
102 Suzanne 01
103 Gonazalles 02
104 Ricardo 02
105 Kate 02


and so on....

I have populated the excel cell into a staging table containing nvarchar(100)..but what to do after that?

thanks

igorblackbelt
Constraint Violating Yak Guru

407 Posts

Posted - 2007-10-16 : 14:12:53
Haven't done anything like this before, but I would either have to write my own script do what I want or look into something like the link below.

(I believe I saw Kristen posting something similar somewhere that I can't think of right now.)

http://www.datadefractor.com/Home/AboutDataDefractorSSIS/tabid/73/Default.aspx
Go to Top of Page

Kristen
Test

22859 Posts

Posted - 2007-10-16 : 14:56:29
Is this a continuation of the problem you described here:

http://www.sqlteam.com/forums/topic.asp?TOPIC_ID=91047

??

Kristen
Go to Top of Page

ronedin
Starting Member

29 Posts

Posted - 2007-10-18 : 00:19:09
Hi,

I first thought of doing it using SSIS, but later wanted a quick approach through sql. Thanks for helping me over there.
Go to Top of Page
   

- Advertisement -