SQL Server Forums
Profile | Register | Active Topics | Members | Search | Forum FAQ
 
Register Now and get your question answered!
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 SQL Server 2005 Forums
 Transact-SQL (2005)
 export excel data into SQL Server table
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

Patyk
Starting Member

39 Posts

Posted - 02/24/2014 :  13:43:42  Show Profile  Reply with Quote
I have an excel worksheet "Output" in my excel spreadsheet. d:\data\ExtractData.xlsm

Output worksheet has the following 3 column data table
Product Type Price
0175301574 t2
0175301574 t3
0175301574 us
0175301574 ud
0175301574 bu
0175301574 r 28.8
0170900874 cd
0170900874 k6
0170900874 k5
0170900874 k4
0170900874 k3
0170900874 c
0170900874 k2
0170900874 k1
0170900874 t1
0170900874 t2
0170900874 t3
0170900874 us 8
0170900874 ud 4.8
0170900874 bu 4.4
0170900874 r 4.8
0170900874 b 4.8
0170900874 p 4.8
0175301384 cd 123.24
0175301384 k6 123.24
0175301384 k5 132.72
0175301384 k4 143.78
0175301384 k3 164.32
0175301384 c 104.28
0175301384 k2 160.21
0175301384 k1 164.32
0175301384 t1 166.37
0175301384 t2 184.86

I need to write a store procedure to import this data, excluding the records without Price into my identical table in SQL Server. Product are Type are the primary keys.

Any Help would be appreciated.

thanks

Mar
Starting Member

44 Posts

Posted - 02/25/2014 :  08:27:40  Show Profile  Reply with Quote
I would recommend writing a macro to loop through the workbook then pass each row to the stored procedure. Unless you are bound to a SP then bulk insert may be an option.

Edited by - Mar on 02/25/2014 08:29:33
Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
 Printer Friendly
Jump To:
SQL Server Forums © 2000-2009 SQLTeam Publishing, LLC Go To Top Of Page
This page was generated in 0.03 seconds. Powered By: Snitz Forums 2000