0

I read about local and global temporary tables in sql and find out very good explanation about both of them. local and global Temp table.
But unable to understand what is real life(business) scenario where local and global temporary table are useful.
Please explain with example.

Community
  • 1
  • 1
Aamir
  • 345
  • 4
  • 24
  • 1
    Usually you need to use a temp. table when you're building something complex and need to store the intermediate results to be used later in another query. I have used global temp. tables extremely rarely and it's not really easy to come up with any case for using them. – James Z May 03 '16 at 18:19
  • all you have to know what the various temp tables are and what it can and cannot do in terms of supporting index and scope. Most of the time, I'll use CTE and table variables. – dfdsfdsfsdf May 03 '16 at 18:48
  • Are you asking about temp tables _in general_ or the difference between global and local temp tables? – D Stanley May 03 '16 at 19:25
  • Hi, @DStanley no I know difference, I want to know use case, where global temp table are useful, actually use case scenario for local and global temp table ask by interviewer to me and I have no answer. – Aamir May 07 '16 at 20:26

1 Answers1

0

Please refer to this site, examples are included. http://www.sqlservercentral.com/blogs/vivekssqlnotes/2012/01/07/sql-server-global-temporary-tables/

S.Tedla
  • 11
  • 2