|
INTERVIEW QUESTIONS
DATABASE
MS SQL SERVER
DETAILS
Question: How To Generate CREATE TABLE Script on an Existing Table in MS SQL Server?
Answer: If you want to know how an existing table was created, you can use SQL Server Management Studio to automatically generate a "CREATE TABLE" script The following tutorial shows you how to do this:
1. Run SQL Server Management Studio and connect to SQL server.
2. On the Object Explorer window, follow the object tree: Databases > GlobalGuideLineDatabase > Tables > dbo.tip.
3. Click right mouse button on dbo.tip. The context menu shows up.
4. Select "Script Table as" > "CREATE to" > "New Query Editor Window". The following script will be displayed:
USE [GlobalGuideLineDatabase] GO /****** Object: Table [dbo].[tip] Script Date: 05/05/2008 11:34:57 ******/ SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER ON GO SET ANSI_PADDING ON GO CREATE TABLE [dbo].[tip]( [id] [int] NOT NULL, [subject] [varchar](80) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL, [description] [varchar](256) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL, [create_date] [datetime] NULL, PRIMARY KEY CLUSTERED ( [id] ASC )WITH (PAD_INDEX = OFF, IGNORE_DUP_KEY = OFF) ON [PRIMARY] ) ON [PRIMARY] GO SET ANSI_PADDING OFF
|
|
|
Category |
MS SQL Server Interview Questions & Answers -
Exam Mode /
Learning Mode
|
Rating |
(0.2) By 9114 users |
Added on |
9/22/2014 |
Views |
66181 |
Rate it! |
|
|
Question:
How To Generate CREATE TABLE Script on an Existing Table in MS SQL Server?
Answer:
If you want to know how an existing table was created, you can use SQL Server Management Studio to automatically generate a "CREATE TABLE" script The following tutorial shows you how to do this:
1. Run SQL Server Management Studio and connect to SQL server.
2. On the Object Explorer window, follow the object tree: Databases > GlobalGuideLineDatabase > Tables > dbo.tip.
3. Click right mouse button on dbo.tip. The context menu shows up.
4. Select "Script Table as" > "CREATE to" > "New Query Editor Window". The following script will be displayed:
USE [GlobalGuideLineDatabase] GO /****** Object: Table [dbo].[tip] Script Date: 05/05/2008 11:34:57 ******/ SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER ON GO SET ANSI_PADDING ON GO CREATE TABLE [dbo].[tip]( [id] [int] NOT NULL, [subject] [varchar](80) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL, [description] [varchar](256) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL, [create_date] [datetime] NULL, PRIMARY KEY CLUSTERED ( [id] ASC )WITH (PAD_INDEX = OFF, IGNORE_DUP_KEY = OFF) ON [PRIMARY] ) ON [PRIMARY] GO SET ANSI_PADDING OFF Source: CoolInterview.com
If you have the better answer, then send it to us. We will display your answer after the approval.
Rules to Post Answers in CoolInterview.com:-
- There should not be any Spelling Mistakes.
- There should not be any Gramatical Errors.
- Answers must not contain any bad words.
- Answers should not be the repeat of same answer, already approved.
- Answer should be complete in itself.
|
|
Related Questions |
View Answer |
|
How To Get a List of Columns using the "sp_help" Stored Procedure in MS SQL Server?
|
View Answer
|
|
How To Get a List of Table Columns using the "sp_columns" Stored Procedure in MS SQL Server?
|
View Answer
|
|
How To Get a List of Columns using the "sys.columns" View in MS SQL Server?
|
View Answer
|
|
How To Get a List of All Tables with "sys.tables" View in MS SQL Server?
|
View Answer
|
|
How to create new tables with "CREATE TABLE" statements in MS SQL Server?
|
View Answer
|
|
What are DDL (Data Definition Language) statements for tables in MS SQL Server?
|
View Answer
|
|
What is a database table?
|
View Answer
|
|
What are system databases in MS SQL Server?
|
View Answer
|
|
How to set database to be SINGLE_USER in MS SQL Server?
|
View Answer
|
|
How to set database to be READ_ONLY in MS SQL Server?
|
View Answer
|
|
How to move database physical files in MS SQL Server?
|
View Answer
|
|
How to set a database state to OFFLINE in MS SQL Server?
|
View Answer
|
|
What are database states in MS SQL Server?
|
View Answer
|
|
Why I am getting this error when renaming a database in MS SQL Server?
|
View Answer
|
|
How to rename databases in MS SQL Server?
|
View Answer
|
|
How to create database with physical files specified in MS SQL Server?
|
View Answer
|
|
Where is my database stored on the hard disk in MS SQL Server?
|
View Answer
|
|
How to get a list all databases on the SQL server?
|
View Answer
|
|
Why I am getting this error when dropping a database in MS SQL Server?
|
View Answer
|
|
How to delete a database in MS SQL Server?
|
View Answer
|
Please Note: We keep on updating better answers to this site. In case you are looking for Jobs, Pls Click Here Vyoms.com - Best Freshers & Experienced Jobs Website.
View All MS SQL Server Interview Questions & Answers - Exam Mode /
Learning Mode
|