Find jobs | Jobseekers
Employer login
About us Sitemap of www.CareerRide.com Sitemap FAQ related with www.CareerRide.com FAQ Click here to Contact us Contact
       
Submit Resume Free ! | Access Resume Free !
Home Career Services Resume Services Interview questions Articles Books
Content
SQL Server part 1
SQL Server part 2
SQL Server part 3
SQL Server part 4
SQL Server part 5
SQL Server part 6
SQL Server part 7
SQL Server part 8
SQL Server part 9
SQL Server cursor
SQL Server replication
Structured query language
SQL Server architecture
SQL Server constraints
SQL Server cursors
Data Mining
Data warehousing
SQL Server DTS
SQL Server functions
SQL Server indexes
SQL Server joins
SQL Server locks
SQL Server Net integration
SQL Server optimization
SQL Server replication
SQL reporting services
SQL service broker
SQL Server stored procedures
SQL Server table
SQL Server transactions
SQL Server transactions Architecture
SQL Server triggers
SQL Server views
SQL Server XML integration
SQL Server DDL
SQL Server DML
SQL Server DCL
SQL Server identifier
SQL Server data integrity
SQL Server accessing data
SQL Server subqueries
SQL Server cube operator
SQL Server insert data
SQL Server distributed queries
SQL Server index tuning
 
ASP.NET | ADO.NET | AJAX
C#.NET | VB.NET | PHP
NET Remoting | NET Interview
  
C | C++ | Java | Oops
Data Structure | OS
   
Database concepts | Oracle
SQL Server | Biztalk | Sharepoint
Notification services
Reporting Services
Service-oriented architecture
Data warehousing | MySQL
  
Project Management 
Linux | Testing | Networking
Software engineering 
  
UML | XML | HTML | SOAP 
CSS | VBScript  | Web Services
   
CV Cover letter | Interview 
HR | Soft skills | GD 
Working from Home 
Tutorial
ASP.NET | VB.NET | C#.NET     
Remoting.NET | Web service
Remoting overview | ADO.NET
UML | Sql server 
More links
How to transfer or export SQL Server 2005 data to Excel 
Books on SQL Server
Beginners Guide to SQL Server Integration Services Using Visual Studio 2005 

SQL Server table


SQL Server table - Interview questions

<<Previous  Next>>

SQL Server table - August 29, 2008 at 18:00 PM by Nishant Kumar

Define Table.

SQL Server database stores information in a two dimensional objects of rows and columns called table.

Define Local temporary table and global temporary table.

Local temporary table is created by prefixing name with pound sign like (#table_name). Global temporary table is created by prefixing name with Double pound sign like (##table_name). Local temporary table is dropped when the stored procedure completes. Global temporary tables are dropped when session that created the table ends.

SQL Server table - August 29, 2008 at 18:00 PM by Amit Satpute

What is Cascade and restrict in Drop table SQL?

RESTRICT indicates that the table should not be dropped if any dependencies exist. If dependencies are found, an error is returned and the table isn't dropped.

CASCADE specifies that the dependencies be removed before the drop is performed


SQL Server table - Nov 18, 2008 at 18:00 PM by Rajmeet Ghai

Define SQL Server Tables. Explain Create Table syntax with an example.

Answer
SQL server tables are used to store data. Each table is divided into rows and columns. Each row has some data against the specified column. Each column has a data type thereby restricting the type of data it can accept.

Syntax:
CREATE TABLE "table_name" ("column 1" "data_type_for_column_1", "column 2" "data_type_for_column_2", ... )

Example:
CREATE TABLE Customer (ID Integer (10), First_name Varchar(20));

Explain how to determine column nullability of a table.

Answer
The column nullability can be determined if:

a. source table column is nullable: If any of the source columns are nullable, the result column is nullable

b. Source table column is not nullable; the column in the new table is defined as not null: If all the source columns in the expression are not nullable, the result column is not nullable.

Explain how to reference a table from another database in the same server.

Answer
A table can be referred from another database on the same server the following way:
Dbname.tablename

Example:
Select * from Dbtest.customer

Explain how to rename a table.

Answer
The ALTER table statement can be used to rename a table.
ALTER TABLE table_name
RENAME TO new_table_name
Example:
ALTER TABLE customer
   RENAME TO cust_details;

Explain how to change the owner of a table.

Answer
Owner of a table can be changed by using:
Sp_changeobjectowner [obj_name] ‘object’, [ @newowner = ] 'owner'
Example:
Sp_changeobjectowner ‘customer’, ‘Mark’
Here, customer table is the obj_name while Mark is owner.

Explain autonumbering and identifier column of a table.

Answer
Each table can have a unique identifier that uniquely identifies the row. This identifier can be an auto incremented value generated by system. For e.g. Customer_id Identifier columns can contain values unique within the table on which they are defined. This means that other tables with an identifier column can have the same values. A single, unique identifier column can be created for every table. Such columns are typically used for billing system to avoid duplications.

Explain how to determine if a table has a primary key?

Answer
A primary key is usually identified by the keyword PRIMARY KEY. Any column that has the keyword (while creating the table) as PRIMARY KEY means the table has a primary key. The values of this column are always unique.

What is globally unique identifier?

Answer
A globally unique identifier is sued to provide a unique reference number. This GUID is unique across tables, servers and locations. The GUID values are unique and hence may be large in number. NEWID() can be used to create such unique values.

How can we determine if a column is an identity column?

Answer
Using OBJECTPROPERTY function, one can find if the table has an identity column.
Syntax:
OBJECTPROPERTY(object_id,proeprty)
Here the property will be TableHasIdentity. SQL Server returns 1 if the table has an identity column, 0 if it doesn't.

How can we determine if a column is a primary column?

Answer
Using OBJECTPROPERTY function, one can find if the table has an identity column.
Syntax:
OBJECTPROPERTY(object_id,proeprty)
Here the property will be TableHasPrimaryKey. SQL Server returns 1 if the table has a primary key, 0 if it doesn't.

What are the purposes of table variables?

Answer
a. Table variables can be used to store result set in a SQL serer. This result set can be used for processing later.

b. Table variables can be used in stored procedures, user defined functions.

c. Table variables give a better performance

d. Table variables can be used in a SELECT, INSERT, UPDATE statements.

e. Unlike temporary variables, they don’t require a declaration or cleaning up

What are some of the drawbacks of table variables?

Answer
a. SQL server does not maintain a statistics of table variables. This means that how and where these variables were used cannot be determined because they are washed out as soon as the stored procedure or function is finished execution.

b. Table definition of a table variable cannot be changed after a DECLARE statement. Hence, NO ALTER statement will work.

c. Table variables cannot be used In ROLLBACK of transactions


<<Previous  Next>>



 
Today's Hot Jobs
C++  SQL Server
.NET  Java  Oracle
Finance  Marketing
Seekers  Employers
Copyright © 2008 CareerRide.com. All rights reserved.