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
 General SQL Server Forums
 New to SQL Server Programming
 Help for Excel Query

Author  Topic 

nirene
Yak Posting Veteran

98 Posts

Posted - 2011-03-03 : 03:56:18
Hai,

I have a Excel sheet which is being downloaded from Siebel CRM which contains many columns I wanna select only a certain fields out of it if I execute the below mentioned query it says 'Invalid column name 'OUTPUT VAT @ 12.5%'

Select INVOICE_DATE,INVOICE_NO,INVOICE_STATUS,[JOB CARD NO] as JobNo,ACCOUNT_NAME,[MODE OF PAYMENT] as Mode,
[OUTPUT VAT @ 12.5%] as VAT,[PARTS AMOUNT] as Parts,[LUBRICANT AMOUNT] as LubAmt,[REGN NO] as RegnNo,DIVISION
from OPENROWSET('Microsoft.Jet.OLEDB.4.0','Excel 8.0;HDR=YES;IMEX=1;Database=E:\XX.XLS','Select * from [MISSING$]')

I dont know what I'm missing advice me.

Nirene

vaibhavktiwari83
Aged Yak Warrior

843 Posts

Posted - 2011-03-03 : 04:06:06
Are you sure this column is in excel file ?

Vaibhav T

If I cant go back, I want to go fast...
Go to Top of Page

nirene
Yak Posting Veteran

98 Posts

Posted - 2011-03-03 : 04:08:03
Hai Vaibhav,

Yes its there.

Nirene
Go to Top of Page

vaibhavktiwari83
Aged Yak Warrior

843 Posts

Posted - 2011-03-03 : 04:39:10
Its the problem of Column name.
SQL Server converts column name with dot as [OUTPUT VAT @ 12.5%] will be converted into [OUTPUT VAT @ 12#5%]
First try the above query with "SELECT *" and then look at the column names then go ahead...

Vaibhav T

If I cant go back, I want to go fast...
Go to Top of Page

nirene
Yak Posting Veteran

98 Posts

Posted - 2011-03-03 : 04:45:28
Hai Vaibhav,
Thanks for pointing out the problem, thanks once again.

Nirene
Go to Top of Page

vaibhavktiwari83
Aged Yak Warrior

843 Posts

Posted - 2011-03-03 : 04:52:51
You are welcome...

Vaibhav T

If I cant go back, I want to go fast...
Go to Top of Page
   

- Advertisement -