SQL Server Forums
Profile | Register | Active Topics | Members | Search | Forum FAQ
 
Register Now and get your question answered!
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 Data Import // MS Query // Header Missing
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

nicci113
Starting Member

11 Posts

Posted - 04/16/2013 :  07:18:01  Show Profile  Reply with Quote
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
Flowing Fount of Yak Knowledge

India
2202 Posts

Posted - 04/16/2013 :  08:16:59  Show Profile  Reply with Quote
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 - 04/16/2013 :  09:05:50  Show Profile  Reply with Quote
import/export
standard one from excel data tab.

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

bandi
Flowing Fount of Yak Knowledge

India
2202 Posts

Posted - 04/16/2013 :  09:22:39  Show Profile  Reply with Quote
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 - 04/16/2013 :  10:13:47  Show Profile  Reply with Quote
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
Flowing Fount of Yak Knowledge

India
2202 Posts

Posted - 04/17/2013 :  00:43:54  Show Profile  Reply with Quote
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 - 04/17/2013 :  04:38:53  Show Profile  Reply with Quote
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
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
 Printer Friendly
Jump To:
SQL Server Forums © 2000-2009 SQLTeam Publishing, LLC Go To Top Of Page
This page was generated in 0.08 seconds. Powered By: Snitz Forums 2000