Create table structure from existing table

0 votes
How to create a new table in which the structure should be the same as another table?
Aug 28, 2022 in Database by Kithuzzz
• 38,000 points
734 views

No answer to this question. Be the first to respond.

Your answer

Your name to display (optional):
Privacy: Your email address will only be used for sending these notifications.
0 votes

Try:

Select * Into <DestinationTableName> From <SourceTableName> Where 1 = 2

Keep in mind that this won't duplicate any keys or indexes. You must create a Create Script of the table if you wish to copy the full structure. That script can be used to build a new table with the same structure. If necessary, you can also dump the data into the new table.

To generate a Create Script when using Enterprise Manager, simply right-click the table and choose copy. 

I hope this helps you.

answered Aug 29, 2022 by narikkadan
• 63,600 points

edited Mar 5

Related Questions In Database

0 votes
1 answer

How to generate the statement CREATE TABLE for an existing table in postgreSQL?

Generate table creation statement for an existing ...READ MORE

answered Feb 9, 2022 in Database by Neha
• 9,020 points
6,902 views
0 votes
1 answer

Excel - Create item list from table values

What is Data Validation, and how does ...READ MORE

answered Apr 11, 2022 in Database by gaurav
• 23,260 points
2,326 views
0 votes
0 answers

How to create a table from select query result in SQL Server 2008

I tried to build a table from ...READ MORE

Sep 2, 2022 in Database by Kithuzzz
• 38,000 points
948 views
0 votes
1 answer

What is the best way to fetch data from table?

Hey Shraddha, I understand your doubts about fetching ...READ MORE

answered May 25, 2019 in Database by sampriti
• 1,120 points
2,130 views
0 votes
1 answer

How will I get all the rows from my table where name starts with 's' and ending with 'I'?

Hi Santanu, I understand your problem, You can try ...READ MORE

answered May 28, 2019 in Database by sampriti
• 1,120 points
2,241 views
0 votes
1 answer

How can I check my all existing table in MySQL database?

Hi Pratik, I understand your problem regarding this ...READ MORE

answered Jul 1, 2019 in Database by sampriti
• 1,120 points
1,524 views
0 votes
1 answer

Calculate Time Intersection to Correlate Sequences of Independent Events

I think this solution requires a CROSS JOIN implementation. ...READ MORE

answered Oct 26, 2018 in Power BI by Upasana
• 8,620 points
898 views
0 votes
1 answer

What are the different authentication modes in SQL Server? How can it be changed?

Windows mode and Mixed Mode – SQL ...READ MORE

answered Oct 29, 2018 in Database by Sahiti
• 6,370 points
1,340 views
0 votes
1 answer

Time Series Chart in Power BI

Your Date format should be handled by ...READ MORE

answered Nov 26, 2018 in Power BI by Upasana
• 8,620 points
4,522 views
0 votes
1 answer

Power BI Using SQL Server stored procedures

NOTE: The following works for the "Import ...READ MORE

answered Dec 14, 2018 in Power BI by Upasana
• 8,620 points
6,415 views
webinar REGISTER FOR FREE WEBINAR X
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP