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 Table loading

Author  Topic 

learntsql

524 Posts

Posted - 2010-06-08 : 06:50:05
--I have the following data in Excel sheet and to be loaded into SQL Server table
--Sampledata:
declare @salesdata table (Policytype varchar(50),Branch varchar(50),Date1 int,date2 int,date3 int)
insert into @salesdata
select 'P1','Branch1',10000,20000,30000
union all
select 'P2','Branch2',12000,40000,35000
union all
select 'P3','Branch3',13000,29000,60000
union all
select 'P4','Branch4',16000,23000,40000
union all
select 'P5','Branch5',11000,21000,20000

--Here Date1,Date2,Date3 are the datevalyes for Eg.MM-DD-YYYY format as column names
--
--I have to load this data into destination table with the following structure
declare @Output table (Policytype varchar(50),Branch varchar(50),Date datetime,SaleValue int)
insert into @Output
select 'P1','Branch1','06-08-2010',10000
union all
select 'P1','Branch1','06-09-2010',20000
union all
select 'P1','Branch1','06-10-2010',30000
union all
select 'P2','Branch2','06-08-2010',12000
union all
select 'P2','Branch2','06-09-2010',40000
union all
select 'P2','Branch2','06-10-2010',35000

select * from @Output

Please guide me.
TIA.

learntsql

524 Posts

Posted - 2010-06-09 : 00:10:37
Hi All,
Any Ideas please.....
Go to Top of Page
   

- Advertisement -