.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Win Surprise Gifts!!!

Top 5 Contributors of the Month
Gaurav Pal

Home >> Interview Question >> Sql Server >> Post New Question Subscribe to Interview Questions

How many Primary key in single table in sqlserver?

Posted By :sriram     Posted Date :October 27, 2011    Points :40   Category :Sql Server 
Primary key Restrict Duplicate Values and Null values .Each Table can have only one primary ..

Create table emp(empid int constraint pk_empid primary key(empid),empname varchar(90))


You can also find related Interview Question to How many Primary key in single table in sqlserver?  below: 

How To Get Description Value for Single Column in Table using SQL Command?

To Get Description of Single Column we need to use system function sys.fn_listextendedproperty. we need to pass the column Name is this case.
Command To Get Description Data for Single Columns:

SELECT * FROM fn_listextendedproperty(NULL, 'SCHEMA',
'dbo', 'TABLE', 'Table Name Here', 'COLUMN', 'Column Name Here') (More...)

How To retrive Duplicate Records when There is no Primary key in a Table?

select city_name
from areas
group by city_name

having count(*) > 1 (More...)

Write a SQL query to send mail, whenever a new record is inserted into a table using Sqlserver 2000.

Here we have to create a trigger on required table as show below.

ON TableX

EXEC master..xp_sendmail
@message = 'body'
@subject = 'foo was fired.'

How do we get primary key information in oracle table?

we can get primary key information with the following SQL statement

SELECT b.table_name, b.column_name, b.position, a.status, cons.owner
FROM all_constraints a, all_cons_columns b
WHERE cons.constraint_type = 'P'
AND a.constraint_name = b.constraint_name
AND a.owner = b.owner
ORDER BY b.table_name, b.position;

Can we work on both (After) and (InsteadOf) Triggers in SQL on a single table?

We can create any type of triggers on a single table . But the thing is if we have Instead Of Trigger created on a table until and unless it is disabled or deleted we cannot work on After Triggers.
At a single stretch we cannot work on both the types.

what is the advantages of using temporary table in SQLServer

Its have some major advantages like
a)Temporary table decrease the amount of locking and logging
b)Temporary table improves performance.
c) Table gets cleared up automatically when current procedure goes out of scope
d) Temporary table makes the complex logic simple.
e) Temporary table cache Intermediate results. (More...)

Database: How many primary key constraints can be created for one table?

Only one primary key constraints can be created for one table. (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...)

What command is used to create a table by copying the structure of another table?


Explanation :

To copy only the structure, the WHERE clause of the SELECT command should contain a FALSE statement as in the following.
If the WHERE condition is true, then all the rows or rows satisfying the condition will be copied to the new table. (More...)

What are primary keys and foreign keys?

Primary keys are the unique identifiers for each row. They must contain unique values and cannot be null. Due to their importance in relational databases, Primary keys are the most fundamental of all keys and constraints. A table can have only one Primary key.
Foreign keys are both a method of ensuring data integrity and a manifestation of the relationship between tables.

Shashi Ray (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