|
|
|
Old Hand
      
Group: General Forum Members
Last Login: 2 days ago @ 2:59 PM
Points: 382,
Visits: 1,104
|
|
|
|
|
|
Hall of Fame
       
Group: General Forum Members
Last Login: Monday, May 20, 2013 2:02 PM
Points: 3,788,
Visits: 5,543
|
|
I've been using INSERT INTO for so long that I forgot INTO was optional. Who knew?
__________________________________________________
Against stupidity the gods themselves contend in vain. -- Friedrich Schiller Stop, children, what's that sound? -- Stephen Stills
|
|
|
|
|
SSCrazy
      
Group: General Forum Members
Last Login: Sunday, May 19, 2013 7:02 PM
Points: 2,860,
Visits: 405
|
|
Whilst I totally understand it's a valid identifier, I just want to understand, does that query create a table with the name "#", or does it create a temporary table with no name?
Urbis, an urban transformation company
|
|
|
|
|
SSCommitted
      
Group: General Forum Members
Last Login: Yesterday @ 1:51 AM
Points: 1,972,
Visits: 1,821
|
|
Iggy (2/8/2009) Whilst I totally understand it's a valid identifier, I just want to understand, does that query create a table with the name "#", or does it create a temporary table with no name? Create a temporary table with name #.
|
|
|
|
|
UDP Broadcaster
      
Group: General Forum Members
Last Login: Wednesday, January 02, 2013 12:15 PM
Points: 1,443,
Visits: 711
|
|
It's a cool bit of trivia that it works, but not good programming practice- better to name the table something meaningful!
Reminds me of some code I inherited code that used a b and c etc as variable names.... tough to maintain and bad programming practice...
|
|
|
|
|
Ten Centuries
      
Group: General Forum Members
Last Login: Monday, May 13, 2013 2:04 AM
Points: 1,342,
Visits: 1,946
|
|
Of course, if you want to be really silly you can docreate table # (_ int) go insert # select 1 go select * from #
Derek
|
|
|
|
|
Ten Centuries
      
Group: General Forum Members
Last Login: Tuesday, May 07, 2013 12:02 PM
Points: 1,058,
Visits: 2,574
|
|
Derek Dongray (2/9/2009)
Of course, if you want to be really silly you can do create table # (_ int) go insert # select 1 go select * from #
I'll use that next time I need to interview someone
_______________________________________________________________________ For better assistance in answering your questions, click here
|
|
|
|
|
SSC-Dedicated
           
Group: Administrators
Last Login: Yesterday @ 3:26 PM
Points: 31,425,
Visits: 13,738
|
|
|
|
|
|
Hall of Fame
       
Group: General Forum Members
Last Login: Friday, May 17, 2013 2:11 PM
Points: 3,108,
Visits: 2,114
|
|
and yet another "but why" ...
create table [table] ([int] int) go insert [table] select 1 go select [int] from [table] go
Regards Rudy Komacsar Senior Database Administrator
"Ave Caesar! - Morituri te salutamus."
|
|
|
|
|
SSC-Addicted
      
Group: General Forum Members
Last Login: Tuesday, December 07, 2010 8:13 AM
Points: 436,
Visits: 322
|
|
So it adds a temp table into memory or on the permamnent media or both? How long does the temp table last?
There have been times when I want to use a temp table to hold some data for the length of a webpage, but I generally have a table called tempSomethingMeaningful and clear the table when I am done. This way I don't have to worry about setting up the columns every time.
|
|
|
|