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. Duplicate a SQL Server table

Duplicate a SQL Server table

Scheduled Pinned Locked Moved Database
databasesql-serversysadminsecurityhelp
3 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.
  • R Offline
    R Offline
    Robby
    wrote on last edited by
    #1

    Here's what I want to do: I have an application that delivers web based security forms for individuals to fill out. I am trying to write a GUI that will allow someone with little coding experience create a form. I want to offer the option of copying an existing form (including the actual ASP page and SQL table). I can handle duplicating and renaming the actual ASP form, but I can find no information on how to copy a tables columns, data types, constraints and triggers from an existing table to a new one, renaming the new table to correlate to the new form. I hope someone can help me. Thanks!

    R 1 Reply Last reply
    0
    • R Robby

      Here's what I want to do: I have an application that delivers web based security forms for individuals to fill out. I am trying to write a GUI that will allow someone with little coding experience create a form. I want to offer the option of copying an existing form (including the actual ASP page and SQL table). I can handle duplicating and renaming the actual ASP form, but I can find no information on how to copy a tables columns, data types, constraints and triggers from an existing table to a new one, renaming the new table to correlate to the new form. I hope someone can help me. Thanks!

      R Offline
      R Offline
      RichardGrimmer
      wrote on last edited by
      #2

      Probaly the most straight forward method would be to create a DTS package, then call that from code - can supply an example if necessary, but not to bad to just "have a go at"... "Now I guess I'll sit back and watch people misinterpret what I just said......" Christian Graus At The Soapbox

      D 1 Reply Last reply
      0
      • R RichardGrimmer

        Probaly the most straight forward method would be to create a DTS package, then call that from code - can supply an example if necessary, but not to bad to just "have a go at"... "Now I guess I'll sit back and watch people misinterpret what I just said......" Christian Graus At The Soapbox

        D Offline
        D Offline
        Dr_X
        wrote on last edited by
        #3

        I would agree with Richard in using the DTS package if the requirement are to copy the triggers, indices & constraints as well. For a just a table the easiest way would be to

        Select *
        Into [tblNewTable]
        From [tblExistingTable]
        Where 0=1

        Michael I firmly believe that any man's finest hour, the greatest fulfillment of all that he holds dear, is that moment when he has worked his heart out in a good cause and lies exhausted on the field of battle - victorious. Vince Lombardi (1913-1970)

        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