Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion Groups
DB Engine
SQL ServerMSDESQL Server CE
Services
Analysis (Data Mining)Analysis (OLAP)DTSIntegration ServicesNotification ServicesReporting Services
Programming
CLRConnectivitySQLXML
Other Technologies
ClusteringEnglish QueryFull-Text SearchReplicationService Broker
General
Data WarehousingPerformanceSecuritySetupSQL Server ToolsOther SQL Server Topics
DirectoryUser Groups
Related Topics
MS AccessOther DB ProductsMS Server Products.NET DevelopmentVB DevelopmentJava DevelopmentMore Topics ...

SQL Server Forum / DB Engine / SQL Server / August 2007

Tip: Looking for answers? Try searching our database.

SQL view not sorted when import to Excel

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Pat M - City of Reno - 31 Aug 2007 19:40 GMT
I have a view in SQL Server 2005 that is sorted. When I import to Excel, it
comes in not sorted. Where the problem on this? I also posted on Excel Gen
Questions. Thanks.

Signature

Regards,
Pat

Tibor Karaszi - 31 Aug 2007 22:16 GMT
A view isn't sorted, as a table isn't. What you need to do is to have ORDER BY when you read *from*
the view. Even if you have ORDER BY and TOP 100 PERCENT in the view definition, SQL Server will
ignore it. Since ... a view isn't sorted.

Signature

Tibor Karaszi, SQL Server MVP
http://www.karaszi.com/sqlserver/default.asp
http://sqlblog.com/blogs/tibor_karaszi

>I have a view in SQL Server 2005 that is sorted. When I import to Excel, it
> comes in not sorted. Where the problem on this? I also posted on Excel Gen
> Questions. Thanks.
Pat M - City of Reno - 31 Aug 2007 23:22 GMT
this is great...I will do so...I really appreciate the help. I didn't know a
view was never sorted.
Signature

Regards,
Pat

> A view isn't sorted, as a table isn't. What you need to do is to have ORDER BY when you read *from*
> the view. Even if you have ORDER BY and TOP 100 PERCENT in the view definition, SQL Server will
[quoted text clipped - 3 lines]
> > comes in not sorted. Where the problem on this? I also posted on Excel Gen
> > Questions. Thanks.
Pat M - City of Reno - 31 Aug 2007 23:28 GMT
Tibor:
When  I look at options on the Import, Edit Query, all I see is
"LogosDB"."dbo"."vw_plm_CAFR1". Should I cut and paste the whole SQL
statement in that Window?

Signature

Regards,
Pat

> A view isn't sorted, as a table isn't. What you need to do is to have ORDER BY when you read *from*
> the view. Even if you have ORDER BY and TOP 100 PERCENT in the view definition, SQL Server will
[quoted text clipped - 3 lines]
> > comes in not sorted. Where the problem on this? I also posted on Excel Gen
> > Questions. Thanks.
Pat M - City of Reno - 31 Aug 2007 23:32 GMT
never mind Tibor, that worked...thanks a million!!!!!!
Pat

Signature

Regards,
Pat

> A view isn't sorted, as a table isn't. What you need to do is to have ORDER BY when you read *from*
> the view. Even if you have ORDER BY and TOP 100 PERCENT in the view definition, SQL Server will
[quoted text clipped - 3 lines]
> > comes in not sorted. Where the problem on this? I also posted on Excel Gen
> > Questions. Thanks.
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2009 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.