Welcome,  Guest  |  Sign In |  New User? 

List of MS SQL Server Interview Questions Interview Questions & Answers

Page 1 of 25: 1 2 3 4 5 6 7 8 9 10 Next>>

How to find unused Stored Procedures in SQL Server 2005/2008         [ 16 ]

Use dynamic PivotTables to identify unused Stored Procedures in a SQL Server 2005/2008 database



Choose your rating:    Post Ans.    View More Ans.

@@IDENTITY in SQL Server         [ 66 ]

@@IDENTITY means previous table identity number.

Choose your rating:    Post Ans.    View More Ans.

What is nvarchar in mssql server         [ 122 ]

It will support all languages



Choose your rating:    Post Ans.    View More Ans.

SQL Server Query Execution Plan Analysis         [ 111 ]

Its very useful when executing big query.
We will get the perfect query result based on this.



Choose your rating:    Post Ans.    View More Ans.

Correlated Joins Using "Apply"         [ 28 ]

The APPLY SQL extension introduced with the release of SQL Server 2005. The APPLY statement can be used in your SQL FROM Clause and allows you to call a table returning function for each row of the outer query. Furthermore (and more importantly for our example), it allows you to pass in outer query columns as arguments to the called function.

CROSS APPLY and OUTER APPLY. CROSS APPLY will return All records in the outer query that have a matching record returned by the inner function\query (Similar to an Inner Join). OUTER APPLY will return all records in the outer query whether they have a matching record in the inner function\query or not (Similar to an Outer Join).

Source

Choose your rating:    Post Ans.    View More Ans.

How to Change the Owner of All Tables to "dbo" ?         [ 39 ]

sp_MSforeachtable @command1="EXEC sp_changeobjectowner '?','dbo'"

Choose your rating:    Post Ans.    View More Ans.

How to Find Duplicates Without Using JOIN ?         [ 39 ]

Select stdName from tblStudent GROUP BY stdName  HAVING COUNT( stdName) > 1

Choose your rating:    Post Ans.    View More Ans.

What does "ambiguous column name" mean?         [ 45 ]

This usually means your SQL statement is joining on more than one table, and doesn't know which column you're trying to retrieve.

Choose your rating:    Post Ans.    View More Ans.

What is @@IDENTITY ? Explain         [ 53 ]

Returns the last-inserted identity value.

Syntax

@@IDENTITY
Return Types: numeric

Remarks

After an INSERT, SELECT INTO, or bulk copy statement completes, @@IDENTITY contains the last identity value generated by the statement. If the statement did not affect any tables with identity columns, @@IDENTITY returns NULL. If multiple rows are inserted, generating multiple identity values, @@IDENTITY returns the last identity value generated. If the statement fires one or more triggers that perform inserts that generate identity values, calling @@IDENTITY immediately after the statement returns the last identity value generated by the triggers. If a trigger is fired after an insert action on a table that has an identity column, and the trigger inserts into another table that does not have an identity column, @@IDENTITY will return the identity value of the first insert. The @@IDENTITY value does not revert to a previous setting if the INSERT or SELECT INTO statement or bulk copy fails, or if the transaction is rolled back.

@@IDENTITY, SCOPE_IDENTITY, and IDENT_CURRENT are similar functions in that they return the last value inserted into the IDENTITY column of a table.

@@IDENTITY and SCOPE_IDENTITY will return the last identity value generated in any table in the current session. However, SCOPE_IDENTITY returns the value only within the current scope; @@IDENTITY is not limited to a specific scope.

Examples

This example inserts a row into a table with an identity column and uses @@IDENTITY to display the identity value used in the new row.

INSERT INTO jobs (job_desc,min_lvl,max_lvl)
VALUES ('Accountant',12,125)
SELECT @@IDENTITY AS 'Identity'

Choose your rating:    Post Ans.    View More Ans.

NOT NULL constraint         [ 42 ]

A NOT NULL constraint enforces that the column will not accept null values. The not null constraints are used to enforce domain integrity, as the check constraints.

Choose your rating:    Post Ans.    View More Ans.

Page 1 of 25: 1 2 3 4 5 6 7 8 9 10 Next>>