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 2008 Forums
 Transact-SQL (2008)
 Importing selected rows and columns into database

Author  Topic 

simratpannu
Starting Member

1 Post

Posted - 2010-07-08 : 19:41:27
Hi


Here is what I want. I have attached two excel files(Test and Test) below.
Test is the file that I want to import and Test2 is how I want to import that into a table by using T-SQL. Two columns and two rows are skipped. I was trying BULK INSERT to do the job. Can you give me sample code for this? Or any other ways to do this.

Thanks

Test
Code Time Total Response Volume
All 6/20/2010 8.52E+07 7.80E+07 3408433.115
All 6/21/2010 9.43E+07 8.60E+07 4031057.071
All 6/22/2010 9.85E+07 9.03E+07 3865981.906
All 6/23/2010 1.03E+08 9.45E+07 3797180.512
All 6/24/2010 9.73E+07 8.94E+07 3689389.3
All 6/25/2010 9.63E+07 8.84E+07 3736468.931
All 6/26/2010 9.15E+07 8.41E+07 3468535.72
All Total 665748395.5 610582410.6 25997046.55
903 6/20/2010 1111.2874 853.1179 0
903 6/21/2010 1054.1545 739.4887 0
903 6/22/2010 941.4251 699.4346 0
903 6/23/2010 1348.4336 957.0162 0
903 6/24/2010 1239.1613 776.5331 0
903 6/25/2010 1207.9525 940.1313 0
903 6/26/2010 1121.0131 803.1779 0.0933
903 Total 8023.4275 5768.8997 0.0933
1204 6/20/2010 127.1147 62.9801 0
1204 6/21/2010 156.5014 98.3953 0
1204 6/22/2010 24.0449 11.2889 0



Test2

Code Time Volume
All 6/20/2010 3408433.115
All 6/21/2010 4031057.071
All 6/22/2010 3865981.906
All 6/23/2010 3797180.512
All 6/24/2010 3689389.3
All 6/25/2010 3736468.931
All 6/26/2010 3468535.72
903 6/20/2010 0
903 6/21/2010 0
903 6/22/2010 0
903 6/23/2010 0
903 6/24/2010 0
903 6/25/2010 0
903 6/26/2010 0.0933
1204 6/20/2010 0
1204 6/21/2010 0
1204 6/22/2010 0

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2010-07-08 : 20:02:22
Cross-post: http://www.sqlservercentral.com/Forums/Topic949508-1292-1.aspx

Tara Kizer
Microsoft MVP for Windows Server System - SQL Server
http://weblogs.sqlteam.com/tarad/

Subscribe to my blog
Go to Top of Page
   

- Advertisement -