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. General Programming
  3. Visual Basic
  4. SQL Question

SQL Question

Scheduled Pinned Locked Moved Visual Basic
questiondatabase
5 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.
  • G Offline
    G Offline
    GrindAZ
    wrote on last edited by
    #1

    I have an empty table I set up as a Master table template. How can I copy this table and give it a new name using SQL? I have to create a new table each day so I just want to copy this template table I have.

    D R 2 Replies Last reply
    0
    • G GrindAZ

      I have an empty table I set up as a Master table template. How can I copy this table and give it a new name using SQL? I have to create a new table each day so I just want to copy this template table I have.

      D Offline
      D Offline
      Daniel Turini
      wrote on last edited by
      #2

      select * into new_table from old_table where 1 = 0

      This will copy the basic structure, but it will not create indexes, PK, constraints, etc. Kant wrote: Actually she replied back to me "You shouldn't fix the bug. You should kill it"

      G 1 Reply Last reply
      0
      • D Daniel Turini

        select * into new_table from old_table where 1 = 0

        This will copy the basic structure, but it will not create indexes, PK, constraints, etc. Kant wrote: Actually she replied back to me "You shouldn't fix the bug. You should kill it"

        G Offline
        G Offline
        GrindAZ
        wrote on last edited by
        #3

        Is there no way to do a SQL command like CREATE TABLE or something to copy this table?

        D 1 Reply Last reply
        0
        • G GrindAZ

          Is there no way to do a SQL command like CREATE TABLE or something to copy this table?

          D Offline
          D Offline
          Daniel Turini
          wrote on last edited by
          #4

          Something like a "COPY TABLE STRUCTURE"? No, probably because it's not a good practice to spread your data through several small physical tables. Your physical database design should be decoupled from the logical design. Kant wrote: Actually she replied back to me "You shouldn't fix the bug. You should kill it"

          1 Reply Last reply
          0
          • G GrindAZ

            I have an empty table I set up as a Master table template. How can I copy this table and give it a new name using SQL? I have to create a new table each day so I just want to copy this template table I have.

            R Offline
            R Offline
            Ray Cassick
            wrote on last edited by
            #5

            Oh boy... Your DB admin will love that :) Just use one table and add a date of entry column. Its soooooo much simpler.


            Paul Watson wrote: "At the end of the day it is what you produce that counts, not how many doctorates you have on the wall." George Carlin wrote: "Don't sweat the petty things, and don't pet the sweaty things." Jörgen Sigvardsson wrote: If the physicists find a universal theory describing the laws of universe, I'm sure the asshole constant will be an integral part of that theory.


            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