Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Database & SysAdmin
  3. Database
  4. Help Creating a Temp Table

Help Creating a Temp Table

Scheduled Pinned Locked Moved Database
databasehelp
4 Posts 3 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • H Offline
    H Offline
    Hulicat
    wrote on last edited by
    #1

    All, I have been reading and trying diffrent ways to get this to work but the gist is I am trying to create a temp table that is slecting cloumns from multiple tables I cant see how a join would work and I have tried pass the columns from table2 as a varible..no luck The goal is to create one big table I can export off to a file I am using SQL 2008 Ent. Here is what I have: BEGIN If NOT Exists(Select * from tempdb..sysobjects Where id = object_id('tempdb.dbo.#temp')) SELECT firstname,lastname, INTO #TEMP FROM Table1 Select email, username into #temp from Table2 END

    Regards, Hulicat

    B N 2 Replies Last reply
    0
    • H Hulicat

      All, I have been reading and trying diffrent ways to get this to work but the gist is I am trying to create a temp table that is slecting cloumns from multiple tables I cant see how a join would work and I have tried pass the columns from table2 as a varible..no luck The goal is to create one big table I can export off to a file I am using SQL 2008 Ent. Here is what I have: BEGIN If NOT Exists(Select * from tempdb..sysobjects Where id = object_id('tempdb.dbo.#temp')) SELECT firstname,lastname, INTO #TEMP FROM Table1 Select email, username into #temp from Table2 END

      Regards, Hulicat

      B Offline
      B Offline
      Blue_Boy
      wrote on last edited by
      #2

      Do you get any error message? Can you explain better your problem?


      I Love T-SQL "Don't torture yourself,let the life to do it for you." If my post helps you kindly save my time by voting my post. www.aktualiteti.com

      H 1 Reply Last reply
      0
      • B Blue_Boy

        Do you get any error message? Can you explain better your problem?


        I Love T-SQL "Don't torture yourself,let the life to do it for you." If my post helps you kindly save my time by voting my post. www.aktualiteti.com

        H Offline
        H Offline
        Hulicat
        wrote on last edited by
        #3

        Thanks I think I got it...I was trying to get one result set from multiple tables I needed to use a cross join.... Regards

        Regards, Hulicat

        1 Reply Last reply
        0
        • H Hulicat

          All, I have been reading and trying diffrent ways to get this to work but the gist is I am trying to create a temp table that is slecting cloumns from multiple tables I cant see how a join would work and I have tried pass the columns from table2 as a varible..no luck The goal is to create one big table I can export off to a file I am using SQL 2008 Ent. Here is what I have: BEGIN If NOT Exists(Select * from tempdb..sysobjects Where id = object_id('tempdb.dbo.#temp')) SELECT firstname,lastname, INTO #TEMP FROM Table1 Select email, username into #temp from Table2 END

          Regards, Hulicat

          N Offline
          N Offline
          Niladri_Biswas
          wrote on last edited by
          #4

          ;with cte as(select t1.*, t2.* from table1 t1 cross join table2 t2) select * from cte OR ;with cte as(select t1.*, t2.* from table1 t1 ,table2 t2) select * from cte :)

          Niladri Biswas

          1 Reply Last reply
          0
          Reply
          • Reply as topic
          Log in to reply
          • Oldest to Newest
          • Newest to Oldest
          • Most Votes


          • Login

          • Don't have an account? Register

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • World
          • Users
          • Groups