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 |  
                                    | albertkohlAged Yak Warrior
 
 
                                        740 Posts | 
                                            
                                            |  Posted - 2012-08-15 : 11:59:53 
 |  
                                            | okay,so kinda odd. i used to do this all the time in 2008, but now it wont work.if i take a table, and sort it into another table, it doesnt sort.i.e:this works fine (as far as what's displayed: select * from append.dbo.[01001] order by zip10but when i drop it into a table to export it, it's no longer sorted. select * into append.dbo.[01001_sorted] from append.dbo.[01001] order by zip10select * from append.dbo.[01001_sorted]any ideas? |  |  
                                    | visakh16Very Important crosS Applying yaK Herder
 
 
                                    52326 Posts | 
                                        
                                          |  Posted - 2012-08-15 : 12:28:03 
 |  
                                          | you cant guarantee order of retrieval unless you use order by in selectso you need to use like select * from append.dbo.[01001_sorted] order by zip10------------------------------------------------------------------------------------------------------SQL Server MVPhttp://visakhm.blogspot.com/ |  
                                          |  |  |  
                                    | albertkohlAged Yak Warrior
 
 
                                    740 Posts | 
                                        
                                          |  Posted - 2012-08-15 : 12:33:20 
 |  
                                          | anything else i can do? issue is that after the select .. into, i usually call an export script. i'd rather not have to add another parameter on the proc for sorting. |  
                                          |  |  |  
                                    | visakh16Very Important crosS Applying yaK Herder
 
 
                                    52326 Posts | 
                                        
                                          |  Posted - 2012-08-15 : 13:03:43 
 |  
                                          | quote:why do you need to parameterise sorting? isnt it always based on same field?------------------------------------------------------------------------------------------------------SQL Server MVPhttp://visakhm.blogspot.com/Originally posted by albertkohl
 anything else i can do? issue is that after the select .. into, i usually call an export script. i'd rather not have to add another parameter on the proc for sorting.
 
 |  
                                          |  |  |  
                                    | albertkohlAged Yak Warrior
 
 
                                    740 Posts | 
                                        
                                          |  Posted - 2012-08-16 : 00:14:31 
 |  
                                          | nope. :( my export script basically will dynamically generate a layout, and then dump via bcp with "," formatting and a header.i export all kinds of fields/columns/formats, this was just one example. |  
                                          |  |  |  
                                |  |  |  |