我已使用SSIS将一些数据从Excel文件导入到我的SQL Server表中。因为它是一份利润和报告。损失声明它有一个名为交易名称的标题,地址会计年度等。
在SSIS中,我使用了OLE DB Source并使用了像
这样的查询Select * from [Sheet1$A10:E]
所以数据已被提取。但是你需要插入交易名称和会计年度信息以及其他数据,如
Trader FYear AccNo AccName July August September
a 2014 4-0000 In
a 2014 4-0500 Ad $4,514.06 $4,521.23 $4,296.62
a 2014 4-1000 Me $37,085.78 $35,676.20 $36,150.87
a 2014 4-1300 Ro $11,876.20 $10,956.70 $11,819.04
a 2014 4-2000 Gr $57,540.76 $52,978.63 $54,272.24
我可以使用OLE DB Source和SQL从Excel表中选择交易者和FYear
select * from [Sheet1$a1:a8]
并使用条件分割我可以将它们分开。但我实际上并不知道如何将该数据插入该表的每一列,如上所述。
如果我像
那样编写查询,还有一件事insert into tblA(Trader, FYear, AccNo, AccName, July, August, September)
select
'a', '2014', tblB.AccNo, tblB.AccName,
tblB.July, tblB.August, tblB.September;
然后,它在SQL Server表中工作,但任何人都可以帮助我插入这两个列与上表中的数据?不管怎样,谢谢
![在此处输入图片说明] [1]
Trading Name(a)
Address1
Address2
Profit & Loss Statement
Fiscal Year(2014)
AccNo AccName July August September
4-0000 In
4-0500 Ad $4,514.06 $4,521.23 $4,296.62
4-1000 Me $37,085.78 $35,676.20 $36,150.87
4-1300 Ro $11,876.20 $10,956.70 $11,819.04
4-2000 Gr $57,540.76 $52,978.63 $54,272.24
4-3500 B $0.00 $0.00 $0.00
4-4000 P $3,576.76 $4,110.66 $2,208.31
4-5000 Be $19,559.94 $17,926.14 $18,260.71
4-6000 Tu $13,471.97 $15,042.04 $13,150.06
4-8900 Re $3,500.00 $0.00 $0.00
Total Income $151,125.47 $141,211.60 $140,157.85
5-0000 Cost of Sales
Gross Profit $151,125.47 $141,211.60 $140,157.85
6-0000 Expenses
6-1000 General & Administrative Exp
6-1050 Accounting Fees $0.00 $0.00 $270.00
6-1200 Bank Charges $11.20 $11.20 $14.99