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
 Ordering of records in result set(Resolved)

Author  Topic 

mmkrishna1919
Yak Posting Veteran

95 Posts

Posted - 2013-05-27 : 07:29:08
Hi All,

I have a local temporary table with two columns like (identity_col,result)

Now i am going to insert the Result column data into global temporary table order by identity_col data.

select result into ##global_table
from #local_table
order by identity_col

When i query the Global temporary table like
select * from ##global_table
will we get result set in same sequence all the time?

M.MURALI kRISHNA

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2013-05-27 : 07:35:40
Nope
the order is not guaranteed unless you use explicit ORDER BY in the select as

select * from ##global_table order by identity_col


------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/
https://www.facebook.com/VmBlogs
Go to Top of Page

mmkrishna1919
Yak Posting Veteran

95 Posts

Posted - 2013-05-27 : 08:16:06
Thanks Visakh

M.MURALI kRISHNA
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2013-05-27 : 13:45:58
welcome

------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/
https://www.facebook.com/VmBlogs
Go to Top of Page
   

- Advertisement -