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.
Author |
Topic |
hspatil31
Posting Yak Master
182 Posts |
Posted - 2009-01-20 : 05:40:48
|
Dear All,I tried following queary but it gives error. I don't understad what's error is that. What is missing in that. Can anybody plz tell me ? I am trying one column data of Excel copy to one column of SQL database. Queary:Update CRD7 T1 Set T1.TaxId0 = T2.TaxId0 from (Select * FROM OPENROWSET( 'Microsoft.Jet.OLEDB.4.0', 'Excel 8.0;Database=C:\Book1.xls;HDR=YES', 'SELECT * FROM [Sheet1]'))T2 WhereT1.CardCode = T2.CardCodeError:Msg 102, Level 15, State 1, Line 1Incorrect syntax near 'T1'.Msg 102, Level 15, State 1, Line 4Incorrect syntax near 'T2'. |
|
sakets_2000
Master Smack Fu Yak Hacker
1472 Posts |
Posted - 2009-01-20 : 07:34:08
|
[code]Update T1 Set T1.TaxId0 = T2.TaxId0 from (Select * FROM OPENROWSET( 'Microsoft.Jet.OLEDB.4.0', 'Excel 8.0;Database=C:\Book1.xls;HDR=YES', 'SELECT * FROM [Sheet1]'))T2,CRD7 T1 WhereT1.CardCode = T2.CardCode[/code] |
 |
|
madhivanan
Premature Yak Congratulator
22864 Posts |
Posted - 2009-01-21 : 02:41:27
|
Use ANSI JoinUpdate T1 Set T1.TaxId0 = T2.TaxId0 from (Select * FROM OPENROWSET( 'Microsoft.Jet.OLEDB.4.0', 'Excel 8.0;Database=C:\Book1.xls;HDR=YES', 'SELECT * FROM [Sheet1]'))T2 INNER JOIN CRD7 T1 ON T1.CardCode = T2.CardCode MadhivananFailing to plan is Planning to fail |
 |
|
|
|
|
|
|