<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0">
<channel>
<title>Prepare 4 interview - Recent questions and answers in SQL Server Interview Questions and Answers</title>
<link>http://prepare4interview.com/qa/sql-server-interview-questions-and-answers</link>
<description>Powered by Question2Answer</description>
<item>
<title>Answered: What is a self-join, in MS SQL Server?</title>
<link>http://prepare4interview.com/146/what-is-a-self-join-in-ms-sql-server#a1798</link>
<description>self join is join the table to itself.&lt;br /&gt;
ex: select col1,col2 from tbl a inner join tbl b on a.col1=b.col2&lt;br /&gt;
there is only one table called in the above query tbl</description>
<category>SQL Server Interview Questions and Answers</category>
<guid isPermaLink="true">http://prepare4interview.com/146/what-is-a-self-join-in-ms-sql-server#a1798</guid>
<pubDate>Tue, 31 Jan 2012 10:35:06 +0000</pubDate>
</item>
<item>
<title>Answered: What is a Sub-Query, in MS SQL Server?</title>
<link>http://prepare4interview.com/157/what-is-a-sub-query-in-ms-sql-server#a1797</link>
<description>Sub query: is the secondary query in a query. &lt;br /&gt;
ex: select col1,col2 from (select scol1 as col1,scol2 as col2 from sub_query_tbl) as a&lt;br /&gt;
the query in paranthesis is sub query , in subquery no order by should use.&lt;br /&gt;
there are diff types of sub queries exists,&lt;br /&gt;
independent sub query, correlated sub query,single valued,multi valued</description>
<category>SQL Server Interview Questions and Answers</category>
<guid isPermaLink="true">http://prepare4interview.com/157/what-is-a-sub-query-in-ms-sql-server#a1797</guid>
<pubDate>Tue, 31 Jan 2012 10:32:03 +0000</pubDate>
</item>
<item>
<title>Answered: What is the default “SORT” order for a SQL, in MS SQL Server?</title>
<link>http://prepare4interview.com/141/what-is-the-default-sort-order-for-a-sql-in-ms-sql-server#a1796</link>
<description>The default sort order is alphabtic (if userid column exists), else we see there no such order when all are int datatype.</description>
<category>SQL Server Interview Questions and Answers</category>
<guid isPermaLink="true">http://prepare4interview.com/141/what-is-the-default-sort-order-for-a-sql-in-ms-sql-server#a1796</guid>
<pubDate>Tue, 31 Jan 2012 10:27:53 +0000</pubDate>
</item>
<item>
<title>Answered: What is CTE (Common Table Expression), in MS SQL Server?</title>
<link>http://prepare4interview.com/162/what-is-cte-common-table-expression-in-ms-sql-server#a1795</link>
<description>CTE is a temporary named result set that you can reference within a SELECT, INSERT, UPDATE, or DELETE statement.</description>
<category>SQL Server Interview Questions and Answers</category>
<guid isPermaLink="true">http://prepare4interview.com/162/what-is-cte-common-table-expression-in-ms-sql-server#a1795</guid>
<pubDate>Wed, 25 Jan 2012 23:50:22 +0000</pubDate>
</item>
<item>
<title>TELL ME SOMETHING ABOUT YOURSELF</title>
<link>http://prepare4interview.com/1786/tell-me-something-about-yourself</link>
<description>GIVE ME SUGGESTETION WHAT TO ANSWER</description>
<category>SQL Server Interview Questions and Answers</category>
<guid isPermaLink="true">http://prepare4interview.com/1786/tell-me-something-about-yourself</guid>
<pubDate>Sun, 20 Nov 2011 05:17:37 +0000</pubDate>
</item>
<item>
<title>Answered: How do you sort in SQL, in MS SQL Server?</title>
<link>http://prepare4interview.com/138/how-do-you-sort-in-sql-in-ms-sql-server#a1785</link>
<description>using Order by</description>
<category>SQL Server Interview Questions and Answers</category>
<guid isPermaLink="true">http://prepare4interview.com/138/how-do-you-sort-in-sql-in-ms-sql-server#a1785</guid>
<pubDate>Mon, 07 Nov 2011 10:43:42 +0000</pubDate>
</item>
<item>
<title>Answered: You want to select the first record in a given set of rows, in MS SQL Server?</title>
<link>http://prepare4interview.com/137/you-want-select-the-first-record-given-set-rows-in-sql-server#a1784</link>
<description>Select top 1 * from table name</description>
<category>SQL Server Interview Questions and Answers</category>
<guid isPermaLink="true">http://prepare4interview.com/137/you-want-select-the-first-record-given-set-rows-in-sql-server#a1784</guid>
<pubDate>Mon, 07 Nov 2011 10:42:33 +0000</pubDate>
</item>
<item>
<title>what is the retail banking?</title>
<link>http://prepare4interview.com/1772/what-is-the-retail-banking</link>
<description>what is the retail banking?</description>
<category>SQL Server Interview Questions and Answers</category>
<guid isPermaLink="true">http://prepare4interview.com/1772/what-is-the-retail-banking</guid>
<pubDate>Wed, 27 Jul 2011 10:17:09 +0000</pubDate>
</item>
<item>
<title>Answered: What is the difference between DELETE and TRUNCATE?</title>
<link>http://prepare4interview.com/151/what-is-the-difference-between-delete-and-truncate#a1761</link>
<description>Truncate:1)deletes all the data but the strucure of table remains 2)Faster Compared to delete.3)truncate is autocommited statment.&lt;br /&gt;
delete:1)deletes all data but &amp;nbsp;the structure remains same.2)slow compared to truncate.3)Delete is not auto commited.</description>
<category>SQL Server Interview Questions and Answers</category>
<guid isPermaLink="true">http://prepare4interview.com/151/what-is-the-difference-between-delete-and-truncate#a1761</guid>
<pubDate>Wed, 06 Jul 2011 09:09:52 +0000</pubDate>
</item>
<item>
<title>Answered: How to do sql server performance turning?</title>
<link>http://prepare4interview.com/1750/how-to-do-sql-server-performance-turning#a1759</link>
<description>What are the measures shoud be consider during sql server performance turning?What are the measures shoud be consider during sql server performance turning?What are the measures shoud be consider during sql server performance turning?</description>
<category>SQL Server Interview Questions and Answers</category>
<guid isPermaLink="true">http://prepare4interview.com/1750/how-to-do-sql-server-performance-turning#a1759</guid>
<pubDate>Tue, 31 May 2011 03:49:26 +0000</pubDate>
</item>
<item>
<title>Answered: How to import table using “INSERT” statement, in MS SQL Server?</title>
<link>http://prepare4interview.com/133/how-to-import-table-using-insert-statement-in-ms-sql-server#a1758</link>
<description>insert into tablename&lt;br /&gt;
select * from otherdb.dbo.othertable&lt;br /&gt;
&lt;br /&gt;
above statement can be used to import data from other database.&lt;br /&gt;
We can use OPENROWSET utility.</description>
<category>SQL Server Interview Questions and Answers</category>
<guid isPermaLink="true">http://prepare4interview.com/133/how-to-import-table-using-insert-statement-in-ms-sql-server#a1758</guid>
<pubDate>Sun, 10 Apr 2011 17:48:39 +0000</pubDate>
</item>
<item>
<title>Answered: What is a DDL, DML and DCL concept in RDBMS world, in MS SQL Server?</title>
<link>http://prepare4interview.com/134/what-is-ddl-dml-and-dcl-concept-in-rdbms-world-in-ms-sql-server#a1757</link>
<description>DDL (Data definition language) defines our database structure. CREATE and ALTER are DDL statements as they affect the way our database structure is organized.&lt;br /&gt;
DML (Data Manipulation Language) lets we do basic functionalities like INSERT, UPDATE, DELETE and MODIFY data in database.&lt;br /&gt;
DCL (Data Control Language) controls you DML and DDL statements so that your data is protected and has consistency. COMITT and ROLLBACK are DCL control statements. DCL guarantees ACID fundamentals of a transaction.</description>
<category>SQL Server Interview Questions and Answers</category>
<guid isPermaLink="true">http://prepare4interview.com/134/what-is-ddl-dml-and-dcl-concept-in-rdbms-world-in-ms-sql-server#a1757</guid>
<pubDate>Sat, 09 Apr 2011 10:47:20 +0000</pubDate>
</item>
<item>
<title>Answered: SSIS control flow items</title>
<link>http://prepare4interview.com/1753/ssis-control-flow-items#a1754</link>
<description>To know more about SSIS control flow items, please have a look at this question.&lt;br /&gt;
&lt;br /&gt;
http://prepare4interview.com/965/various-control-flow-items-in-ssis&lt;br /&gt;
&lt;br /&gt;
It is already answered.</description>
<category>SQL Server Interview Questions and Answers</category>
<guid isPermaLink="true">http://prepare4interview.com/1753/ssis-control-flow-items#a1754</guid>
<pubDate>Tue, 08 Feb 2011 17:40:17 +0000</pubDate>
</item>
<item>
<title>Answered: What is Extent and Page?</title>
<link>http://prepare4interview.com/116/what-is-extent-and-page#a1748</link>
<description>extent is group 8 data pages each of 8kb and datapage where data stored and of 8kb.</description>
<category>SQL Server Interview Questions and Answers</category>
<guid isPermaLink="true">http://prepare4interview.com/116/what-is-extent-and-page#a1748</guid>
<pubDate>Sun, 19 Dec 2010 21:03:14 +0000</pubDate>
</item>
<item>
<title>Answered: write a query to display middle record in  emp table</title>
<link>http://prepare4interview.com/1740/write-a-query-to-display-middle-record-in-emp-table#a1742</link>
<description>select * from&lt;br /&gt;
(select ROW_NUMBER() OVER(ORDER BY empno) &amp;nbsp;sno, empno,ename from emp)&lt;br /&gt;
where &lt;br /&gt;
sno in &lt;br /&gt;
(&lt;br /&gt;
select floor((count(*)+1)/2) eg from emp&lt;br /&gt;
union&lt;br /&gt;
select ceil((count(*)+1)/2) eg from emp&lt;br /&gt;
)&lt;br /&gt;
&lt;br /&gt;
Try this..</description>
<category>SQL Server Interview Questions and Answers</category>
<guid isPermaLink="true">http://prepare4interview.com/1740/write-a-query-to-display-middle-record-in-emp-table#a1742</guid>
<pubDate>Mon, 22 Nov 2010 07:58:28 +0000</pubDate>
</item>
<item>
<title>What are all the best practices you follow in SQL server which will increase the performance ?</title>
<link>http://prepare4interview.com/1714/what-practices-follow-server-which-will-increase-performance</link>
<description>1. Create a primary key on each table you create and unless you are really knowledgeable enough to figure out a better plan, make it the clustered index (note that if you set the primary key in Enterprise Manager it will cluster it by default). &lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;2. Create an index on any column that is a foreign key. If you know it will be unique, set the flag to force the index to be unique. &lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;3. Don’t index anything else (yet). &lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;4. Unless you need a different behaviour, always owner qualify your objects when you reference them in TSQL. Use dbo.sysdatabases instead of just sysdatabases. &lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;5. Use set nocount on at the top of each stored procedure (and set nocount off) at the bottom. &lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;6. Think hard about locking. If you’re not writing banking software, would it matter that you take a chance on a dirty read? You can use the NOLOCK hint, but it’s often easier to use SET TRANSACTION ISOLATION LEVEL READ UNCOMMITTED at the top of the procedure, then reset to READ COMMITTED at the bottom. &lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;7. I know you’ve heard it a million times, but only return the columns and the rows you need. &lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;8. Use transactions when appropriate, but allow zero user interaction while the transaction is in progress. I try to do all my transactions inside a stored procedure. &lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;9. Avoid temp tables as much as you can, but if you need a temp table, create it explicitly using Create Table #temp. &lt;br /&gt;
&amp;nbsp;&amp;nbsp;10. Avoid NOT IN, instead use a left outer join - even though it’s often easier to visualize the NOT IN. &lt;br /&gt;
&amp;nbsp;&amp;nbsp;11. If you insist on using dynamic sql (executing a concatenated string), use named parameters and sp_executesql (rather than EXEC) so you have a chance of reusing the query plan. While it’s simplistic to say that stored procedures are always the right answer, it’s also close enough that you won’t go wrong using them. &lt;br /&gt;
&amp;nbsp;&amp;nbsp;12. Get in the habit of profiling your code before and after each change. While you should keep in mind the depth of the change, if you see more than a 10-15% increase in CPU, Reads, or Writes it probably needs to be reviewed.&lt;br /&gt;
&amp;nbsp;&amp;nbsp;13. Look for every possible way to reduce the number of round trips to the server. Returning multiple resultsets is one way to do this. &lt;br /&gt;
&amp;nbsp;&amp;nbsp;14. Avoid index and join hints. &lt;br /&gt;
&amp;nbsp;&amp;nbsp;15. When you’re done coding, set Profiler to monitor statements from your machine only, then run through the application from start to finish once. Take a look at the number of reads and writes, and the number of calls to the server. See anything that looks unusual? It’s not uncommon to see calls to procedures that are no longer used, or to see duplicate calls. Impress your DBA by asking him to review those results with you.</description>
<category>SQL Server Interview Questions and Answers</category>
<guid isPermaLink="true">http://prepare4interview.com/1714/what-practices-follow-server-which-will-increase-performance</guid>
<pubDate>Sun, 31 Oct 2010 08:11:09 +0000</pubDate>
</item>
<item>
<title>Answered: Which SQL mechanisms allow user to browse tables sequentially?</title>
<link>http://prepare4interview.com/1698/which-sql-mechanisms-allow-user-browse-tables-sequentially#a1700</link>
<description>You can also use a SELECT statement to process through a set of records one record at a time. To do this I will issue an initial SELECT statement that will return the first row, then a series of follow on SELECT statements where each SELECT statement retrieves the next row. This is done by using the &amp;quot;TOP 1&amp;quot; clause of the SELECT statement, and a WHERE statement.&lt;br /&gt;
&lt;br /&gt;
I will use the same example as above and only return the top 5 CustomerID's from the Northwind database Customers table. In this code I will use two different &amp;quot;SELECT TOP 1&amp;quot; statements and a WHILE loop to return all 5 records. Each record will be processed one at a time.&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp; &amp;nbsp; declare @CustId nchar(5)&lt;br /&gt;
&amp;nbsp; &amp;nbsp; declare @RowNum int&lt;br /&gt;
&amp;nbsp; &amp;nbsp; select top 1 @CustId=CustomerID from Northwind.dbo.Customers&lt;br /&gt;
&amp;nbsp; &amp;nbsp; set @RowNum = 0 &lt;br /&gt;
&amp;nbsp; &amp;nbsp; WHILE @RowNum &amp;lt; 5&lt;br /&gt;
&amp;nbsp; &amp;nbsp; BEGIN&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;set @RowNum = @RowNum + 1&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;print cast(@RowNum as char(1)) + ' ' + @CustId&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;select top 1 @CustId=CustomerID from Northwind.dbo.Customers&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;where CustomerId &amp;gt; @CustID&lt;br /&gt;
&amp;nbsp; &amp;nbsp; END</description>
<category>SQL Server Interview Questions and Answers</category>
<guid isPermaLink="true">http://prepare4interview.com/1698/which-sql-mechanisms-allow-user-browse-tables-sequentially#a1700</guid>
<pubDate>Fri, 15 Oct 2010 07:26:54 +0000</pubDate>
</item>
<item>
<title>Answered: Explain the Service Broker components</title>
<link>http://prepare4interview.com/1643/explain-the-service-broker-components#a1644</link>
<description>The following are the components of Service Broker:&lt;br /&gt;
&lt;br /&gt;
Message:&lt;br /&gt;
---------------------&lt;br /&gt;
The basic unit of information that is transferred in a Service Broker application. These are received by Service Broker, the way they are sent and are guaranteed only for sending and receiving one at a time.&lt;br /&gt;
&lt;br /&gt;
Conversation:&lt;br /&gt;
---------------------&lt;br /&gt;
After sending a message to Service Broker, a conversation, which is created for a particular task and deleted soon after the ask has been completed. It is the primary information exchange construct in Service Broker.&lt;br /&gt;
&lt;br /&gt;
Queue:&lt;br /&gt;
---------------------&lt;br /&gt;
All messages are stored in a queue till the processing is completed. It is a special type of table which can be viewed only with SELECT statement on the name of the queue and INSERT, DELETE, UPDATE statements can not be issued. These messages on a queue will certainly persists even a server restarts, thus guarantees the non-loss of the message.&lt;br /&gt;
&lt;br /&gt;
Service:&lt;br /&gt;
---------------------&lt;br /&gt;
Reading a messages and processing them is the action of service component. It can be a stored procedure or an ad hoc, or a different program which connects to the database server. Every services need to be associated with a queue.&lt;br /&gt;
&lt;br /&gt;
Conversation Groups:&lt;br /&gt;
---------------------&lt;br /&gt;
The message processing is serializes and correlates the messages by using conversation groups. Each conversation is a member in a conversation group. The core concept is, some of the messages are related to other messages, and the conversation group puts them together in an ordered fashion.</description>
<category>SQL Server Interview Questions and Answers</category>
<guid isPermaLink="true">http://prepare4interview.com/1643/explain-the-service-broker-components#a1644</guid>
<pubDate>Wed, 13 Oct 2010 10:09:11 +0000</pubDate>
</item>
<item>
<title>Answered: What exactly is SQL Server 2005 Service Broker?</title>
<link>http://prepare4interview.com/1640/what-exactly-is-sql-server-2005-service-broker#a1642</link>
<description>Scalable, secure database applications can be developed by using SQL Server 2005 Service Broker. Apart from Database Engine, message-based communication platform is provided which enables the independent application components to perform as a functioning. Service Broker includes an infrastructure for asynchronous programming. This could be used for applications for single database as well as for distributed applications. The application development time will be reduced by providing the necessary infrastructure for building distributed applications.</description>
<category>SQL Server Interview Questions and Answers</category>
<guid isPermaLink="true">http://prepare4interview.com/1640/what-exactly-is-sql-server-2005-service-broker#a1642</guid>
<pubDate>Wed, 13 Oct 2010 10:07:13 +0000</pubDate>
</item>
<item>
<title>Answered: What is the new error handling technique in SQL Server 2005?</title>
<link>http://prepare4interview.com/1637/what-is-the-new-error-handling-technique-in-sql-server-2005#a1639</link>
<description>SQL Server 2005 introduces a new exception handling paradigm using TRY / CATCH blocks in T-SQL. The errors are well trapped in the try block and the execution is transferred to the catch block. The circumstances like using cursors… the cursor is allocated for opening in the TRY block at the time of occurring an error is thrown to CATCH block to determine whether it is open. If it is open, it should be close and deallocate.&lt;br /&gt;
&lt;br /&gt;
SQL Server 2005 still supports the @@ERROR function, but TRY / CATCH is a much better option.</description>
<category>SQL Server Interview Questions and Answers</category>
<guid isPermaLink="true">http://prepare4interview.com/1637/what-is-the-new-error-handling-technique-in-sql-server-2005#a1639</guid>
<pubDate>Wed, 13 Oct 2010 10:04:39 +0000</pubDate>
</item>
<item>
<title>Answered: Can you explain the difference between the INTERSECT and EXCEPT operators?</title>
<link>http://prepare4interview.com/1634/you-explain-difference-between-intersect-except-operators#a1636</link>
<description>EXCEPT: Two query expressions are evaluated and the difference between the results will be returned by EXCEPT operator. The result set will have rows returned from the first set of rows except the rows those are also returned from the second set of rows.&lt;br /&gt;
&lt;br /&gt;
INTERSECT: The result of two queries is evaluated and returns the rows which are common to each.</description>
<category>SQL Server Interview Questions and Answers</category>
<guid isPermaLink="true">http://prepare4interview.com/1634/you-explain-difference-between-intersect-except-operators#a1636</guid>
<pubDate>Wed, 13 Oct 2010 09:57:08 +0000</pubDate>
</item>
<item>
<title>Answered: What is the difference between “HAVING” and “WHERE” clause, in MS SQL Server?</title>
<link>http://prepare4interview.com/153/what-difference-between-having-and-where-clause-sql-server#a1614</link>
<description>Specifies a search condition for a group or an aggregate. HAVING can be used only with the SELECT statement. HAVING is typically used in a GROUP BY clause. When GROUP BY is not used, HAVING behaves like a WHERE clause. Having Clause is basically used only with the GROUP BY function in a query. WHERE Clause is applied to each row before they are part of the GROUP BY function in a query.</description>
<category>SQL Server Interview Questions and Answers</category>
<guid isPermaLink="true">http://prepare4interview.com/153/what-difference-between-having-and-where-clause-sql-server#a1614</guid>
<pubDate>Tue, 05 Oct 2010 14:28:03 +0000</pubDate>
</item>
<item>
<title>Answered: What is ROLLUP, in MS SQL Server?</title>
<link>http://prepare4interview.com/150/what-is-rollup-in-ms-sql-server#a1418</link>
<description>* ROLLUP clause is used to do aggregate operation on multiple levels in hierarchy.&lt;br /&gt;
&lt;br /&gt;
* The SQL ROLLUP and CUBE commands offer a valuable tool for gaining some quick and dirty insight into your data.&lt;br /&gt;
&lt;br /&gt;
* The ROLLUP operator is useful in generating reports that contain subtotals and totals. The ROLLUP operator generates a result set that is similar to the result sets generated by the CUBE operator.</description>
<category>SQL Server Interview Questions and Answers</category>
<guid isPermaLink="true">http://prepare4interview.com/150/what-is-rollup-in-ms-sql-server#a1418</guid>
<pubDate>Wed, 29 Sep 2010 11:18:05 +0000</pubDate>
</item>
<item>
<title>Answered: How to use sqlcmd utility with input output file?</title>
<link>http://prepare4interview.com/26/how-to-use-sqlcmd-utility-with-input-output-file#a1350</link>
<description>To use input file: sqlcmd -S myServer\instanceName -i C:\myScript.sql&lt;br /&gt;
&lt;br /&gt;
To send result set to output file: sqlcmd -S myServer\instanceName -i C:\myScript.sql -o C:\EmpAdds.txt</description>
<category>SQL Server Interview Questions and Answers</category>
<guid isPermaLink="true">http://prepare4interview.com/26/how-to-use-sqlcmd-utility-with-input-output-file#a1350</guid>
<pubDate>Fri, 17 Sep 2010 13:55:22 +0000</pubDate>
</item>
<item>
<title>Answered: How to use sqlcmd utility in a named instance of SQL Server?</title>
<link>http://prepare4interview.com/25/how-to-use-sqlcmd-utility-in-a-named-instance-of-sql-server#a1349</link>
<description>Open a Command Prompt window, and type sqlcmd -S myServer\instanceName. Replace myServer\instanceName with the name of the computer and the instance of SQL Server that you want to connect to.&lt;br /&gt;
&lt;br /&gt;
Press ENTER.&lt;br /&gt;
&lt;br /&gt;
The sqlcmd prompt (1&amp;gt;) indicates that you are connected to the specified instance of SQL Server.&lt;br /&gt;
&lt;br /&gt;
Windows Authentication is the default authentication mode for sqlcmd. To use SQL Server Authentication, you must specify a user name and password by using the -U and -P options.</description>
<category>SQL Server Interview Questions and Answers</category>
<guid isPermaLink="true">http://prepare4interview.com/25/how-to-use-sqlcmd-utility-in-a-named-instance-of-sql-server#a1349</guid>
<pubDate>Fri, 17 Sep 2010 13:54:57 +0000</pubDate>
</item>
<item>
<title>Answered: What is Deadlock? How SQL Server handles deadlock</title>
<link>http://prepare4interview.com/23/what-is-deadlock-how-sql-server-handles-deadlock#a1348</link>
<description>Deadlocking occurs when two user processes have locks on separate objects and each process is trying to acquire a lock on the object that the other process has. When this happens, SQL Server identifies the problem and ends the deadlock by automatically choosing one process and aborting the other process, allowing the other process to continue. The aborted transaction is rolled back and an error message is sent to the user of the aborted process. Generally, the transaction that requires the least amount of overhead to rollback is the transaction that is aborted.</description>
<category>SQL Server Interview Questions and Answers</category>
<guid isPermaLink="true">http://prepare4interview.com/23/what-is-deadlock-how-sql-server-handles-deadlock#a1348</guid>
<pubDate>Fri, 17 Sep 2010 13:53:16 +0000</pubDate>
</item>
<item>
<title>Answered: What is Data Independence?</title>
<link>http://prepare4interview.com/21/what-is-data-independence#a1347</link>
<description>Data independence means that, the application is independent of the storage structure and access strategy of data?. In other words, The ability to modify the schema definition in one level should not affect the schema definition in the next higher level.&lt;br /&gt;
&lt;br /&gt;
Two types of Data Independence are:&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;1. &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;Physical Data Independence: Modification in physical level should not affect the logical level.&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;2. &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;Logical Data Independence: Modification in logical level should affect the view level.&lt;br /&gt;
&lt;br /&gt;
NOTE: Logical Data Independence is more difficult to achieve.</description>
<category>SQL Server Interview Questions and Answers</category>
<guid isPermaLink="true">http://prepare4interview.com/21/what-is-data-independence#a1347</guid>
<pubDate>Fri, 17 Sep 2010 10:06:01 +0000</pubDate>
</item>
<item>
<title>Answered: What is extension and intension?</title>
<link>http://prepare4interview.com/20/what-is-extension-and-intension#a1346</link>
<description>Extension - It is the number of tuples present in a table at any instance. This is time dependent.&lt;br /&gt;
Intension - It is a constant value that gives the name, structure of table and the constraints laid on it.</description>
<category>SQL Server Interview Questions and Answers</category>
<guid isPermaLink="true">http://prepare4interview.com/20/what-is-extension-and-intension#a1346</guid>
<pubDate>Fri, 17 Sep 2010 07:41:51 +0000</pubDate>
</item>
<item>
<title>Answered: Define the &quot;Integrity Rules&quot;</title>
<link>http://prepare4interview.com/19/define-the-integrity-rules#a1345</link>
<description>There are two Integrity rules.&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;1. &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;Entity Integrity: States that &amp;quot;Primary key cannot have NULL value&amp;quot;&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;2. &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;Referential Integrity: States that &amp;quot;Foreign Key can be either a NULL value or should be Primary Key value of other relation.&amp;quot;</description>
<category>SQL Server Interview Questions and Answers</category>
<guid isPermaLink="true">http://prepare4interview.com/19/define-the-integrity-rules#a1345</guid>
<pubDate>Fri, 17 Sep 2010 07:41:03 +0000</pubDate>
</item>
<item>
<title>Answered: Difference between cross join and Full outer join</title>
<link>http://prepare4interview.com/957/difference-between-cross-join-and-full-outer-join#a1343</link>
<description>Full Outer Join:&lt;br /&gt;
-------------------&lt;br /&gt;
Full outer join returns all the rows from both left and right joined tables. If there is any match missing from the left table then it returns null column values for left side table and if there is any match missing from right table then it returns null value columns for the right side table.&lt;br /&gt;
&lt;br /&gt;
Cross Join:&lt;br /&gt;
-------------------&lt;br /&gt;
Cross join works as a Cartesian product of rows for both left and right table. It combined each row of left table with all the rows of right table.</description>
<category>SQL Server Interview Questions and Answers</category>
<guid isPermaLink="true">http://prepare4interview.com/957/difference-between-cross-join-and-full-outer-join#a1343</guid>
<pubDate>Thu, 16 Sep 2010 08:27:09 +0000</pubDate>
</item>
<item>
<title>Answered: Explain the purposes of OPENXML clause sql server stored procedure</title>
<link>http://prepare4interview.com/959/explain-the-purposes-openxml-clause-server-stored-procedure#a1342</link>
<description>OPENXML, a Transact-SQL keyword, provides a rowset over in-memory XML documents that is similar to a table or a view. OPENXML allows access to XML data as though it is a relational rowset. It does this by providing a rowset view of the internal representation of an XML document. The records in the rowset can be stored in database tables. &lt;br /&gt;
&lt;br /&gt;
OPENXML can be used in SELECT and SELECT INTO statements wherever rowset providers, a view, or OPENROWSET can appear as the source. For information about the syntax of OPENXML, see OPENXML (Transact-SQL).&lt;br /&gt;
&lt;br /&gt;
To write queries against an XML document by using OPENXML, you must first call sp_xml_preparedocument. This parses the XML document and returns a handle to the parsed document that is ready for consumption. The parsed document is a document object model (DOM) tree representation of various nodes in the XML document. The document handle is passed to OPENXML. OPENXML then provides a rowset view of the document, based on the parameters passed to it.</description>
<category>SQL Server Interview Questions and Answers</category>
<guid isPermaLink="true">http://prepare4interview.com/959/explain-the-purposes-openxml-clause-server-stored-procedure#a1342</guid>
<pubDate>Thu, 16 Sep 2010 07:50:20 +0000</pubDate>
</item>
<item>
<title>Answered: What is the order in which the SQL query is executed?</title>
<link>http://prepare4interview.com/961/what-is-the-order-in-which-the-sql-query-is-executed#a1341</link>
<description>All SQL statements have to go through the following stages:&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;* &amp;nbsp;&amp;nbsp;Parse: Every SQL statement must be parsed. Parsing the statement includes checking the statement's syntax and validating the statement, ensuring that all references to objects are correct, and ensuring that relevant privileges to those objects exist.&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;* &amp;nbsp;&amp;nbsp;Bind: After parsing, the Oracle server knows the meaning of the Oracle statement but still may not have enough information to execute the statement. Therefore, the Oracle server may need values for any bind variable in the statement. The process of obtaining these values is called binding variables.&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;* &amp;nbsp;&amp;nbsp;Execute: After binding variables, the Oracle server has all the necessary information and resources. At this point, the Oracle server executes the statement.&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;* &amp;nbsp;&amp;nbsp;Fetch: In the fetch stage, rows are selected and ordered (if requested by the query), and each successive row retrieves another row of the result until the last row has been fetched. Queries (SELECT statements) can be fetched, but other DML statements cannot be fetched.</description>
<category>SQL Server Interview Questions and Answers</category>
<guid isPermaLink="true">http://prepare4interview.com/961/what-is-the-order-in-which-the-sql-query-is-executed#a1341</guid>
<pubDate>Thu, 16 Sep 2010 07:46:02 +0000</pubDate>
</item>
<item>
<title>Answered: What are the benefits of SQL Server User-Defined Functions?</title>
<link>http://prepare4interview.com/970/what-are-the-benefits-of-sql-server-user-defined-functions#a1340</link>
<description>Execution Within the SELECT Statement&lt;br /&gt;
---------------------------&lt;br /&gt;
UDFs are executed within an inline query; for instance, you can call a scalar UDF that calculates the number of business days between two dates, as follows:&lt;br /&gt;
SELECT dbo.no_of_business_days(date1, date2)&lt;br /&gt;
&lt;br /&gt;
Execution from Various Parts of SQL Statements&lt;br /&gt;
---------------------------&lt;br /&gt;
Scalar UDFs can be called from within the WHERE/HAVING clause of queries or even within a SET list of the UPDATE statement. In case statements also we can call UDF.&lt;br /&gt;
&lt;br /&gt;
UDF Output Can Be Used as a Rowset&lt;br /&gt;
---------------------------&lt;br /&gt;
UDFs that return tables can be treated as another rowset. Thus, you can join other tables within your code module to the output of a UDF.&lt;br /&gt;
&lt;br /&gt;
UDFs as Parameterized Views&lt;br /&gt;
---------------------------&lt;br /&gt;
In-line UDFs can be thought of as views that accept parameters. This flavor of UDFs can be used effectively to return different data from the same tables based on the parameter values.&lt;br /&gt;
&lt;br /&gt;
Multi-Statement Functions: Alternatives to Stored Procedures&lt;br /&gt;
---------------------------&lt;br /&gt;
Multi-statement functions allow you to perform additional logic, such as variable declaration, populating of table variables, and updating values within it, looping through records and more. Multi-statement functions are a great way to rewrite a stored procedure if the following conditions are true: &lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;* &amp;nbsp;&amp;nbsp;The output of the stored procedure can be used by other routines.&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;* &amp;nbsp;&amp;nbsp;Stored procedures don't make any data changes in the permanent tables.&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;* &amp;nbsp;&amp;nbsp;The only purpose of the stored procedure is to create a result set that might have to be manipulated prior to returning it to the user.&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;* &amp;nbsp;&amp;nbsp;Stored procedures do not perform any tasks prohibited inside the UDFs (see the next section for details).</description>
<category>SQL Server Interview Questions and Answers</category>
<guid isPermaLink="true">http://prepare4interview.com/970/what-are-the-benefits-of-sql-server-user-defined-functions#a1340</guid>
<pubDate>Thu, 16 Sep 2010 07:33:23 +0000</pubDate>
</item>
<item>
<title>Answered: What is a candidate key?</title>
<link>http://prepare4interview.com/1197/what-is-a-candidate-key#a1339</link>
<description>CANDIDATE KEY&lt;br /&gt;
&lt;br /&gt;
A nominee's for primary key field are know as candidate key.</description>
<category>SQL Server Interview Questions and Answers</category>
<guid isPermaLink="true">http://prepare4interview.com/1197/what-is-a-candidate-key#a1339</guid>
<pubDate>Thu, 16 Sep 2010 05:50:14 +0000</pubDate>
</item>
<item>
<title>Answered: What are all of the backup options and their associated value?</title>
<link>http://prepare4interview.com/1266/what-are-all-of-the-backup-options-and-their-associated-value#a1337</link>
<description>File differential&lt;br /&gt;
-----------------------------&lt;br /&gt;
File differential backups can be combined with file/filegroup backups to back up only the modified extents within an SQL Server database file or filegroup. They are most useful for large, relatively static, databases and are often quicker to restore in cases where only certain file/filegroups are lost. File/filegroup differential backups are cumulative, so in order to restore the files in question you just need the latest differential backup and any transaction log backups performed after the latest file/filegroup differential.</description>
<category>SQL Server Interview Questions and Answers</category>
<guid isPermaLink="true">http://prepare4interview.com/1266/what-are-all-of-the-backup-options-and-their-associated-value#a1337</guid>
<pubDate>Thu, 16 Sep 2010 05:45:58 +0000</pubDate>
</item>
<item>
<title>Answered: What are some of the tools that you use to troubleshoot a SQL Server issue?</title>
<link>http://prepare4interview.com/1274/what-are-some-the-tools-that-you-troubleshoot-sql-server-issue#a1332</link>
<description>When you need to troubleshoot a problem, prior to SQL Server 2005 you have to depend upon PROFILER or query system tables constantly or some other means to trace the system usage.&lt;br /&gt;
&lt;br /&gt;
SQL Server 2005 onwards DBAs are equipped with Dynamic Management Views (and Data Mining Extenstions DMX for Analysis Services) for core database engine to obtain the snapshot of information on resource usage such as disk, cpu, memory and many more. The 2 types of DMVs are server-scoped &amp;amp; database scoped whics requires obvious elevated privileges to execute on that SQL instance.</description>
<category>SQL Server Interview Questions and Answers</category>
<guid isPermaLink="true">http://prepare4interview.com/1274/what-are-some-the-tools-that-you-troubleshoot-sql-server-issue#a1332</guid>
<pubDate>Wed, 15 Sep 2010 14:50:30 +0000</pubDate>
</item>
<item>
<title>Answered: How do you troubleshoot a SQL Server performance problem?</title>
<link>http://prepare4interview.com/1276/how-do-you-troubleshoot-a-sql-server-performance-problem#a1331</link>
<description>SQL Profiler trace log:&lt;br /&gt;
&lt;br /&gt;
The SQL Profiler trace captures the activity on the computer running SQL Server. You can use this information to identify slow running queries and non-optimal execution plans. Additionally, SQL Profiler documents the series of events that occur before the performance problem and helps to identify its cause.</description>
<category>SQL Server Interview Questions and Answers</category>
<guid isPermaLink="true">http://prepare4interview.com/1276/how-do-you-troubleshoot-a-sql-server-performance-problem#a1331</guid>
<pubDate>Wed, 15 Sep 2010 14:47:16 +0000</pubDate>
</item>
<item>
<title>Answered: As a Network Administrator, how can you help to prevent a SQL Injection attack?</title>
<link>http://prepare4interview.com/1280/network-administrator-you-help-prevent-sql-injection-attack#a1327</link>
<description>• &amp;nbsp;Encrypt sensitive data.&lt;br /&gt;
• &amp;nbsp;Access the database using an account with the least privileges necessary.&lt;br /&gt;
•Install the database using an account with the least privileges necessary.&lt;br /&gt;
• &amp;nbsp;Ensure that data is valid.&lt;br /&gt;
• &amp;nbsp;Do a code review to check for the possibility of second-order attacks.&lt;br /&gt;
• &amp;nbsp;Use parameterised queries.&lt;br /&gt;
• &amp;nbsp;Use stored procedures.&lt;br /&gt;
• &amp;nbsp;Re-validate data in stored procedures.&lt;br /&gt;
• &amp;nbsp;Ensure that error messages give nothing away about the internal architecture of the application or the database.</description>
<category>SQL Server Interview Questions and Answers</category>
<guid isPermaLink="true">http://prepare4interview.com/1280/network-administrator-you-help-prevent-sql-injection-attack#a1327</guid>
<pubDate>Wed, 15 Sep 2010 14:40:58 +0000</pubDate>
</item>
<item>
<title>Can tables be over indexed? What are the performance implications?</title>
<link>http://prepare4interview.com/1300/tables-over-indexed-what-are-the-performance-implications</link>
<description></description>
<category>SQL Server Interview Questions and Answers</category>
<guid isPermaLink="true">http://prepare4interview.com/1300/tables-over-indexed-what-are-the-performance-implications</guid>
<pubDate>Thu, 09 Sep 2010 13:51:45 +0000</pubDate>
</item>
<item>
<title>What are the different indexing options available and what columns do you typically index?</title>
<link>http://prepare4interview.com/1298/different-indexing-options-available-columns-typically-index</link>
<description>What are the different indexing options available and what columns do you typically index? &amp;nbsp;What is the value of indexing columns?</description>
<category>SQL Server Interview Questions and Answers</category>
<guid isPermaLink="true">http://prepare4interview.com/1298/different-indexing-options-available-columns-typically-index</guid>
<pubDate>Thu, 09 Sep 2010 13:50:46 +0000</pubDate>
</item>
<item>
<title>What are some options to randomly capture a value from a column in a table?</title>
<link>http://prepare4interview.com/1296/what-some-options-randomly-capture-value-from-column-table</link>
<description></description>
<category>SQL Server Interview Questions and Answers</category>
<guid isPermaLink="true">http://prepare4interview.com/1296/what-some-options-randomly-capture-value-from-column-table</guid>
<pubDate>Thu, 09 Sep 2010 13:48:21 +0000</pubDate>
</item>
<item>
<title>Name 3 or more aggregate functions and the value they provide in your coding.</title>
<link>http://prepare4interview.com/1294/name-more-aggregate-functions-value-they-provide-your-coding</link>
<description></description>
<category>SQL Server Interview Questions and Answers</category>
<guid isPermaLink="true">http://prepare4interview.com/1294/name-more-aggregate-functions-value-they-provide-your-coding</guid>
<pubDate>Thu, 09 Sep 2010 13:47:16 +0000</pubDate>
</item>
<item>
<title>How do you code error handling logic in your stored procedures?</title>
<link>http://prepare4interview.com/1292/how-do-you-code-error-handling-logic-your-stored-procedures</link>
<description></description>
<category>SQL Server Interview Questions and Answers</category>
<guid isPermaLink="true">http://prepare4interview.com/1292/how-do-you-code-error-handling-logic-your-stored-procedures</guid>
<pubDate>Thu, 09 Sep 2010 13:45:46 +0000</pubDate>
</item>
<item>
<title>What is the difference between DDL and DML commands?  Can you name some examples of each?</title>
<link>http://prepare4interview.com/1290/what-difference-between-commands-you-name-some-examples-each</link>
<description></description>
<category>SQL Server Interview Questions and Answers</category>
<guid isPermaLink="true">http://prepare4interview.com/1290/what-difference-between-commands-you-name-some-examples-each</guid>
<pubDate>Thu, 09 Sep 2010 13:44:25 +0000</pubDate>
</item>
<item>
<title>What is an identity?  What is the value?  How can you capture the last identity value per column?</title>
<link>http://prepare4interview.com/1288/what-identity-what-value-capture-last-identity-value-column</link>
<description></description>
<category>SQL Server Interview Questions and Answers</category>
<guid isPermaLink="true">http://prepare4interview.com/1288/what-identity-what-value-capture-last-identity-value-column</guid>
<pubDate>Thu, 09 Sep 2010 13:41:33 +0000</pubDate>
</item>
<item>
<title>What is the importance of primary keys and foreign keys in a SQL Server OLTP database design?</title>
<link>http://prepare4interview.com/1286/importance-primary-foreign-keys-server-oltp-database-design</link>
<description></description>
<category>SQL Server Interview Questions and Answers</category>
<guid isPermaLink="true">http://prepare4interview.com/1286/importance-primary-foreign-keys-server-oltp-database-design</guid>
<pubDate>Thu, 09 Sep 2010 13:39:39 +0000</pubDate>
</item>
<item>
<title>What are some of the hardware advances that can benefit SQL Server?</title>
<link>http://prepare4interview.com/1284/what-are-some-hardware-advances-that-can-benefit-sql-server</link>
<description></description>
<category>SQL Server Interview Questions and Answers</category>
<guid isPermaLink="true">http://prepare4interview.com/1284/what-are-some-hardware-advances-that-can-benefit-sql-server</guid>
<pubDate>Wed, 08 Sep 2010 09:55:08 +0000</pubDate>
</item>
<item>
<title>In general, how would you design the drive layout for a SQL Server?</title>
<link>http://prepare4interview.com/1282/general-how-would-you-design-the-drive-layout-for-sql-server</link>
<description></description>
<category>SQL Server Interview Questions and Answers</category>
<guid isPermaLink="true">http://prepare4interview.com/1282/general-how-would-you-design-the-drive-layout-for-sql-server</guid>
<pubDate>Wed, 08 Sep 2010 09:49:02 +0000</pubDate>
</item>
<item>
<title>As a Network Administrator, which components of SQL Server do you want to secure?</title>
<link>http://prepare4interview.com/1278/network-administrator-which-components-server-want-secure</link>
<description></description>
<category>SQL Server Interview Questions and Answers</category>
<guid isPermaLink="true">http://prepare4interview.com/1278/network-administrator-which-components-server-want-secure</guid>
<pubDate>Wed, 08 Sep 2010 09:45:47 +0000</pubDate>
</item>
<item>
<title>What high availability options are available with SQL Server and what sort of functionality do they provide?</title>
<link>http://prepare4interview.com/1268/availability-options-available-server-functionality-provide</link>
<description></description>
<category>SQL Server Interview Questions and Answers</category>
<guid isPermaLink="true">http://prepare4interview.com/1268/availability-options-available-server-functionality-provide</guid>
<pubDate>Wed, 08 Sep 2010 09:36:15 +0000</pubDate>
</item>
</channel>
</rss>
