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
 Data Import // MS Query // Header Missing

Author  Topic 

nicci113
Starting Member

11 Posts

Posted - 2013-04-16 : 07:18:01
Hi Guys,

i wonder if anybody can assist me this is doing my head-in. I am using Query and linking it with Excel 03 to pull the result. The query works fine in Sql server but when it runs in Excel Query it removes the header for all the allias used within the query. Any suggestion why its happining. I can't manually keep writing since its a regular report.

select rtrim(service) as service,sum(NumberOfPassengers)Passenger,
DepartureName,ArrivalName,
Company, DepartureMonthName, DepartureYear

from table1
where DepartureDate between '01-jan-2012'and getdate()
and (DepartureName like 'random%'
or ArrivalName like 'ramdp,%')
and Company='ran'
group by ServiceNumberOld,DepartureName,ArrivalName,Company,DepartureMonthName,DepartureYear,ServiceNameOld

bandi
Master Smack Fu Yak Hacker

2242 Posts

Posted - 2013-04-16 : 08:16:59
which approach you are using?
1) Import/Export
2) bcp command
3) SSIS package

--
Chandu
Go to Top of Page

nicci113
Starting Member

11 Posts

Posted - 2013-04-16 : 09:05:50
import/export
standard one from excel data tab.

I am making it extremely simple so no SSIS
Go to Top of Page

bandi
Master Smack Fu Yak Hacker

2242 Posts

Posted - 2013-04-16 : 09:22:39
Then do one thing...
Create View for your query in sql server..
Then use Excel to import data from that view

--
Chandu
Go to Top of Page

nicci113
Starting Member

11 Posts

Posted - 2013-04-16 : 10:13:47
cant create a view DBA don't sit in this work and we have a restricted access. Any other suggestion?Do you know why only Alias gets the issue?
Go to Top of Page

bandi
Master Smack Fu Yak Hacker

2242 Posts

Posted - 2013-04-17 : 00:43:54
How you are using the above query in Excel.. can you explain the process..

--
Chandu
Go to Top of Page

nicci113
Starting Member

11 Posts

Posted - 2013-04-17 : 04:38:53
I am using 03 Excel and Data - Import Query copy query in there and return the entire Data dump which links to pivot and then the final front view of report.
One Thing somebody suggested was to import the Data direct in pivot and change the header which after refresh doesn't change the manually edited headers. The only issue is somereport I do require the data import first calc and then pivot so I need to know the fix.
Go to Top of Page
   

- Advertisement -