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 |
HareeshGowtham
Starting Member
2 Posts |
Posted - 2012-02-29 : 01:05:18
|
Dear All, I need to export data from sql table to excel by using query. for that i am using following coding.I am having table named xyz with the colums of (Mark1, Mark2, Student) and this table will have some set of values. I need to export the set of datas to excel as Mark1---> Column AMark2---> Column BTotal----> Column C in excel its a formula column, where its the summation of A & B.Student---> Column DINSERT INTO OPENROWSET('Microsoft.Jet.OLEDB.4.0','Excel 8.0;Database=H:/Testing1.xls;','SELECT * FROM [Sheet1].range($A1:B1,$D1)')select MARK1,MARK2,Student from XYZIf i am using the excel columns sequentially its getting imported. but if i am using alternate columns to post, its popup following error..OLE DB provider "Microsoft.Jet.OLEDB.4.0" for linked server "(null)" returned message "Syntax error in FROM clause.".Msg 7321, Level 16, State 2, Line 1An error occurred while preparing the query "SELECT * FROM [Sheet1].range($A1:B1,$D1)" for execution against OLE DB provider "Microsoft.Jet.OLEDB.4.0" for linked server "(null)". |
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2012-02-29 : 12:12:47
|
sorry what do you mean by alternate columns to post? can you explain?------------------------------------------------------------------------------------------------------SQL Server MVPhttp://visakhm.blogspot.com/ |
|
|
|
|
|
|
|