Home
|
Tutorial
|
Articles
|
Forum
|
Interview Question
|
Code Snippets
|
News
|
Fun Zone
|
Poll
|
Web Links
|
Certification
|
Search
Welcome :
Guest
Sign In
Register
Win Surprise Gifts!!!
Congratulations!!!
Top 5 Contributors of the Month
satyapriyanayak
Narayanan
Karthikeyan Anbarasan
Amit Mehra
Jean Paul
Home
>>
Interview Question
>>
Sql Server
>>
Post New Question
Subscribe to Interview Questions
How can we create a table from another table without copying any values from the old table?
Posted By :
Dhivakaran
Posted Date :
November 30, 2010
Points :
10
Category :
Sql Server
CREATE TABLE new_table
AS (SELECT * FROM old_table WHERE 1=2);
You can also find related Interview Question to
How can we create a table from another table without copying any values from the old table?
below:
What command is used to create a table by copying the structure of another table?
CREATE TABLE .. AS SELECT command
Explanation :
To copy only the structure, the WHERE clause of the SELECT command should contain a FALSE statement as in the following.
CREATE TABLE NEWTABLE AS SELECT * FROM EXISTINGTABLE WHERE 1=2;
If the WHERE condition is true, then all the rows or rows satisfying the condition will be copied to the new table.
(More...)
Which command is used to create a table by copying the structure of another table?
CREATE TABLE .. AS SELECT command
Example:-
CREATE TABLE
AS SELECT*FROM
WHERE 1=2;
(More...)
How you will create a UNIQUE Constraint when the table is already created?
ALTER TABLE table_name
ADD UNIQUE (Column_Name)
(More...)
How you will create a CHECK Constraint when the table is already created
ALTER TABLE table_name
ADD CHECK (P_Id>0)
(More...)
Would the select query below fetch any records?
create table #testvm (ID int)
select * from sysobjects where name = '#testvm'
drop table #testvm
No..
Since temp tables are created in tempdb, and use a random name, the query will not work.
If you used a query like this, you would see your table:
select * from tempdb..sysobjects where name like '#testvm%'
(More...)
How do we create table from another table in sql?
CREATE TABLE new_table
AS (SELECT * FROM old_table);
(More...)
You work for a bank that uses a SQL Server 2005 database to store line items from customer banking transactions. The bank processes 50,000 transactions every day. The application requires a clustered index on the TransactionID column. You need to create a
table that supports an efficient reporting solution that queries the transactions by date.What are the two ways to achieve this goal? (Each correct answer presents a complete solution. Choose two.)
A. Place a nonclustered index on the date column.
B. Add a unique clustered index on the date column
C. Map each partition to a filegroup, with each filegroup accessing a different physical
drive.
D. Create a partitioning scheme that partitions the data by date.
A,d
(More...)
Which type of index physically orders the rows in a table?
Clustered index
(More...)
What are the privileges that can be granted on a table by a user to others?
Insert, update, delete, select, references, index, execute, alter, all
(More...)
Which system table contains information on constraints on all the tables created?
USER_CONSTRAINTS
(More...)
Quick Links For Interview Questions Categories:
ASP.Net
Windows Application
.NET Framework
C#
VB.Net
ADO.Net
Sql Server
SharePoint
Silverlight
OOPs
JQuery
JavaScript/VBScript
Biztalk
Patten/Practices
.IIS
WCF
WPF
WWF
Networking
Aptitude
Others
All
Find questions, FAQ's and their answers related to .NET, C#, Vb.Net, Sql Server and many more.
Now you can find lots of .NET, C#, Vb.Net, SQL Server,Windows, ASP.Net related Questions and their Answers here at www.dotnetspark.com. Our aim is to help you pass your certification Exams (MCP, MCSD, MCAD etc.,) with flying scores and get good name in your company.
So, Start looking our
Interview Question
section daily and improve your .NET Skills. You can also help others by posting Interview Questions and their Answers in this section.
Hall of Fame
Twitter
Terms of Service
Privacy Policy
Contact Us
Archives
Tell A Friend