<?xml version='1.0' encoding='UTF-8'?><?xml-stylesheet href="http://www.blogger.com/styles/atom.css" type="text/css"?><feed xmlns='http://www.w3.org/2005/Atom' xmlns:openSearch='http://a9.com/-/spec/opensearchrss/1.0/' xmlns:blogger='http://schemas.google.com/blogger/2008' xmlns:georss='http://www.georss.org/georss' xmlns:gd="http://schemas.google.com/g/2005" xmlns:thr='http://purl.org/syndication/thread/1.0'><id>tag:blogger.com,1999:blog-557833918731583301</id><updated>2024-08-30T08:16:06.286-07:00</updated><category term="T-SQL"/><category term="SSIS"/><category term="SSRS"/><category term="SSRS Videos"/><category term="T-SQL Videos"/><title type='text'>Pro Programmer</title><subtitle type='html'></subtitle><link rel='http://schemas.google.com/g/2005#feed' type='application/atom+xml' href='http://sqlforever.blogspot.com/feeds/posts/default'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/557833918731583301/posts/default?redirect=false'/><link rel='alternate' type='text/html' href='http://sqlforever.blogspot.com/'/><link rel='hub' href='http://pubsubhubbub.appspot.com/'/><link rel='next' type='application/atom+xml' href='http://www.blogger.com/feeds/557833918731583301/posts/default?start-index=26&amp;max-results=25&amp;redirect=false'/><author><name>Anonymous</name><uri>http://www.blogger.com/profile/13522571212403373919</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><generator version='7.00' uri='http://www.blogger.com'>Blogger</generator><openSearch:totalResults>97</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>25</openSearch:itemsPerPage><entry><id>tag:blogger.com,1999:blog-557833918731583301.post-4068117565713019080</id><published>2012-10-31T13:06:00.000-07:00</published><updated>2012-10-31T13:07:15.538-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="SSRS Videos"/><title type='text'>SQL SERVER REPORTING SERVICES: Create report without wizard; Manually</title><content type='html'>&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;iframe allowfullscreen=&#39;allowfullscreen&#39; webkitallowfullscreen=&#39;webkitallowfullscreen&#39; mozallowfullscreen=&#39;mozallowfullscreen&#39; width=&#39;320&#39; height=&#39;266&#39; src=&#39;https://www.youtube.com/embed/MdHmbY1NjkM?feature=player_embedded&#39; frameborder=&#39;0&#39;&gt;&lt;/iframe&gt;&lt;/div&gt;
&lt;br /&gt;</content><link rel='replies' type='application/atom+xml' href='http://sqlforever.blogspot.com/feeds/4068117565713019080/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://sqlforever.blogspot.com/2012/10/sql-server-reporting-services-create.html#comment-form' title='3 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/557833918731583301/posts/default/4068117565713019080'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/557833918731583301/posts/default/4068117565713019080'/><link rel='alternate' type='text/html' href='http://sqlforever.blogspot.com/2012/10/sql-server-reporting-services-create.html' title='SQL SERVER REPORTING SERVICES: Create report without wizard; Manually'/><author><name>Anonymous</name><uri>http://www.blogger.com/profile/13522571212403373919</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>3</thr:total></entry><entry><id>tag:blogger.com,1999:blog-557833918731583301.post-6261817814728287342</id><published>2012-10-14T23:46:00.002-07:00</published><updated>2012-10-31T13:07:15.539-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="SSRS Videos"/><title type='text'>Intro to SSRS: How to Create a Basic Report</title><content type='html'>&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;object width=&quot;320&quot; height=&quot;266&quot; class=&quot;BLOGGER-youtube-video&quot; classid=&quot;clsid:D27CDB6E-AE6D-11cf-96B8-444553540000&quot; codebase=&quot;http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0&quot; data-thumbnail-src=&quot;http://2.gvt0.com/vi/sIhqswPE9_o/0.jpg&quot;&gt;&lt;param name=&quot;movie&quot; value=&quot;http://www.youtube.com/v/sIhqswPE9_o&amp;fs=1&amp;source=uds&quot; /&gt;&lt;param name=&quot;bgcolor&quot; value=&quot;#FFFFFF&quot; /&gt;&lt;param name=&quot;allowFullScreen&quot; value=&quot;true&quot; /&gt;&lt;embed width=&quot;320&quot; height=&quot;266&quot;  src=&quot;http://www.youtube.com/v/sIhqswPE9_o&amp;fs=1&amp;source=uds&quot; type=&quot;application/x-shockwave-flash&quot; allowfullscreen=&quot;true&quot;&gt;&lt;/embed&gt;&lt;/object&gt;&lt;/div&gt;
&lt;strong&gt;&lt;/strong&gt;&lt;br /&gt;
Subscribe--&amp;gt;&amp;nbsp; &lt;a href=&quot;http://www.youtube.com/channel/UC_PSpWm9sw6YbcDXQDmLB2A?feature=mhee&quot;&gt;http://www.youtube.com/channel/UC_PSpWm9sw6YbcDXQDmLB2A?feature=mhee&lt;/a&gt;</content><link rel='replies' type='application/atom+xml' href='http://sqlforever.blogspot.com/feeds/6261817814728287342/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://sqlforever.blogspot.com/2012/10/intro-to-ssrs-how-to-create-basic-report.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/557833918731583301/posts/default/6261817814728287342'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/557833918731583301/posts/default/6261817814728287342'/><link rel='alternate' type='text/html' href='http://sqlforever.blogspot.com/2012/10/intro-to-ssrs-how-to-create-basic-report.html' title='Intro to SSRS: How to Create a Basic Report'/><author><name>Anonymous</name><uri>http://www.blogger.com/profile/13522571212403373919</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-557833918731583301.post-2244233915600004222</id><published>2012-09-06T08:16:00.000-07:00</published><updated>2012-09-06T08:16:24.761-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="T-SQL"/><title type='text'>Performance Tuning of Stored Procedures</title><content type='html'>&lt;a href=&quot;http://blog.sqlauthority.com/2010/02/16/sql-server-stored-procedure-optimization-tips-best-practices/&quot;&gt;&lt;span style=&quot;font-size: x-small;&quot;&gt;http://blog.sqlauthority.com/2010/02/16/sql-server-stored-procedure-optimization-tips-best-practices/&lt;/span&gt;&lt;/a&gt;&lt;br /&gt;
&lt;span style=&quot;font-size: x-small;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-size: x-small;&quot;&gt;&lt;strong&gt;Include SET NOCOUNT ON statement:&lt;/strong&gt; With every SELECT and DML statement, the SQL server returns a message that indicates the number of affected rows by that statement. This information is mostly helpful in debugging the code, but it is useless after that. By setting SET NOCOUNT ON, we can disable the feature of returning this extra information. For stored procedures that contain several statements or contain Transact-SQL loops, &lt;strong&gt;&lt;em&gt;setting SET NOCOUNT to ON can provide a significant performance boost because network traffic is greatly reduced.&lt;/em&gt;&lt;/strong&gt;&lt;/span&gt;&lt;br /&gt;
&lt;strong&gt;&lt;em&gt;&lt;/em&gt;&lt;/strong&gt;&lt;span style=&quot;font-size: x-small;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-size: x-small;&quot;&gt;&lt;strong&gt;Use schema name with object name:&lt;/strong&gt; The object name is qualified if used with schema name. Schema name should be used with the stored procedure name and with all objects referenced inside the stored procedure. This help in directly finding the complied plan instead of searching the objects in other possible schema before finally deciding to use a cached plan, if available. This process of searching and deciding a schema for an object leads to COMPILE lock on stored procedure and decreases the stored procedure’s performance. &lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-size: x-small;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-size: x-small;&quot;&gt;&lt;strong&gt;Try to avoid using SQL Server cursors whenever possible:&lt;/strong&gt; Cursor uses a lot of resources for overhead processing to maintain current record position in a recordset and this decreases the performance. If we need to process records one-by-one in a loop, then we should use the WHILE clause. Wherever possible, we should replace the cursor-based approach with SET-based approach. Because the SQL Server engine is designed and optimized to perform SET-based operation very fast.&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-size: x-small;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-size: x-small;&quot;&gt;&lt;strong&gt;Keep the Transaction as short as possible:&lt;/strong&gt; The length of transaction affects blocking and deadlocking. In some cases, blocking also converts into deadlocks. So, for faster execution and less blocking, the transaction should be kept as short as possible.&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-size: x-small;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;br /&gt;
&lt;strong&gt;&lt;span style=&quot;font-size: x-small;&quot;&gt;Use TRY-Catch for error handling&lt;/span&gt;&lt;/strong&gt;&lt;br /&gt;
&lt;strong&gt;&lt;/strong&gt;&lt;span style=&quot;font-size: x-small;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-size: x-small;&quot;&gt;&lt;strong&gt;Do not use the prefix “sp_” in the stored procedure name&lt;/strong&gt;: If a stored procedure name begins with “SP_,” then SQL server first searches in the master database and then in the current session database. Searching in the master database causes extra overhead and even a wrong result if another stored procedure with the same name is found in master database.&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-size: x-small;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-size: x-small;&quot;&gt;&lt;strong&gt;Use IF EXISTS (SELECT 1) instead of (SELECT *):&lt;/strong&gt; To check the existence of a record in another table, we uses the IF EXISTS clause. The IF EXISTS clause returns True if any value is returned from an internal statement, either a single value “1” or all columns of a record or complete recordset. The output of the internal statement is not used. Hence, to minimize the data for processing and network transferring, we should use “1” in the SELECT clause of an internal statement, as shown below:&lt;/span&gt;&lt;br /&gt;
&lt;div style=&quot;padding-left: 60px; text-align: justify;&quot;&gt;
&lt;code&gt;&lt;span style=&quot;font-size: x-small;&quot;&gt;&lt;span style=&quot;color: blue;&quot;&gt;IF &lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;EXISTS (&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;SELECT &lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;1 &lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;FROM &lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-size: x-small;&quot;&gt;&lt;span style=&quot;color: black;&quot;&gt;sysobjects&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;WHERE &lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;name &lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;= &lt;/span&gt;&lt;span style=&quot;color: red;&quot;&gt;&#39;MyTable&#39; &lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;AND &lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;type &lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;= &lt;/span&gt;&lt;span style=&quot;color: red;&quot;&gt;&#39;U&#39;&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;)&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;span style=&quot;font-size: x-small;&quot;&gt; &lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;padding-left: 60px; text-align: justify;&quot;&gt;
&lt;strong&gt;&lt;span style=&quot;font-size: x-small;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;/strong&gt;&lt;/div&gt;
&lt;span style=&quot;font-size: x-small;&quot;&gt;&lt;strong&gt;Use the sp_executesql stored procedure instead of the EXECUTE statement.&lt;/strong&gt;&lt;br /&gt;The sp_executesql stored procedure supports parameters. So, using the sp_executesql stored procedure instead of the EXECUTE statement improve the re-usability of your code. The execution plan of a dynamic statement can be reused only if each and every character, including case, space, comments and parameter, is same for two statements.&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-size: x-small;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-size: x-small;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-size: x-small;&quot;&gt;&amp;nbsp;&lt;/span&gt;</content><link rel='replies' type='application/atom+xml' href='http://sqlforever.blogspot.com/feeds/2244233915600004222/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://sqlforever.blogspot.com/2012/09/performance-tuning-of-stored-procedures.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/557833918731583301/posts/default/2244233915600004222'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/557833918731583301/posts/default/2244233915600004222'/><link rel='alternate' type='text/html' href='http://sqlforever.blogspot.com/2012/09/performance-tuning-of-stored-procedures.html' title='Performance Tuning of Stored Procedures'/><author><name>Anonymous</name><uri>http://www.blogger.com/profile/13522571212403373919</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-557833918731583301.post-4588022263324751385</id><published>2012-08-30T23:51:00.003-07:00</published><updated>2012-08-31T00:11:59.863-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="SSIS"/><title type='text'>Custom Auditing Vs Logging</title><content type='html'>&lt;strong&gt;Logging&lt;/strong&gt; is&amp;nbsp;basically used for&amp;nbsp;capturing information about package execution itself - errors encountered, execution time for the package or steps within the package, data flow buffer &lt;br /&gt;
details, etc. &lt;strong&gt;Auditing&lt;/strong&gt; is typically information about the data - how many records inserted, &lt;br /&gt;
updated, and deleted; when it was done; what was the source; who ran the package; what &lt;br /&gt;
machine did it run on, etc.</content><link rel='replies' type='application/atom+xml' href='http://sqlforever.blogspot.com/feeds/4588022263324751385/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://sqlforever.blogspot.com/2012/08/custom-auditing-vs-logging.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/557833918731583301/posts/default/4588022263324751385'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/557833918731583301/posts/default/4588022263324751385'/><link rel='alternate' type='text/html' href='http://sqlforever.blogspot.com/2012/08/custom-auditing-vs-logging.html' title='Custom Auditing Vs Logging'/><author><name>Anonymous</name><uri>http://www.blogger.com/profile/13522571212403373919</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-557833918731583301.post-4333341249838655736</id><published>2012-08-25T16:58:00.003-07:00</published><updated>2012-08-25T16:58:37.109-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="T-SQL"/><title type='text'>Eliminate KEY LOOKUP</title><content type='html'>&lt;a href=&quot;http://sqlserverperformance.wordpress.com/2010/06/09/how-to-eliminate-key-lookups-in-sql-server-2008/&quot;&gt;Eliminate Key Lookup&lt;/a&gt;</content><link rel='replies' type='application/atom+xml' href='http://sqlforever.blogspot.com/feeds/4333341249838655736/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://sqlforever.blogspot.com/2012/08/eliminate-key-lookup.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/557833918731583301/posts/default/4333341249838655736'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/557833918731583301/posts/default/4333341249838655736'/><link rel='alternate' type='text/html' href='http://sqlforever.blogspot.com/2012/08/eliminate-key-lookup.html' title='Eliminate KEY LOOKUP'/><author><name>Anonymous</name><uri>http://www.blogger.com/profile/13522571212403373919</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-557833918731583301.post-668020637345147232</id><published>2012-08-25T16:53:00.003-07:00</published><updated>2012-08-25T16:53:54.997-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="T-SQL"/><title type='text'></title><content type='html'>&lt;strong&gt;Nested Loop&lt;/strong&gt;&lt;br /&gt;
The nested loop join works by looping through all the rows of one input and for each row looping through all the rows of the other input, looking for matches. The nested loop join works best when one or both of the input row sets is small. Since the input that is chosen as the second is read as many times as there are rows in the outer, this join can get very expensive as the size of the inputs increases.&lt;br /&gt;
For more detail on the nested loop,  see &lt;a href=&quot;http://blogs.msdn.com/craigfr/archive/2006/07/26/679319.aspx&quot;&gt;Craig Freedman’s post&lt;/a&gt;&lt;br /&gt;
&lt;strong&gt;Merge Join &lt;/strong&gt;&lt;br /&gt;
The merge join works by running through the two inputs, comparing rows and outputting matched rows. Both inputs must be sorted on the joining  columns for this join to be possible. Since both inputs are only read once, this is an efficient join for larger row sets. This efficiency may be offset by the sorted requirement. If the join column is not indexed so as to retrieve the data already sorted, then an explicit sort is required.&lt;br /&gt;
For more detail on the merge join,  see &lt;a href=&quot;http://blogs.msdn.com/craigfr/archive/2006/08/03/687584.aspx&quot;&gt;Craig Freedman’s post&lt;/a&gt;&lt;br /&gt;
&lt;strong&gt;Hash Join&lt;/strong&gt;&lt;br /&gt;
The hash join is one of the more expensive join operations, as it requires the creation of a hash table to do the join. That said, it’s the join that’s best for large, unsorted inputs. It is the most memory-intensive of any of the joins&lt;br /&gt;
The hash join first reads one of the inputs and hashes the join column and puts the resulting hash and the column values into a hash table built up in memory. Then it reads all the rows in the second input, hashes those and checks the rows in the resulting hash bucket for the joining rows.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;em&gt;Copied from &lt;a href=&quot;http://sqlinthewild.co.za/index.php/2007/12/30/execution-plan-operations-joins/&quot;&gt;SQL In The Wild&lt;/a&gt;&lt;/em&gt;</content><link rel='replies' type='application/atom+xml' href='http://sqlforever.blogspot.com/feeds/668020637345147232/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://sqlforever.blogspot.com/2012/08/nested-loop-nested-loop-join-works-by.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/557833918731583301/posts/default/668020637345147232'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/557833918731583301/posts/default/668020637345147232'/><link rel='alternate' type='text/html' href='http://sqlforever.blogspot.com/2012/08/nested-loop-nested-loop-join-works-by.html' title=''/><author><name>Anonymous</name><uri>http://www.blogger.com/profile/13522571212403373919</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-557833918731583301.post-4602570941268231146</id><published>2012-08-25T16:49:00.000-07:00</published><updated>2012-08-25T16:49:19.439-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="T-SQL"/><title type='text'>Covering Index VS Composite Index</title><content type='html'>&lt;strong&gt;&lt;u&gt;Composite index&lt;/u&gt;&lt;/strong&gt;: An index that contains more than one column. In both SQL Server 2005 or higher, you can include up to 16 columns in an index, as long as the index doesn’t exceed the 900 byte limit. Both clustered and nonclustered indexes can be composite indexes. &lt;br /&gt; &lt;br /&gt;&lt;u&gt;&lt;b&gt;Covering index&lt;/b&gt;&lt;/u&gt;: A type of index that includes all the columns that are needed to process a particular query. For example, your query might retrieve the FirstName and LastName columns from a table, based on a value in the ContactID column. You can create a covering index that includes all three columns. &lt;br /&gt;
&lt;br /&gt;
If an index has &lt;strong&gt;more than a column&lt;/strong&gt; in it, it is called a &lt;strong&gt;composite index&lt;/strong&gt;.  There is no KEYWORD associated with it. &lt;strong&gt;&lt;a href=&quot;http://sqlserverpedia.com/wiki/Wide_Index_Performance&quot;&gt;The best performing indexes are narrow with good selectivity&lt;/a&gt;&lt;/strong&gt;.&lt;br /&gt;&lt;br /&gt;A table can have maximum &lt;strong&gt;1 clustered index&lt;/strong&gt; since the data is layed out according to this index. The leaf level of the B-TREE is the data pages. One application is range searches. &lt;strong&gt;The INT IDENTITY(1,1) PRIMARY KEY is usually the clustered index.&lt;/strong&gt;&lt;br /&gt;A table can have 0 or &lt;strong&gt;more non-clustered indexes&lt;/strong&gt;.&lt;br /&gt;&lt;br /&gt;An index can &lt;strong&gt;include&lt;/strong&gt; non-key columns. It is called a &lt;strong&gt;&lt;a href=&quot;http://www.sql-server-performance.com/tips/covering_indexes_p1.aspx&quot;&gt;covering index&lt;/a&gt;&lt;/strong&gt; if It has all the columns needed to run certain queries. </content><link rel='replies' type='application/atom+xml' href='http://sqlforever.blogspot.com/feeds/4602570941268231146/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://sqlforever.blogspot.com/2012/08/covering-index-vs-composite-index.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/557833918731583301/posts/default/4602570941268231146'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/557833918731583301/posts/default/4602570941268231146'/><link rel='alternate' type='text/html' href='http://sqlforever.blogspot.com/2012/08/covering-index-vs-composite-index.html' title='Covering Index VS Composite Index'/><author><name>Anonymous</name><uri>http://www.blogger.com/profile/13522571212403373919</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-557833918731583301.post-4081163918564531691</id><published>2012-08-25T16:23:00.002-07:00</published><updated>2012-08-25T16:24:59.334-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="T-SQL"/><title type='text'>Union, Union All, Except, and Intersect</title><content type='html'>

&lt;br /&gt;
&lt;ul style=&quot;margin-top: 0in;&quot; type=&quot;disc&quot;&gt;
&lt;li class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin: 0in 0in 0pt; mso-list: l0 level1 lfo1; tab-stops: list .5in;&quot;&gt;&lt;b style=&quot;mso-bidi-font-weight: normal;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;Arial&amp;quot;,&amp;quot;sans-serif&amp;quot;; font-size: 8pt; mso-fareast-font-family: &amp;quot;Times New Roman&amp;quot;;&quot;&gt;The UNION operator combines the
     output of two query expressions into a single result set. Query
     expressions are executed independently, and their output is combined into
     a single result table. &lt;/span&gt;&lt;/b&gt;&lt;/li&gt;
&lt;li class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin: 0in 0in 0pt; mso-list: l0 level1 lfo1; tab-stops: list .5in;&quot;&gt;&lt;b style=&quot;mso-bidi-font-weight: normal;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;Arial&amp;quot;,&amp;quot;sans-serif&amp;quot;; font-size: 8pt; mso-fareast-font-family: &amp;quot;Times New Roman&amp;quot;;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;Arial&amp;quot;,&amp;quot;sans-serif&amp;quot;; font-size: 8pt; mso-effects-shadow-align: none; mso-effects-shadow-alpha: 65.0%; mso-effects-shadow-angledirection: 5400000; mso-effects-shadow-anglekx: 0; mso-effects-shadow-angleky: 0; mso-effects-shadow-color: black; mso-effects-shadow-dpidistance: 3.4pt; mso-effects-shadow-dpiradius: 5.5pt; mso-effects-shadow-pctsx: 0%; mso-effects-shadow-pctsy: 0%; mso-fareast-font-family: &amp;quot;Times New Roman&amp;quot;; mso-style-textoutline-outlinestyle-align: center; mso-style-textoutline-outlinestyle-compound: simple; mso-style-textoutline-outlinestyle-dash: solid; mso-style-textoutline-outlinestyle-dpiwidth: .075pt; mso-style-textoutline-outlinestyle-join: round; mso-style-textoutline-outlinestyle-linecap: flat; mso-style-textoutline-outlinestyle-pctmiterlimit: 0%; mso-style-textoutline-type: none;&quot;&gt;&lt;span class=&quot;msoIns&quot;&gt;&lt;ins&gt;&lt;span style=&quot;color: teal;&quot;&gt;The purpose of the SQL &lt;span style=&quot;mso-bidi-font-weight: bold;&quot;&gt;UNION ALL&lt;/span&gt; command is also to combine the results of two queries together. The difference between &lt;span style=&quot;mso-bidi-font-weight: bold;&quot;&gt;UNION ALL&lt;/span&gt; and &lt;span style=&quot;mso-bidi-font-weight: bold;&quot;&gt;UNION&lt;/span&gt; is that, while &lt;span style=&quot;mso-bidi-font-weight: bold;&quot;&gt;UNION&lt;/span&gt;only selects distinct values, &lt;span style=&quot;mso-bidi-font-weight: bold;&quot;&gt;UNION ALL&lt;/span&gt;selects all values.&lt;span style=&quot;font-family: &amp;quot;Arial&amp;quot;,&amp;quot;sans-serif&amp;quot;; font-size: 8pt; mso-effects-shadow-align: none; mso-effects-shadow-alpha: 65.0%; mso-effects-shadow-angledirection: 5400000; mso-effects-shadow-anglekx: 0; mso-effects-shadow-angleky: 0; mso-effects-shadow-color: black; mso-effects-shadow-dpidistance: 3.4pt; mso-effects-shadow-dpiradius: 5.5pt; mso-effects-shadow-pctsx: 0%; mso-effects-shadow-pctsy: 0%; mso-fareast-font-family: &amp;quot;Times New Roman&amp;quot;; mso-style-textoutline-outlinestyle-align: center; mso-style-textoutline-outlinestyle-compound: simple; mso-style-textoutline-outlinestyle-dash: solid; mso-style-textoutline-outlinestyle-dpiwidth: .075pt; mso-style-textoutline-outlinestyle-join: round; mso-style-textoutline-outlinestyle-linecap: flat; mso-style-textoutline-outlinestyle-pctmiterlimit: 0%; mso-style-textoutline-type: none;&quot;&gt;&lt;span class=&quot;msoIns&quot;&gt;&lt;ins&gt;&lt;span style=&quot;color: teal;&quot;&gt;The purpose of the SQL &lt;span style=&quot;mso-bidi-font-weight: bold;&quot;&gt;UNION ALL&lt;/span&gt; command is also to combine the results of two queries together. The difference between &lt;span style=&quot;mso-bidi-font-weight: bold;&quot;&gt;UNION ALL&lt;/span&gt; and &lt;span style=&quot;mso-bidi-font-weight: bold;&quot;&gt;UNION&lt;/span&gt; is that, while &lt;span style=&quot;mso-bidi-font-weight: bold;&quot;&gt;UNION&lt;/span&gt;only selects distinct values, &lt;span style=&quot;mso-bidi-font-weight: bold;&quot;&gt;UNION ALL&lt;/span&gt;selects all values.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/ins&gt;&lt;/span&gt;&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/ins&gt;&lt;/span&gt;&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/b&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;br /&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin: 0in 0in 0pt 43.5pt; mso-list: l0 level1 lfo1; tab-stops: list .5in; text-indent: -0.25in;&quot;&gt;
&lt;a href=&quot;http://www.blogger.com/null&quot; name=&quot;idx642&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://www.blogger.com/null&quot; name=&quot;idx643&quot;&gt;&lt;/a&gt;&lt;span style=&quot;font-family: Symbol; font-size: 10pt; mso-bidi-font-family: Symbol; mso-bidi-font-size: 8.0pt; mso-fareast-font-family: Symbol;&quot;&gt;&lt;span style=&quot;mso-list: Ignore;&quot;&gt;·&lt;span style=&quot;font-size-adjust: none; font-stretch: normal; font: 7pt/normal &amp;quot;Times New Roman&amp;quot;;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;b style=&quot;mso-bidi-font-weight: normal;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;Arial&amp;quot;,&amp;quot;sans-serif&amp;quot;; font-size: 8pt; mso-fareast-font-family: &amp;quot;Times New Roman&amp;quot;;&quot;&gt;The EXCEPT
operator evaluates the output of two query expressions and returns the
difference between the results. The result set contains all rows returned from
the first query expression except those rows that are also returned from the
second query expression. &lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin: 0in 0in 0pt 43.5pt; mso-list: l0 level1 lfo1; tab-stops: list .5in; text-indent: -0.25in;&quot;&gt;
&lt;a href=&quot;http://www.blogger.com/null&quot; name=&quot;idx644&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://www.blogger.com/null&quot; name=&quot;idx645&quot;&gt;&lt;/a&gt;&lt;span style=&quot;font-family: Symbol; font-size: 10pt; mso-bidi-font-family: Symbol; mso-bidi-font-size: 8.0pt; mso-fareast-font-family: Symbol;&quot;&gt;&lt;span style=&quot;mso-list: Ignore;&quot;&gt;·&lt;span style=&quot;font-size-adjust: none; font-stretch: normal; font: 7pt/normal &amp;quot;Times New Roman&amp;quot;;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;b style=&quot;mso-bidi-font-weight: normal;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;Arial&amp;quot;,&amp;quot;sans-serif&amp;quot;; font-size: 8pt; mso-fareast-font-family: &amp;quot;Times New Roman&amp;quot;;&quot;&gt;The INTERSECT
operator evaluates the output of two query expressions and returns only the rows
common to each.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;
&lt;br /&gt;


</content><link rel='replies' type='application/atom+xml' href='http://sqlforever.blogspot.com/feeds/4081163918564531691/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://sqlforever.blogspot.com/2012/08/union-union-all-except-and-intersect.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/557833918731583301/posts/default/4081163918564531691'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/557833918731583301/posts/default/4081163918564531691'/><link rel='alternate' type='text/html' href='http://sqlforever.blogspot.com/2012/08/union-union-all-except-and-intersect.html' title='Union, Union All, Except, and Intersect'/><author><name>Anonymous</name><uri>http://www.blogger.com/profile/13522571212403373919</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-557833918731583301.post-811487826967905341</id><published>2012-08-25T16:11:00.001-07:00</published><updated>2012-08-25T16:24:59.338-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="T-SQL"/><title type='text'>Group By (Rollup &amp; Cube &amp; Grouping Sets)</title><content type='html'>&lt;span style=&quot;color: black;&quot;&gt;&lt;em&gt;&lt;strong&gt;Rollup, CUBE, and Grouping Sets are all extensions of the Group By Clause.&lt;/strong&gt;&lt;/em&gt;&lt;/span&gt;&lt;br /&gt;
&lt;strong&gt;&lt;em&gt;&lt;/em&gt;&lt;/strong&gt;&lt;br /&gt;
&lt;hr /&gt;
The &lt;strong&gt;GROUP BY&lt;/strong&gt; clause can be used in a SELECT statement to collect data across multiple records and group the results by one or more columns.&lt;br /&gt;
&lt;br /&gt;
&lt;span style=&quot;color: black;&quot;&gt;&lt;code&gt;&lt;span style=&quot;font-family: &amp;quot;Arial&amp;quot;,&amp;quot;sans-serif&amp;quot;; font-size: 10pt; line-height: 115%; mso-fareast-font-family: &amp;quot;Times New Roman&amp;quot;; mso-fareast-theme-font: minor-fareast;&quot;&gt;&lt;strong&gt;ROLLUP&lt;/strong&gt;&lt;/span&gt;&lt;/code&gt;&lt;span style=&quot;font-family: &amp;quot;Arial&amp;quot;,&amp;quot;sans-serif&amp;quot;; font-size: 10pt; line-height: 115%;&quot;&gt; enables a &lt;code&gt;&lt;span style=&quot;font-family: &amp;quot;Arial&amp;quot;,&amp;quot;sans-serif&amp;quot;; mso-fareast-font-family: &amp;quot;Times New Roman&amp;quot;; mso-fareast-theme-font: minor-fareast;&quot;&gt;SELECT&lt;/span&gt;&lt;/code&gt; statement to calculate multiple levels of
subtotals across a specified group of dimensions. It also calculates a grand
total. &lt;code&gt;&lt;span style=&quot;font-family: &amp;quot;Arial&amp;quot;,&amp;quot;sans-serif&amp;quot;; mso-fareast-font-family: &amp;quot;Times New Roman&amp;quot;; mso-fareast-theme-font: minor-fareast;&quot;&gt;ROLLUP&lt;/span&gt;&lt;/code&gt; is
a simple extension to the &lt;code&gt;&lt;span style=&quot;font-family: &amp;quot;Arial&amp;quot;,&amp;quot;sans-serif&amp;quot;; mso-fareast-font-family: &amp;quot;Times New Roman&amp;quot;; mso-fareast-theme-font: minor-fareast;&quot;&gt;GROUP&lt;/span&gt;&lt;/code&gt;
&lt;code&gt;&lt;span style=&quot;font-family: &amp;quot;Arial&amp;quot;,&amp;quot;sans-serif&amp;quot;; mso-fareast-font-family: &amp;quot;Times New Roman&amp;quot;; mso-fareast-theme-font: minor-fareast;&quot;&gt;BY&lt;/span&gt;&lt;/code&gt;
clause, so its syntax is extremely easy to use. The &lt;code&gt;&lt;span style=&quot;font-family: &amp;quot;Arial&amp;quot;,&amp;quot;sans-serif&amp;quot;; mso-fareast-font-family: &amp;quot;Times New Roman&amp;quot;; mso-fareast-theme-font: minor-fareast;&quot;&gt;ROLLUP&lt;/span&gt;&lt;/code&gt; extension is highly
efficient, adding minimal overhead to a query. &lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: black;&quot;&gt;
&lt;code&gt;&lt;span style=&quot;font-family: &amp;quot;Arial&amp;quot;,&amp;quot;sans-serif&amp;quot;; font-size: 10pt; line-height: 115%; mso-fareast-font-family: &amp;quot;Times New Roman&amp;quot;; mso-fareast-theme-font: minor-fareast;&quot;&gt;&lt;/span&gt;&lt;/code&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: black;&quot;&gt;&lt;code&gt;&lt;span style=&quot;font-family: &amp;quot;Arial&amp;quot;,&amp;quot;sans-serif&amp;quot;; font-size: 10pt; line-height: 115%; mso-fareast-font-family: &amp;quot;Times New Roman&amp;quot;; mso-fareast-theme-font: minor-fareast;&quot;&gt;&lt;strong&gt;CUBE&lt;/strong&gt;&lt;/span&gt;&lt;/code&gt;&lt;span style=&quot;font-family: &amp;quot;Arial&amp;quot;,&amp;quot;sans-serif&amp;quot;; font-size: 10pt; line-height: 115%;&quot;&gt; enables a &lt;code&gt;&lt;span style=&quot;font-family: &amp;quot;Arial&amp;quot;,&amp;quot;sans-serif&amp;quot;; mso-fareast-font-family: &amp;quot;Times New Roman&amp;quot;; mso-fareast-theme-font: minor-fareast;&quot;&gt;SELECT&lt;/span&gt;&lt;/code&gt; statement to calculate subtotals for all
possible combinations of a group of dimensions. It also calculates a grand
total. This is the set of information typically needed for all cross-tabular
reports, so &lt;code&gt;&lt;span style=&quot;font-family: &amp;quot;Arial&amp;quot;,&amp;quot;sans-serif&amp;quot;; mso-fareast-font-family: &amp;quot;Times New Roman&amp;quot;; mso-fareast-theme-font: minor-fareast;&quot;&gt;CUBE&lt;/span&gt;&lt;/code&gt; can
calculate a cross-tabular report with a single &lt;code&gt;&lt;span style=&quot;font-family: &amp;quot;Arial&amp;quot;,&amp;quot;sans-serif&amp;quot;; mso-fareast-font-family: &amp;quot;Times New Roman&amp;quot;; mso-fareast-theme-font: minor-fareast;&quot;&gt;SELECT&lt;/span&gt;&lt;/code&gt; statement. Like &lt;code&gt;&lt;span style=&quot;font-family: &amp;quot;Arial&amp;quot;,&amp;quot;sans-serif&amp;quot;; mso-fareast-font-family: &amp;quot;Times New Roman&amp;quot;; mso-fareast-theme-font: minor-fareast;&quot;&gt;ROLLUP&lt;/span&gt;&lt;/code&gt;, &lt;code&gt;&lt;span style=&quot;font-family: &amp;quot;Arial&amp;quot;,&amp;quot;sans-serif&amp;quot;; mso-fareast-font-family: &amp;quot;Times New Roman&amp;quot;; mso-fareast-theme-font: minor-fareast;&quot;&gt;CUBE&lt;/span&gt;&lt;/code&gt; is a simple extension
to the &lt;code&gt;&lt;span style=&quot;font-family: &amp;quot;Arial&amp;quot;,&amp;quot;sans-serif&amp;quot;; mso-fareast-font-family: &amp;quot;Times New Roman&amp;quot;; mso-fareast-theme-font: minor-fareast;&quot;&gt;GROUP&lt;/span&gt;&lt;/code&gt; &lt;code&gt;&lt;span style=&quot;font-family: &amp;quot;Arial&amp;quot;,&amp;quot;sans-serif&amp;quot;; mso-fareast-font-family: &amp;quot;Times New Roman&amp;quot;; mso-fareast-theme-font: minor-fareast;&quot;&gt;BY&lt;/span&gt;&lt;/code&gt; clause, and its syntax
is also easy to learn. &lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: black;&quot;&gt;

&lt;/span&gt;&lt;br /&gt;
The GROUPING SETS operator can generate the same result set as that generated by using a simple GROUP BY, ROLLUP, or CUBE operator. When all the groupings that are generated by using a full ROLLUP or CUBE operator are not required, you can use GROUPING SETS to specify only the groupings that you want. The GROUPING SETS list can contain duplicate groupings; and, when GROUPING SETS is used with ROLLUP and CUBE, it might generate duplicate groupings. Duplicate groupings are retained as they would be by using UNION ALL.</content><link rel='replies' type='application/atom+xml' href='http://sqlforever.blogspot.com/feeds/811487826967905341/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://sqlforever.blogspot.com/2012/08/group-by-rollup-cube-grouping-sets.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/557833918731583301/posts/default/811487826967905341'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/557833918731583301/posts/default/811487826967905341'/><link rel='alternate' type='text/html' href='http://sqlforever.blogspot.com/2012/08/group-by-rollup-cube-grouping-sets.html' title='Group By (Rollup &amp; Cube &amp; Grouping Sets)'/><author><name>Anonymous</name><uri>http://www.blogger.com/profile/13522571212403373919</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-557833918731583301.post-1536488340302678859</id><published>2012-08-25T15:59:00.002-07:00</published><updated>2012-08-25T15:59:50.739-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="T-SQL"/><title type='text'>Cross Apply VS Outer Apply</title><content type='html'>

&lt;br /&gt;
&lt;h2 class=&quot;MsoListParagraph&quot; style=&quot;margin: 0in 0in 10pt 0.5in;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;Arial&amp;quot;,&amp;quot;sans-serif&amp;quot;; line-height: 115%;&quot;&gt;&lt;span style=&quot;font-size: small;&quot;&gt;The
APPLY operator is required when you have to use table-valued function in the
&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;Arial&amp;quot;,&amp;quot;sans-serif&amp;quot;; font-size: 8pt; line-height: 115%;&quot;&gt;&lt;span style=&quot;font-size: small;&quot;&gt;query, but it can also be used with an inline SELECT statements.&lt;/span&gt;&lt;/span&gt;&lt;/h2&gt;
&lt;h2 class=&quot;MsoListParagraph&quot; style=&quot;margin: 0in 0in 10pt 0.5in;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;Arial&amp;quot;,&amp;quot;sans-serif&amp;quot;; font-size: 8pt; line-height: 115%;&quot;&gt;&lt;span style=&quot;font-size: small;&quot;&gt;&lt;/span&gt;&lt;/span&gt;&amp;nbsp;&lt;/h2&gt;
&lt;h2 class=&quot;MsoListParagraph&quot; style=&quot;margin: 0in 0in 10pt 0.5in;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;Arial&amp;quot;,&amp;quot;sans-serif&amp;quot;; font-size: 8pt; line-height: 115%;&quot;&gt;&lt;span style=&quot;font-family: Times New Roman; font-size: small;&quot;&gt;

&lt;/span&gt;&lt;span&gt;&lt;span style=&quot;mso-list: Ignore;&quot;&gt;&lt;span style=&quot;font-size-adjust: none; font-stretch: normal; font: 7pt/normal &amp;quot;Times New Roman&amp;quot;;&quot;&gt;
&lt;/span&gt;&lt;/span&gt;The
CROSS APPLY operator returns only those rows from left table expression (in its
final output) if it matches with right table expression. In other words, the
right table expression returns rows for left table expression match only.
Whereas the OUTER APPLY operator returns all the rows from left table
expression irrespective of its match with the right table expression. For those
rows for which there are no corresponding matches in right table expression, it
contains NULL values in columns of right table expression. So you might now
conclude, the CROSS APPLY is semantically equivalent to INNER JOIN (or to be
more precise it’s like a CROSS JOIN with a correlated sub-query) with an
implicit join condition of 1=1 whereas OUTER APPLY is semantically equivalent
to LEFT OUTER JOIN.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;span style=&quot;font-family: Times New Roman; font-size: small;&quot;&gt;

&lt;/span&gt;&lt;/span&gt;&lt;/h2&gt;
&lt;br /&gt;
&lt;strong&gt;Cross Apply&lt;/strong&gt; returns only rows from the outer table that produces a result set from the table-valued function.&lt;br /&gt;
&lt;br /&gt;
&lt;strong&gt;Outer Apply&lt;/strong&gt; returns both rows that produce a result set and rows that do not, with NULL values in the columns produced by the table-valued function.</content><link rel='replies' type='application/atom+xml' href='http://sqlforever.blogspot.com/feeds/1536488340302678859/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://sqlforever.blogspot.com/2012/08/cross-apply-vs-outer-apply.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/557833918731583301/posts/default/1536488340302678859'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/557833918731583301/posts/default/1536488340302678859'/><link rel='alternate' type='text/html' href='http://sqlforever.blogspot.com/2012/08/cross-apply-vs-outer-apply.html' title='Cross Apply VS Outer Apply'/><author><name>Anonymous</name><uri>http://www.blogger.com/profile/13522571212403373919</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-557833918731583301.post-1378059831726361207</id><published>2012-08-25T15:28:00.000-07:00</published><updated>2012-08-25T15:28:52.860-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="T-SQL"/><title type='text'>RaiseError</title><content type='html'>&lt;span style=&quot;font-size: small;&quot;&gt;&lt;div align=&quot;LEFT&quot;&gt;
&lt;span style=&quot;background-color: #eeeeee; color: black;&quot;&gt;RaiseError generates an error message and initiates error processing for the system.&lt;/span&gt;&lt;/div&gt;
&lt;/span&gt;&lt;div align=&quot;LEFT&quot;&gt;
&lt;span style=&quot;color: black;&quot;&gt;&lt;span style=&quot;background-color: #eeeeee;&quot;&gt;&lt;span style=&quot;font-size: small;&quot;&gt;RaisEerror can either reference&amp;nbsp;defined message stored in the &lt;/span&gt;&lt;b&gt;&lt;span style=&quot;font-family: Calibri,Calibri; font-size: small;&quot;&gt;&lt;span style=&quot;font-family: Calibri,Calibri; font-size: small;&quot;&gt;sys.messages &lt;/span&gt;&lt;/span&gt;&lt;/b&gt;&lt;span style=&quot;font-family: Calibri,Calibri; font-size: small;&quot;&gt;&lt;span style=&quot;font-family: Calibri,Calibri; font-size: small;&quot;&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-size: small;&quot;&gt;catalogview or build a message dynamically. The message is returned as a server error message to the calling application or to an associated CATCH block of a TRY…ATCH construct. &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;span style=&quot;font-size: small;&quot;&gt;&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;img height=&quot;370&quot; id=&quot;il_fi&quot; src=&quot;http://sqljunkieshare.files.wordpress.com/2011/12/raise-error1.jpg%3Fw%3D692&quot; style=&quot;padding-bottom: 8px; padding-right: 8px; padding-top: 8px;&quot; width=&quot;521&quot; /&gt;</content><link rel='replies' type='application/atom+xml' href='http://sqlforever.blogspot.com/feeds/1378059831726361207/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://sqlforever.blogspot.com/2012/08/raiseerror.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/557833918731583301/posts/default/1378059831726361207'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/557833918731583301/posts/default/1378059831726361207'/><link rel='alternate' type='text/html' href='http://sqlforever.blogspot.com/2012/08/raiseerror.html' title='RaiseError'/><author><name>Anonymous</name><uri>http://www.blogger.com/profile/13522571212403373919</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-557833918731583301.post-7365359479348196597</id><published>2012-08-25T15:22:00.001-07:00</published><updated>2012-08-25T15:22:44.728-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="T-SQL"/><title type='text'>Merge Statement</title><content type='html'>&lt;span style=&quot;font-family: Calibri,Calibri; font-size: small;&quot;&gt;&lt;span style=&quot;font-family: Calibri,Calibri; font-size: small;&quot;&gt;&lt;strong&gt;MERGE&lt;/strong&gt; is a new feature that provides an efficient way to perform multiple DML operations. In previous versions of SQL Server, we had to write separate statements to INSERT, UPDATE, or DELETE data based on certain conditions, but now, using MERGE statement we can include the logic of such data modifications in one statement that even checks when the data is matched then just update it and when unmatched then insert it. One of the most important advantages of MERGE statement is all the data is read and processed only once. &lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Calibri;&quot;&gt;&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;span style=&quot;font-family: Calibri,Calibri; font-size: small;&quot;&gt;&lt;span style=&quot;font-family: Calibri,Calibri; font-size: small;&quot;&gt;&lt;img alt=&quot;&quot; class=&quot;rg_hi uh_hi&quot; data-height=&quot;203&quot; data-width=&quot;249&quot; height=&quot;203&quot; id=&quot;rg_hi&quot; src=&quot;https://encrypted-tbn3.google.com/images?q=tbn:ANd9GcQOUsqhUbAeXxo8kNjixuPw-kPLP1ArgXM2ldb1FWiRoPRdm3jQ&quot; style=&quot;height: 203px; width: 249px;&quot; width=&quot;249&quot; /&gt;&lt;/span&gt;&lt;/span&gt;</content><link rel='replies' type='application/atom+xml' href='http://sqlforever.blogspot.com/feeds/7365359479348196597/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://sqlforever.blogspot.com/2012/08/merge-statement.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/557833918731583301/posts/default/7365359479348196597'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/557833918731583301/posts/default/7365359479348196597'/><link rel='alternate' type='text/html' href='http://sqlforever.blogspot.com/2012/08/merge-statement.html' title='Merge Statement'/><author><name>Anonymous</name><uri>http://www.blogger.com/profile/13522571212403373919</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-557833918731583301.post-5688918008254861317</id><published>2012-08-25T15:09:00.003-07:00</published><updated>2012-08-25T15:10:04.559-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="T-SQL"/><title type='text'>@@error</title><content type='html'>&lt;strong&gt;@@Error&lt;/strong&gt;: Returns&amp;nbsp;the&amp;nbsp;value of the last t-sql statement&#39;s error message, if there was an error.&amp;nbsp;@@ERROR&amp;nbsp;returns 0 if the statement executed successfully. You can view the text associated with an @@ERROR error number in the &lt;b&gt;sysmessages&lt;/b&gt; system table. &lt;br /&gt;
@@error&amp;nbsp;is cleared and reset on each statement executed, so&amp;nbsp;check it immediately following the statement validated, or save it to a local variable that can be checked later.</content><link rel='replies' type='application/atom+xml' href='http://sqlforever.blogspot.com/feeds/5688918008254861317/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://sqlforever.blogspot.com/2012/08/error.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/557833918731583301/posts/default/5688918008254861317'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/557833918731583301/posts/default/5688918008254861317'/><link rel='alternate' type='text/html' href='http://sqlforever.blogspot.com/2012/08/error.html' title='@@error'/><author><name>Anonymous</name><uri>http://www.blogger.com/profile/13522571212403373919</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-557833918731583301.post-2584314928472485015</id><published>2012-08-25T14:48:00.002-07:00</published><updated>2012-08-25T15:00:04.305-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="T-SQL"/><title type='text'>Stored Procedure VS User-Defined Functions</title><content type='html'>&lt;span style=&quot;font-size: small;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-size: small;&quot;&gt;&lt;strong&gt;&lt;span style=&quot;background-color: yellow;&quot;&gt;UDF can be used in the SQL statements anywhere in the WHERE/HAVING/SELECT section where as Stored procedures cannot be. UDFs that return tables can be treated as another rowset. This can be used in JOINs with other tables. Inline UDF&#39;s can be thought of as views that take parameters and can be used in JOINs and other Rowset operations.&lt;/span&gt; &lt;/strong&gt;&lt;/span&gt;&lt;ol style=&quot;list-style-type: decimal;&quot;&gt;&lt;strong&gt;
&lt;/strong&gt;&lt;br /&gt;
&lt;strong&gt;&lt;em&gt;Here&#39;s the full list of Differences:&lt;/em&gt;&lt;/strong&gt;&lt;br /&gt;
&lt;strong&gt;&lt;/strong&gt;&lt;br /&gt;
&lt;li&gt;&lt;strong&gt;UDF can be used in the SQL statements anywhere in the WHERE/HAVING/SELECT 
section where as Stored procedures cannot be. 
&lt;/strong&gt;
&lt;li&gt;&lt;strong&gt;UDFs that return tables can be treated as another rowset. This can be used 
in JOINs with other tables. 
&lt;/strong&gt;
&lt;li&gt;&lt;strong&gt;Inline UDF&#39;s can be though of as views that take parameters and can be used 
in JOINs and other Rowset operations.  
&lt;/strong&gt;
&lt;li&gt;&lt;span&gt;&lt;span style=&quot;font-family: Times New Roman;&quot;&gt;&lt;strong&gt;Unlike 
Stored Procedure DML operations, like INSERT/UPDATE/DELETE, are not allowed in 
UDF.&lt;/strong&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;strong&gt;
&lt;/strong&gt;&lt;br /&gt;
&lt;li&gt;&lt;span style=&quot;font-family: Times New Roman;&quot;&gt;&lt;strong&gt;A stored procedure can 
have both input and output parameters  whereas UDF can only have input 
parameters.&lt;/strong&gt;&lt;/span&gt;&lt;br /&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin: 0cm 0cm 0pt;&quot;&gt;
&lt;strong&gt;UDF can be directly selected 
from, whereas a stored procedure requires one to insert the results into a 
tempory table or table variabl&lt;span style=&quot;font-family: Times New Roman;&quot;&gt; &lt;/span&gt;&lt;/strong&gt;&lt;/div&gt;
&lt;strong&gt;
&lt;/strong&gt;&lt;br /&gt;
&lt;li&gt;&lt;strong&gt;Stored procedures different than multi-line TVF is that the optimizer can 
use statistics to create a better query plan for a stored procedure; however, no 
statistics are maintained on Multi-line UDFs, so the optimizer has to guess at 
the number of rows, which can lead to a sub-optimal plan. 
&lt;/strong&gt;
&lt;li&gt;&lt;strong&gt;Stored procs can create a table but can’t return table.&lt;br /&gt;Functions can 
create, update and delete the table variable. It can return a table 
&lt;/strong&gt;
&lt;li&gt;&lt;strong&gt;Stored Procedures can affect the state of the database by using insert, 
delete, update and create operations.&lt;br /&gt;Functions cannot affect the state of 
the database which means we cannot perform insert, delete, update and create 
operations operations on the database. 
&lt;/strong&gt;
&lt;li&gt;&lt;strong&gt;Stored procedures are stored in database in the compiled form.&lt;br /&gt;Function 
are parsed and conpiled at runtime only. 
&lt;/strong&gt;
&lt;li&gt;&lt;strong&gt;Stored procs can be called independently using exec keyword. Stored 
procedure cannot be used in the select/where/having clause.&lt;br /&gt;Function are 
called from select/where/having clause. Even we can join two functions.  
&lt;/strong&gt;
&lt;li&gt;&lt;strong&gt;Stored procedure allows getdate () or other non-deterministic functions can 
be allowed.&lt;br /&gt;Function won’t allow the non-deterministic functions like 
getdate(). 
&lt;/strong&gt;
&lt;li&gt;&lt;strong&gt;In Stored procedures we can use transaction statements. We can’t use in 
functions. 
&lt;/strong&gt;
&lt;li&gt;&lt;strong&gt;The stored procedures can do all the DML operations like insert the new 
record, update the records and delete the existing records.&lt;br /&gt;The function 
won’t allow us to do the DML operations in the database tables like in the 
stored procedure. It allows us to do only the select operation. It will not 
allow to do the DML on existing tables. But still we can do the DML operation 
only on the table variable inside the user defined functions. 
&lt;/strong&gt;
&lt;li&gt;&lt;strong&gt;Temporary tables (derived) can be created in stored procedures.&lt;br /&gt;It is not 
possible in case of functions. 
&lt;/strong&gt;
&lt;li&gt;&lt;strong&gt;when sql statements encounters an error, T-SQL will ignore the error in a 
SPROC and proceed to the next statement in the remaining code.&lt;br /&gt;In case of 
functions, T-SQL will stop execution of next statements. &lt;/strong&gt;&lt;/li&gt;
&lt;/li&gt;
&lt;/li&gt;
&lt;/li&gt;
&lt;/li&gt;
&lt;/li&gt;
&lt;/li&gt;
&lt;/li&gt;
&lt;/li&gt;
&lt;/li&gt;
&lt;/li&gt;
&lt;/li&gt;
&lt;/li&gt;
&lt;/li&gt;
&lt;/li&gt;
&lt;/ol&gt;
</content><link rel='replies' type='application/atom+xml' href='http://sqlforever.blogspot.com/feeds/2584314928472485015/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://sqlforever.blogspot.com/2012/08/stored-procedure-vs-user-defined.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/557833918731583301/posts/default/2584314928472485015'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/557833918731583301/posts/default/2584314928472485015'/><link rel='alternate' type='text/html' href='http://sqlforever.blogspot.com/2012/08/stored-procedure-vs-user-defined.html' title='Stored Procedure VS User-Defined Functions'/><author><name>Anonymous</name><uri>http://www.blogger.com/profile/13522571212403373919</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-557833918731583301.post-269334464465706790</id><published>2012-08-25T14:32:00.002-07:00</published><updated>2012-08-25T14:32:58.001-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="T-SQL"/><title type='text'>Delete VS Truncate</title><content type='html'>&lt;table border=&quot;0&quot; cellpadding=&quot;0&quot; cellspacing=&quot;0&quot; style=&quot;border-collapse: collapse; width: 640px;&quot;&gt;
&lt;tbody&gt;
&lt;tr style=&quot;height: 15.75pt;&quot;&gt;&lt;td class=&quot;xl30&quot; height=&quot;21&quot; style=&quot;background-color: #969696; border-color: windowtext windowtext rgb(236, 233, 216); border-left-style: solid; border-left-width: 1pt; border-right-style: solid; border-right-width: 0.5pt; border-top-style: solid; border-top-width: 1pt; height: 15.75pt; line-height: 1.4em; width: 246pt;&quot; width=&quot;290&quot;&gt;&lt;strong&gt;Truncate&lt;/strong&gt;&lt;/td&gt;&lt;td class=&quot;xl31&quot; style=&quot;background-color: #969696; border-color: windowtext windowtext rgb(236, 233, 216); border-right-style: solid; border-right-width: 1pt; border-top-style: solid; border-top-width: 1pt; mso-border-bottom-themecolor: accent1; mso-border-left-themecolor: accent1; mso-border-right-themecolor: accent1; mso-border-top-themecolor: accent1; width: 282pt;&quot; width=&quot;300&quot;&gt;&lt;strong&gt;Delete&lt;/strong&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr style=&quot;height: 12.75pt;&quot;&gt;&lt;td class=&quot;xl28&quot; height=&quot;17&quot; style=&quot;background-color: transparent; border-color: windowtext; border-style: solid; border-width: 1pt 0.5pt 0.5pt 1pt; height: 12.75pt; width: 246pt;&quot; width=&quot;290&quot;&gt;&lt;span style=&quot;font-size: xx-small;&quot;&gt;TRUNCATE is a DDL command&lt;/span&gt;&lt;/td&gt;&lt;td class=&quot;xl29&quot; style=&quot;background-color: transparent; border-bottom-style: solid; border-bottom-width: 0.5pt; border-color: windowtext; border-right-style: solid; border-right-width: 1pt; border-top-style: solid; border-top-width: 1pt; width: 282pt;&quot; width=&quot;300&quot;&gt;&lt;span style=&quot;font-size: xx-small;&quot;&gt;DELETE is a DML command&lt;/span&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr style=&quot;height: 25.5pt;&quot;&gt;&lt;td class=&quot;xl26&quot; height=&quot;34&quot; style=&quot;background-color: silver; border-bottom-style: solid; border-bottom-width: 0.5pt; border-color: windowtext; border-left-style: solid; border-left-width: 1pt; border-right-style: solid; border-right-width: 0.5pt; height: 25.5pt; width: 246pt;&quot; width=&quot;290&quot;&gt;&lt;span style=&quot;font-size: xx-small;&quot;&gt;TRUNCATE TABLE always locks the table and page but not each row&lt;/span&gt;&lt;/td&gt;&lt;td class=&quot;xl27&quot; style=&quot;background-color: silver; border-bottom-style: solid; border-bottom-width: 0.5pt; border-color: windowtext; border-right-style: solid; border-right-width: 1pt; width: 282pt;&quot; width=&quot;300&quot;&gt;&lt;span style=&quot;font-size: xx-small;&quot;&gt;DELETE statement is executed using a row lock,                                             &lt;/span&gt;&lt;span style=&quot;background-color: silver; font-size: xx-small;&quot;&gt;each row in the table is locked for deletion&lt;/span&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr style=&quot;height: 12.75pt; mso-yfti-irow: 1;&quot;&gt;&lt;td class=&quot;xl24&quot; height=&quot;17&quot; style=&quot;background-color: transparent; border-bottom-style: solid; border-bottom-width: 0.5pt; border-color: windowtext; border-left-style: solid; border-left-width: 1pt; border-right-style: solid; border-right-width: 0.5pt; height: 12.75pt; mso-border-themecolor: accent1; mso-border-top-themecolor: accent1; width: 246pt;&quot; width=&quot;290&quot;&gt;&lt;span style=&quot;font-size: xx-small;&quot;&gt;Cannot use Where Condition&lt;/span&gt;&lt;/td&gt;&lt;td class=&quot;xl25&quot; style=&quot;background-color: transparent; border-bottom-style: solid; border-bottom-width: 0.5pt; border-color: windowtext; border-right-style: solid; border-right-width: 1pt; mso-border-bottom-themecolor: accent1; mso-border-left-themecolor: accent1; mso-border-right-themecolor: accent1; mso-border-top-themecolor: accent1; width: 282pt;&quot; width=&quot;300&quot;&gt;&lt;span style=&quot;font-size: xx-small;&quot;&gt;We can specify filters in where clause&lt;/span&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr style=&quot;height: 12.75pt; mso-yfti-irow: 2;&quot;&gt;&lt;td class=&quot;xl26&quot; height=&quot;17&quot; style=&quot;background-color: silver; border-bottom-style: solid; border-bottom-width: 0.5pt; border-color: windowtext; border-left-style: solid; border-left-width: 1pt; border-right-style: solid; border-right-width: 0.5pt; height: 12.75pt; mso-background-themecolor: accent1; mso-background-themetint: 63; mso-border-themecolor: accent1; mso-border-top-themecolor: accent1; width: 246pt;&quot; width=&quot;290&quot;&gt;&lt;span style=&quot;font-size: xx-small;&quot;&gt;It Removes all the data&lt;/span&gt;&lt;/td&gt;&lt;td class=&quot;xl27&quot; style=&quot;background-color: silver; border-bottom-style: solid; border-bottom-width: 0.5pt; border-color: windowtext; border-right-style: solid; border-right-width: 1pt; mso-background-themecolor: accent1; mso-background-themetint: 63; mso-border-bottom-themecolor: accent1; mso-border-left-themecolor: accent1; mso-border-right-themecolor: accent1; mso-border-top-themecolor: accent1; width: 282pt;&quot; width=&quot;300&quot;&gt;&lt;span style=&quot;font-size: xx-small;&quot;&gt;It deletes specified data if where condition exists.&lt;/span&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr style=&quot;height: 25.5pt;&quot;&gt;&lt;td class=&quot;xl24&quot; height=&quot;34&quot; style=&quot;background-color: transparent; border-bottom-style: solid; border-bottom-width: 0.5pt; border-color: windowtext; border-left-style: solid; border-left-width: 1pt; border-right-style: solid; border-right-width: 0.5pt; height: 25.5pt; width: 246pt;&quot; width=&quot;290&quot;&gt;&lt;span style=&quot;font-size: xx-small;&quot;&gt;TRUNCATE TABLE cannot activate a trigger because the operation does not log individual row deletions.&lt;/span&gt;&lt;/td&gt;&lt;td class=&quot;xl25&quot; style=&quot;background-color: transparent; border-bottom-style: solid; border-bottom-width: 0.5pt; border-color: windowtext; border-right-style: solid; border-right-width: 1pt; width: 282pt;&quot; width=&quot;300&quot;&gt;&lt;span style=&quot;font-size: xx-small;&quot;&gt;Delete activates a trigger because the operation                                are logged individually.&lt;/span&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr style=&quot;height: 25.5pt; mso-yfti-irow: 3;&quot;&gt;&lt;td class=&quot;xl26&quot; height=&quot;34&quot; style=&quot;background-color: silver; border-bottom-style: solid; border-bottom-width: 0.5pt; border-color: windowtext; border-left-style: solid; border-left-width: 1pt; border-right-style: solid; border-right-width: 0.5pt; height: 25.5pt; mso-border-themecolor: accent1; mso-border-top-themecolor: accent1; width: 246pt;&quot; width=&quot;290&quot;&gt;&lt;span&gt;&lt;span style=&quot;font-size: xx-small;&quot;&gt;Faster in performance wise, because it is minimally logged in transaction log.&lt;/span&gt;&lt;/span&gt;&lt;/td&gt;&lt;td class=&quot;xl27&quot; style=&quot;background-color: silver; border-bottom-style: solid; border-bottom-width: 0.5pt; border-color: windowtext; border-right-style: solid; border-right-width: 1pt; mso-border-bottom-themecolor: accent1; mso-border-left-themecolor: accent1; mso-border-right-themecolor: accent1; mso-border-top-themecolor: accent1; width: 282pt;&quot; width=&quot;300&quot;&gt;&lt;span style=&quot;font-size: xx-small;&quot;&gt;Slower than truncate because, it maintain logs for every record&lt;/span&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr style=&quot;height: 12.75pt; mso-yfti-irow: 4; mso-yfti-lastrow: yes;&quot;&gt;&lt;td class=&quot;xl24&quot; height=&quot;17&quot; style=&quot;background-color: transparent; border-bottom-style: solid; border-bottom-width: 0.5pt; border-color: windowtext; border-left-style: solid; border-left-width: 1pt; border-right-style: solid; border-right-width: 0.5pt; height: 12.75pt; mso-background-themecolor: accent1; mso-background-themetint: 63; mso-border-themecolor: accent1; mso-border-top-themecolor: accent1; width: 246pt;&quot; width=&quot;290&quot;&gt;&lt;/td&gt;&lt;td class=&quot;xl25&quot; style=&quot;background-color: transparent; border-bottom-style: solid; border-bottom-width: 0.5pt; border-color: windowtext; border-right-style: solid; border-right-width: 1pt; mso-background-themecolor: accent1; mso-background-themetint: 63; mso-border-bottom-themecolor: accent1; mso-border-left-themecolor: accent1; mso-border-right-themecolor: accent1; mso-border-top-themecolor: accent1; width: 282pt;&quot; width=&quot;300&quot;&gt;

&lt;ins style=&quot;border: currentColor; display: inline-table; margin: 0px; padding: 0px; position: relative; visibility: visible;&quot;&gt;&lt;ins id=&quot;aswift_0_anchor&quot; style=&quot;border: currentColor; display: block; margin: 0px; padding: 0px; position: relative; visibility: visible;&quot;&gt;&lt;iframe allowtransparency=&quot;true&quot; frameborder=&quot;0&quot; height=&quot;undefined&quot; hspace=&quot;0&quot; id=&quot;aswift_0&quot; marginheight=&quot;0&quot; marginwidth=&quot;0&quot; name=&quot;aswift_0&quot; scrolling=&quot;no&quot; style=&quot;left: 0px; position: absolute; top: 0px;&quot; vspace=&quot;0&quot; width=&quot;undefined&quot;&gt;&lt;/iframe&gt;&lt;/ins&gt;&lt;/ins&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr style=&quot;height: 38.25pt;&quot;&gt;&lt;td class=&quot;xl24&quot; height=&quot;51&quot; style=&quot;background-color: transparent; border-bottom-style: solid; border-bottom-width: 0.5pt; border-color: windowtext; border-left-style: solid; border-left-width: 1pt; border-right-style: solid; border-right-width: 0.5pt; height: 38.25pt; width: 246pt;&quot; width=&quot;290&quot;&gt;&lt;span style=&quot;font-size: xx-small;&quot;&gt;&lt;span style=&quot;mso-spacerun: yes;&quot;&gt; &lt;/span&gt;Drop all object’s statistics and marks like High Water Mark free extents and leave the object really empty with the first extent. zero pages are left in the table&lt;/span&gt;&lt;/td&gt;&lt;td class=&quot;xl25&quot; style=&quot;background-color: transparent; border-bottom-style: solid; border-bottom-width: 0.5pt; border-color: windowtext; border-right-style: solid; border-right-width: 1pt; width: 282pt;&quot; width=&quot;300&quot;&gt;&lt;span style=&quot;font-size: xx-small;&quot;&gt;keeps object’s statistics and all allocated space.&lt;/span&gt;&lt;span style=&quot;font-size: xx-small;&quot;&gt; After a                       DELETE statement is executed,&lt;/span&gt;&lt;span style=&quot;font-size: xx-small;&quot;&gt;the table can still contain empty pages.&lt;/span&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr style=&quot;height: 51pt;&quot;&gt;&lt;td class=&quot;xl26&quot; height=&quot;68&quot; style=&quot;background-color: silver; border-bottom-style: solid; border-bottom-width: 0.5pt; border-color: windowtext; border-left-style: solid; border-left-width: 1pt; border-right-style: solid; border-right-width: 0.5pt; height: 51pt; width: 246pt;&quot; width=&quot;290&quot;&gt;&lt;span style=&quot;font-size: xx-small;&quot;&gt;TRUNCATE TABLE removes the data by deallocating the data pages used to store the table data and records only the page deallocations in the transaction lo&lt;/span&gt;&lt;/td&gt;&lt;td class=&quot;xl27&quot; style=&quot;background-color: silver; border-bottom-style: solid; border-bottom-width: 0.5pt; border-color: windowtext; border-right-style: solid; border-right-width: 1pt; width: 282pt;&quot; width=&quot;300&quot;&gt;&lt;span style=&quot;font-size: xx-small;&quot;&gt;The DELETE statement removes rows one at a time                       &lt;/span&gt;&lt;span style=&quot;font-size: xx-small;&quot;&gt;and records an entry in the transaction log for each deleted row&lt;/span&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr style=&quot;height: 38.25pt;&quot;&gt;&lt;td class=&quot;xl24&quot; height=&quot;51&quot; style=&quot;background-color: transparent; border-bottom-style: solid; border-bottom-width: 0.5pt; border-color: windowtext; border-left-style: solid; border-left-width: 1pt; border-right-style: solid; border-right-width: 0.5pt; height: 38.25pt; width: 246pt;&quot; width=&quot;290&quot;&gt;&lt;span style=&quot;font-size: xx-small;&quot;&gt;If the table contains an identity column, the counter for that column is reset to the seed value that is defined for the column&lt;/span&gt;&lt;/td&gt;&lt;td class=&quot;xl25&quot; style=&quot;background-color: transparent; border-bottom-style: solid; border-bottom-width: 0.5pt; border-color: windowtext; border-right-style: solid; border-right-width: 1pt; width: 282pt;&quot; width=&quot;300&quot;&gt;&lt;span style=&quot;font-size: xx-small;&quot;&gt;DELETE retain the identity&lt;/span&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr style=&quot;height: 90pt;&quot;&gt;&lt;td class=&quot;xl32&quot; height=&quot;120&quot; style=&quot;background-color: silver; border-bottom-style: solid; border-bottom-width: 1pt; border-color: windowtext; border-left-style: solid; border-left-width: 1pt; border-right-style: solid; border-right-width: 0.5pt; height: 90pt; width: 246pt;&quot; width=&quot;290&quot;&gt;&lt;span style=&quot;font-size: xx-small;&quot;&gt;Restrictions on using Truncate Statement&lt;br /&gt;1. Are referenced by a FOREIGN KEY constraint.&lt;br /&gt;2. Participate in an indexed view.&lt;br /&gt;3. Are published by using transactional replication or merge replication.&lt;/span&gt;&lt;/td&gt;&lt;td class=&quot;xl33&quot; style=&quot;background-color: silver; border-bottom-style: solid; border-bottom-width: 1pt; border-color: windowtext; border-right-style: solid; border-right-width: 1pt; width: 282pt;&quot; width=&quot;300&quot;&gt;&lt;span style=&quot;font-size: xx-small;&quot;&gt;Delete works at row level, thus row level constrains &lt;/span&gt;&lt;span style=&quot;font-size: xx-small;&quot;&gt;apply&lt;/span&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
</content><link rel='replies' type='application/atom+xml' href='http://sqlforever.blogspot.com/feeds/269334464465706790/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://sqlforever.blogspot.com/2012/08/delete-vs-truncate.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/557833918731583301/posts/default/269334464465706790'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/557833918731583301/posts/default/269334464465706790'/><link rel='alternate' type='text/html' href='http://sqlforever.blogspot.com/2012/08/delete-vs-truncate.html' title='Delete VS Truncate'/><author><name>Anonymous</name><uri>http://www.blogger.com/profile/13522571212403373919</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-557833918731583301.post-7581460870840974324</id><published>2012-08-25T14:27:00.000-07:00</published><updated>2012-08-25T14:27:42.401-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="T-SQL"/><title type='text'>Datepart,Datename DateAdd, DateDiff, Date</title><content type='html'>&lt;strong&gt;DatePart&lt;/strong&gt;- Returns an integer tat represents the specified datepart of the specified date.&lt;br /&gt;
DATEPART (DatePart, Date)&lt;br /&gt;
&lt;br /&gt;
&lt;strong&gt;DateName&lt;/strong&gt;- Returns a character string that represents the specified datepart of the specified date.&lt;br /&gt;
DATENAME (DatePart, Date)&lt;br /&gt;
&lt;br /&gt;
&lt;strong&gt;DateAdd&lt;/strong&gt;-Returns a specified date with the specified number interval added to a specified datepart of that date.&lt;br /&gt;
DATEADD (DatePart, number, date)&lt;br /&gt;
&lt;br /&gt;
&lt;strong&gt;DateDiff&lt;/strong&gt;-Returns the time between two dates.&lt;br /&gt;
DATEDIFF (DatePart, StartDate, EndDate)</content><link rel='replies' type='application/atom+xml' href='http://sqlforever.blogspot.com/feeds/7581460870840974324/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://sqlforever.blogspot.com/2012/08/datepartdatename-dateadd-datediff-date.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/557833918731583301/posts/default/7581460870840974324'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/557833918731583301/posts/default/7581460870840974324'/><link rel='alternate' type='text/html' href='http://sqlforever.blogspot.com/2012/08/datepartdatename-dateadd-datediff-date.html' title='Datepart,Datename DateAdd, DateDiff, Date'/><author><name>Anonymous</name><uri>http://www.blogger.com/profile/13522571212403373919</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-557833918731583301.post-4045808260662617275</id><published>2012-08-25T12:55:00.001-07:00</published><updated>2012-08-25T12:55:34.799-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="T-SQL"/><title type='text'>Try...Catch </title><content type='html'>Errors in&amp;nbsp;tsql can be processed by using a &lt;strong&gt;TRY…CATCH&lt;/strong&gt; construct which contains two parts: a&amp;nbsp;try block and a&amp;nbsp;catch block. When an error condition is detected in a t-sql statement that is inside a&amp;nbsp;try block, control is passed to a catch block where the error can be processed. &lt;br /&gt;
&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgJob412WGJrlT8xJI3ltQ-2oKrCaqxgjJF5KQMKubY39rZfgHmkMp-9WPVFdZ9kN78ReZjazT0_W49BPDjzzzfxZd-pBAVE1ASyQpqqrNkwtV3IAapQscC0IhoobH_OBeS3NLHDBzBXQGs/s1600/00000trycatch.jpg&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;320&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgJob412WGJrlT8xJI3ltQ-2oKrCaqxgjJF5KQMKubY39rZfgHmkMp-9WPVFdZ9kN78ReZjazT0_W49BPDjzzzfxZd-pBAVE1ASyQpqqrNkwtV3IAapQscC0IhoobH_OBeS3NLHDBzBXQGs/s320/00000trycatch.jpg&quot; width=&quot;216&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='http://sqlforever.blogspot.com/feeds/4045808260662617275/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://sqlforever.blogspot.com/2012/08/trycatch.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/557833918731583301/posts/default/4045808260662617275'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/557833918731583301/posts/default/4045808260662617275'/><link rel='alternate' type='text/html' href='http://sqlforever.blogspot.com/2012/08/trycatch.html' title='Try...Catch '/><author><name>Anonymous</name><uri>http://www.blogger.com/profile/13522571212403373919</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgJob412WGJrlT8xJI3ltQ-2oKrCaqxgjJF5KQMKubY39rZfgHmkMp-9WPVFdZ9kN78ReZjazT0_W49BPDjzzzfxZd-pBAVE1ASyQpqqrNkwtV3IAapQscC0IhoobH_OBeS3NLHDBzBXQGs/s72-c/00000trycatch.jpg" height="72" width="72"/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-557833918731583301.post-8560397524840310930</id><published>2012-08-25T11:39:00.002-07:00</published><updated>2012-08-25T11:40:32.670-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="T-SQL"/><title type='text'>Materialized View/Index View</title><content type='html'>&lt;span style=&quot;background-color: white;&quot;&gt;A View created with a unique clustered index is known as an &lt;strong&gt;Indexed View&lt;/strong&gt; or &lt;strong&gt;Materialized View&lt;/strong&gt;.&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;background-color: white;&quot;&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;background-color: white;&quot;&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;background-color: white;&quot;&gt;Unlike views, an indexed view exists on the disk like a table in which the clustered index is created. Once a Clustered Index is created you may create non-clustered indexes on the view.&lt;/span&gt;</content><link rel='replies' type='application/atom+xml' href='http://sqlforever.blogspot.com/feeds/8560397524840310930/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://sqlforever.blogspot.com/2012/08/materialized-viewindex-view.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/557833918731583301/posts/default/8560397524840310930'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/557833918731583301/posts/default/8560397524840310930'/><link rel='alternate' type='text/html' href='http://sqlforever.blogspot.com/2012/08/materialized-viewindex-view.html' title='Materialized View/Index View'/><author><name>Anonymous</name><uri>http://www.blogger.com/profile/13522571212403373919</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-557833918731583301.post-3551265579707055215</id><published>2012-08-21T08:00:00.000-07:00</published><updated>2012-08-21T08:00:28.966-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="SSIS"/><title type='text'>Script Task Vs Script Component</title><content type='html'>&lt;div class=&quot;MsoNormal&quot; style=&quot;margin: 0in 0in 10pt;&quot;&gt;
&lt;span style=&quot;font-family: Calibri;&quot;&gt;&lt;b&gt;&lt;span style=&quot;font-size: 10pt; line-height: 115%;&quot;&gt;The Script component&lt;/span&gt;&lt;/b&gt;&lt;span style=&quot;font-size: 10pt; line-height: 115%;&quot;&gt; hosts script and enables a package to include and run custom script code. &lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin: 0in 0in 10pt;&quot;&gt;
&lt;span style=&quot;font-size: 10pt; line-height: 115%;&quot;&gt;&lt;span style=&quot;font-family: Calibri;&quot;&gt;You can use the Script component in packages for the following purposes: &lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;ul style=&quot;margin-top: 0in;&quot; type=&quot;disc&quot;&gt;
&lt;li class=&quot;MsoNormal&quot; style=&quot;margin: 0in 0in 10pt; tab-stops: list .5in;&quot;&gt;&lt;span style=&quot;font-size: 10pt; line-height: 115%;&quot;&gt;&lt;span style=&quot;font-family: Calibri;&quot;&gt;Apply multiple transformations to data instead of using multiple transformations in the data flow. For example, a script can add the values in two columns and then calculate the average of the sum.&lt;/span&gt;&lt;/span&gt;
&lt;li class=&quot;MsoNormal&quot; style=&quot;margin: 0in 0in 10pt; tab-stops: list .5in;&quot;&gt;&lt;span style=&quot;font-size: 10pt; line-height: 115%;&quot;&gt;&lt;span style=&quot;font-family: Calibri;&quot;&gt;Access business rules in an existing .NET assembly. For example, a script can apply a business rule that specifies the range of values that are valid in an &lt;span&gt;Income&lt;/span&gt; column. &lt;/span&gt;&lt;/span&gt;
&lt;li class=&quot;MsoNormal&quot; style=&quot;margin: 0in 0in 10pt; tab-stops: list .5in;&quot;&gt;&lt;span style=&quot;font-size: 10pt; line-height: 115%;&quot;&gt;&lt;span style=&quot;font-family: Calibri;&quot;&gt;Use custom formulas and functions in addition to the functions and operators that the Integration Services expression grammar provides. For example, validate credit card numbers using the LUHN formula.&lt;/span&gt;&lt;/span&gt;
&lt;li class=&quot;MsoNormal&quot; style=&quot;margin: 0in 0in 10pt; tab-stops: list .5in;&quot;&gt;&lt;span style=&quot;font-size: 10pt; line-height: 115%;&quot;&gt;&lt;span style=&quot;font-family: Calibri;&quot;&gt;Validate column data and skip records that contain invalid data. For example, a script can assess the reasonableness of a postage amount and skip records with extremely high or low amounts.&lt;/span&gt;&lt;/span&gt;&lt;/li&gt;
&lt;/li&gt;
&lt;/li&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin: 0in 0in 10pt;&quot;&gt;
&lt;span style=&quot;font-size: 10pt; line-height: 115%;&quot;&gt;&lt;span style=&quot;font-family: Calibri;&quot;&gt;The Script component provides an easy and quick way to include custom functions in a data flow. However, if you plan to reuse the script code in multiple packages, you should consider programming a custom component instead of using the Script component. For more information, see &lt;/span&gt;&lt;a href=&quot;http://msdn.microsoft.com/en-us/library/ms136118.aspx&quot; title=&quot;http://msdn.microsoft.com/en-us/library/ms136118.aspx&quot;&gt;&lt;span style=&quot;font-family: Calibri;&quot;&gt;Extending the Data Flow with Custom Components&lt;/span&gt;&lt;/a&gt;&lt;span style=&quot;font-family: Calibri;&quot;&gt;.&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin: 0in 0in 10pt;&quot;&gt;
&lt;span style=&quot;font-size: 10pt; line-height: 115%;&quot;&gt;&lt;span style=&quot;font-family: Calibri;&quot;&gt;The Script component can be used as a source, a transformation, or a destination. This component supports one input and multiple outputs. Depending on how the component is used, it supports either an input or outputs or both. The script is invoked by every row in the input or output.&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;ul style=&quot;margin-top: 0in;&quot; type=&quot;disc&quot;&gt;
&lt;li class=&quot;MsoNormal&quot; style=&quot;margin: 0in 0in 10pt; tab-stops: list .5in;&quot;&gt;&lt;span style=&quot;font-size: 10pt; line-height: 115%;&quot;&gt;&lt;span style=&quot;font-family: Calibri;&quot;&gt;If used as a source, the Script component supports multiple outputs.&lt;/span&gt;&lt;/span&gt;
&lt;li class=&quot;MsoNormal&quot; style=&quot;margin: 0in 0in 10pt; tab-stops: list .5in;&quot;&gt;&lt;span style=&quot;font-size: 10pt; line-height: 115%;&quot;&gt;&lt;span style=&quot;font-family: Calibri;&quot;&gt;If used as a transformation, the Script component supports one input and multiple outputs.&lt;/span&gt;&lt;/span&gt;
&lt;li class=&quot;MsoNormal&quot; style=&quot;margin: 0in 0in 10pt; tab-stops: list .5in;&quot;&gt;&lt;span style=&quot;font-size: 10pt; line-height: 115%;&quot;&gt;&lt;span style=&quot;font-family: Calibri;&quot;&gt;If used as a destination, the Script component supports one input.&lt;/span&gt;&lt;/span&gt;&lt;/li&gt;
&lt;/li&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin: 0in 0in 10pt;&quot;&gt;
&lt;span style=&quot;font-size: 10pt; line-height: 115%;&quot;&gt;&lt;span style=&quot;font-family: Calibri;&quot;&gt;The Script component does not support error outputs.&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin: 0in 0in 10pt;&quot;&gt;
&lt;span style=&quot;font-size: 10pt; line-height: 115%;&quot;&gt;&lt;span style=&quot;font-family: Calibri;&quot;&gt;You can configure the Script component in the following ways:&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;ul style=&quot;margin-top: 0in;&quot; type=&quot;disc&quot;&gt;
&lt;li class=&quot;MsoNormal&quot; style=&quot;margin: 0in 0in 10pt; tab-stops: list .5in;&quot;&gt;&lt;span style=&quot;font-size: 10pt; line-height: 115%;&quot;&gt;&lt;span style=&quot;font-family: Calibri;&quot;&gt;Select input columns to reference.&lt;/span&gt;&lt;/span&gt;
&lt;li class=&quot;MsoNormal&quot; style=&quot;margin: 0in 0in 10pt; tab-stops: list .5in;&quot;&gt;&lt;span style=&quot;font-size: 10pt; line-height: 115%;&quot;&gt;&lt;span style=&quot;font-family: Calibri;&quot;&gt;Provide the script that the component runs.&lt;/span&gt;&lt;/span&gt;
&lt;li class=&quot;MsoNormal&quot; style=&quot;margin: 0in 0in 10pt; tab-stops: list .5in;&quot;&gt;&lt;span style=&quot;font-size: 10pt; line-height: 115%;&quot;&gt;&lt;span style=&quot;font-family: Calibri;&quot;&gt;Specify whether the script is precompiled.&lt;/span&gt;&lt;/span&gt;
&lt;li class=&quot;MsoNormal&quot; style=&quot;margin: 0in 0in 10pt; tab-stops: list .5in;&quot;&gt;&lt;span style=&quot;font-size: 10pt; line-height: 115%;&quot;&gt;&lt;span style=&quot;font-family: Calibri;&quot;&gt;Provide comma-separated lists of read-only and read/write variables.&lt;/span&gt;&lt;/span&gt;
&lt;li class=&quot;MsoNormal&quot; style=&quot;margin: 0in 0in 10pt; tab-stops: list .5in;&quot;&gt;&lt;span style=&quot;font-size: 10pt; line-height: 115%;&quot;&gt;&lt;span style=&quot;font-family: Calibri;&quot;&gt;Add more outputs, and add output columns to which the script assigns values.&lt;/span&gt;&lt;/span&gt;&lt;/li&gt;
&lt;/li&gt;
&lt;/li&gt;
&lt;/li&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin: 0in 0in 10pt;&quot;&gt;
&lt;span style=&quot;font-family: Calibri;&quot;&gt;&lt;b&gt;&lt;span style=&quot;font-size: 10pt; line-height: 115%;&quot;&gt;The Script task&lt;/span&gt;&lt;/b&gt;&lt;span style=&quot;font-size: 10pt; line-height: 115%;&quot;&gt; provides code to perform functions that are not available in the built-in tasks and transformations that SQL Server 2005 Integration Services provides. The Script task can also combine functions in one script instead of using multiple tasks and transformations. The code is custom Microsoft Visual Basic .NET code that is compiled and executed at package run time.&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin: 0in 0in 10pt;&quot;&gt;
&lt;span style=&quot;font-size: 10pt; line-height: 115%;&quot;&gt;&lt;span style=&quot;font-family: Calibri;&quot;&gt;You can use the Script task for the following purposes:&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;ul style=&quot;margin-top: 0in;&quot; type=&quot;disc&quot;&gt;
&lt;li class=&quot;MsoNormal&quot; style=&quot;margin: 0in 0in 10pt; tab-stops: list .5in;&quot;&gt;&lt;span style=&quot;font-size: 10pt; line-height: 115%;&quot;&gt;&lt;span style=&quot;font-family: Calibri;&quot;&gt;Access data using other technologies that are not supported by built-in connection types. For example, a script can use Active Directory Service Interfaces (ADSI) to access and extract user names from Active Directory. &lt;/span&gt;&lt;/span&gt;
&lt;li class=&quot;MsoNormal&quot; style=&quot;margin: 0in 0in 10pt; tab-stops: list .5in;&quot;&gt;&lt;span style=&quot;font-size: 10pt; line-height: 115%;&quot;&gt;&lt;span style=&quot;font-family: Calibri;&quot;&gt;Create a package-specific performance counter. For example, a script can create a performance counter that is updated while a complex or poorly performing task runs.&lt;/span&gt;&lt;/span&gt;
&lt;li class=&quot;MsoNormal&quot; style=&quot;margin: 0in 0in 10pt; tab-stops: list .5in;&quot;&gt;&lt;span style=&quot;font-size: 10pt; line-height: 115%;&quot;&gt;&lt;span style=&quot;font-family: Calibri;&quot;&gt;Replace data in the source with different data in the destination. For example, a script can replace a two-digit state code in the source data with the state name in the destination data. &lt;/span&gt;&lt;/span&gt;
&lt;li class=&quot;MsoNormal&quot; style=&quot;margin: 0in 0in 10pt; tab-stops: list .5in;&quot;&gt;&lt;span style=&quot;font-size: 10pt; line-height: 115%;&quot;&gt;&lt;span style=&quot;font-family: Calibri;&quot;&gt;Validate important columns in the source data and skip records that contain invalid data to prevent them from being copied to the destination. For example, a script can assess the reasonableness of a postage amount and skip records with extremely high or low amounts&lt;/span&gt;&lt;/span&gt;&lt;/li&gt;
&lt;/li&gt;
&lt;/li&gt;
&lt;/li&gt;
&lt;/ul&gt;
</content><link rel='replies' type='application/atom+xml' href='http://sqlforever.blogspot.com/feeds/3551265579707055215/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://sqlforever.blogspot.com/2012/08/script-task-vs-script-component.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/557833918731583301/posts/default/3551265579707055215'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/557833918731583301/posts/default/3551265579707055215'/><link rel='alternate' type='text/html' href='http://sqlforever.blogspot.com/2012/08/script-task-vs-script-component.html' title='Script Task Vs Script Component'/><author><name>Anonymous</name><uri>http://www.blogger.com/profile/13522571212403373919</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-557833918731583301.post-7646826150444839073</id><published>2012-08-20T22:36:00.004-07:00</published><updated>2012-08-21T08:00:15.599-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="T-SQL"/><title type='text'>Execution Plan</title><content type='html'>&lt;span style=&quot;background-color: black;&quot;&gt;

&lt;b style=&quot;mso-bidi-font-weight: normal;&quot;&gt;&lt;span style=&quot;color: red; mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin; mso-fareast-font-family: Calibri; mso-fareast-theme-font: minor-latin;&quot;&gt;&lt;span style=&quot;mso-list: Ignore;&quot;&gt;&lt;span style=&quot;font-size-adjust: none; font-stretch: normal; font: 7pt/normal &amp;quot;Times New Roman&amp;quot;;&quot;&gt;&amp;nbsp;&lt;span style=&quot;color: yellow;&quot;&gt;&amp;nbsp;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/b&gt;&lt;b style=&quot;mso-bidi-font-weight: normal;&quot;&gt;&lt;span style=&quot;color: yellow;&quot;&gt;&lt;span style=&quot;color: red; font-family: &amp;quot;Arial&amp;quot;,&amp;quot;sans-serif&amp;quot;; font-size: 9.5pt; line-height: 115%;&quot;&gt;Execution plans can tell you how a query will be executed, or how a
query was executed. They are, therefore, the DBA&#39;s primary means of
troubleshooting a poorly performing query.&amp;nbsp;&lt;span style=&quot;background-color: black;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;background-color: black; color: cyan;&quot;&gt;&lt;span style=&quot;background-color: black;&quot;&gt;You&lt;/span&gt; can use the estimated execution plan to estimate how the query will run and perform. It may not be exact however it will be close. The reason it may not be exact is because when you execute your query it might have planned to go that way of the estimated plan but might have encountered a problem along the way and it might have to take a detour and go another way or use something different.&lt;/span&gt;&amp;nbsp; &lt;span style=&quot;color: yellow;&quot;&gt;The Actual&amp;nbsp; Execution Plan is returned after the query has been executed and gives you the chance to see how well or badly it performed. It&amp;nbsp; could very well help you realize what you can replace and how to make your query perform better.&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
</content><link rel='replies' type='application/atom+xml' href='http://sqlforever.blogspot.com/feeds/7646826150444839073/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://sqlforever.blogspot.com/2012/08/execution-plan.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/557833918731583301/posts/default/7646826150444839073'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/557833918731583301/posts/default/7646826150444839073'/><link rel='alternate' type='text/html' href='http://sqlforever.blogspot.com/2012/08/execution-plan.html' title='Execution Plan'/><author><name>Anonymous</name><uri>http://www.blogger.com/profile/13522571212403373919</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-557833918731583301.post-1363287529225871954</id><published>2012-08-20T22:23:00.000-07:00</published><updated>2012-08-20T22:23:26.608-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="T-SQL"/><title type='text'>After Trigger and Instead Of Trigger</title><content type='html'>&lt;em&gt;The following is from &lt;/em&gt;&lt;a href=&quot;http://www.techrepublic.com/article/making-use-of-instead-of-triggers-in-sql-server-2005/6113179&quot;&gt;&lt;em&gt;Technet&lt;/em&gt;&lt;/a&gt;&lt;em&gt;:&lt;/em&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;strong&gt;AFTER triggers&lt;/strong&gt; are stored procedures that occur after a data manipulation statement has occurred in the database, such as a delete statement. DDL triggers are new to SQL Server 2005, and allow you to respond to object definition level events that occur in the database engine, such as a DROP TABLE statement. INSTEAD-OF triggers are objects that will execute instead of data manipulation statements in the database engine. For example, attaching an INSTEAD-OF INSERT trigger to a table will tell the database engine to execute that trigger instead of executing the statement that would insert values into that table.&lt;br /&gt;
&lt;h2&gt;
Why use an INSTEAD-OF trigger?&lt;/h2&gt;
INSTEAD-OF triggers are very powerful objects in SQL Server. They allow the developer to divert the database engine to do something different than what the user is trying to do. An example of this would be to add an INSTEAD-OF trigger to any table in your database that rolls back transactions on tables that you do not want modified. You must be careful when using this method because the INSTEAD-OF trigger will need to be disabled before any specified modifications can occur to this table.&lt;br /&gt;
Perhaps a more functional reason to use an INSTEAD-OF trigger would be to add the trigger to a view. Adding an INSTEAD-OF trigger to a view essentially allows you to create updateable views. Updateable views allow you to totally abstract your database schema so you can potentially design a system in such a way that your database developers do not have to worry about the OLTP database schema and instead rely upon a standard set of views for data modifications.</content><link rel='replies' type='application/atom+xml' href='http://sqlforever.blogspot.com/feeds/1363287529225871954/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://sqlforever.blogspot.com/2012/08/after-trigger-and-instead-of-trigger.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/557833918731583301/posts/default/1363287529225871954'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/557833918731583301/posts/default/1363287529225871954'/><link rel='alternate' type='text/html' href='http://sqlforever.blogspot.com/2012/08/after-trigger-and-instead-of-trigger.html' title='After Trigger and Instead Of Trigger'/><author><name>Anonymous</name><uri>http://www.blogger.com/profile/13522571212403373919</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-557833918731583301.post-1536189186741269165</id><published>2012-08-20T01:23:00.003-07:00</published><updated>2012-08-20T01:23:46.150-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="SSRS"/><title type='text'>Cascading parameters</title><content type='html'>&lt;strong&gt;Cascading parameters&lt;/strong&gt; provide a way of managing large amounts of report data. You can define a set of related parameters so that the list of values for one parameter depends on the value chosen in another parameter. For example, the first parameter is independent and might present a list of product categories. When the user selects a category, the second parameter is dependent on the value of the first parameter. Its values are updated with a list of subcategories within the chosen category. When the user views the report, the values for both the category and subcategory parameters are used to filter report data. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;em&gt;The above definition is from Technet:&lt;/em&gt; &amp;nbsp;&lt;a href=&quot;http://technet.microsoft.com/en-us/library/dd255197.aspx&quot;&gt;http://technet.microsoft.com/en-us/library/dd255197.aspx&lt;/a&gt;</content><link rel='replies' type='application/atom+xml' href='http://sqlforever.blogspot.com/feeds/1536189186741269165/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://sqlforever.blogspot.com/2012/08/cascading-parameters.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/557833918731583301/posts/default/1536189186741269165'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/557833918731583301/posts/default/1536189186741269165'/><link rel='alternate' type='text/html' href='http://sqlforever.blogspot.com/2012/08/cascading-parameters.html' title='Cascading parameters'/><author><name>Anonymous</name><uri>http://www.blogger.com/profile/13522571212403373919</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-557833918731583301.post-6053386767656004030</id><published>2012-08-17T20:30:00.000-07:00</published><updated>2012-08-17T21:05:37.979-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="SSIS"/><title type='text'>Differences between....</title><content type='html'>&lt;br /&gt;


&lt;br /&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin: 0in 0in 10pt;&quot;&gt;
&lt;b style=&quot;mso-bidi-font-weight: normal;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;Arial&amp;quot;,&amp;quot;sans-serif&amp;quot;; font-size: 10pt; line-height: 115%;&quot;&gt;&lt;span style=&quot;mso-tab-count: 1;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;a.&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;&amp;nbsp;
&lt;/span&gt;merge and merge join--&lt;/span&gt;&lt;/b&gt;&lt;span style=&quot;font-family: &amp;quot;Arial&amp;quot;,&amp;quot;sans-serif&amp;quot;; font-size: 10pt; line-height: 115%;&quot;&gt; &lt;b style=&quot;mso-bidi-font-weight: normal;&quot;&gt;Merge Acts like a union all in T-sql but you can provide only two input
to this transformation which must be pre- sorted and merge join joins the two
datasets like T-SQL joins(inner join , left join, right join )&lt;o:p&gt;&lt;/o:p&gt;&lt;/b&gt;&lt;/span&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin: 0in 0in 10pt;&quot;&gt;
&lt;b style=&quot;mso-bidi-font-weight: normal;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;Arial&amp;quot;,&amp;quot;sans-serif&amp;quot;; font-size: 10pt; line-height: 115%;&quot;&gt;&lt;span style=&quot;mso-tab-count: 1;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;b.&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;&amp;nbsp;
&lt;/span&gt;union and union all---- &lt;/span&gt;&lt;/b&gt;&lt;b style=&quot;mso-bidi-font-weight: normal;&quot;&gt;&lt;span lang=&quot;EN&quot; style=&quot;font-family: &amp;quot;Arial&amp;quot;,&amp;quot;sans-serif&amp;quot;; font-size: 10pt; line-height: 115%; mso-ansi-language: EN;&quot;&gt;The union command is used to select related information
from two tables but with union distinct values are selected. The union all
command is equal to the union command, except union all selects all values and
will not get rid of duplicate rows.&lt;/span&gt;&lt;/b&gt;&lt;b style=&quot;mso-bidi-font-weight: normal;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;Arial&amp;quot;,&amp;quot;sans-serif&amp;quot;; font-size: 10pt; line-height: 115%;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin: 0in 0in 10pt;&quot;&gt;
&lt;b style=&quot;mso-bidi-font-weight: normal;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;Arial&amp;quot;,&amp;quot;sans-serif&amp;quot;; font-size: 10pt; line-height: 115%;&quot;&gt;&lt;span style=&quot;mso-tab-count: 1;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;c.&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;&amp;nbsp;
&lt;/span&gt;merge join and union all--- Merge can only accept two datasets while
Union All can accept more than two datasets for input. The second difference is
that Merge requires both datasets to be sorted while Union All does not require
sorted datasets&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin: 0in 0in 10pt;&quot;&gt;
&lt;b style=&quot;mso-bidi-font-weight: normal;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;Arial&amp;quot;,&amp;quot;sans-serif&amp;quot;; font-size: 10pt; line-height: 115%;&quot;&gt;&lt;span style=&quot;mso-tab-count: 1;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;d.&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;&amp;nbsp;
&lt;/span&gt;row sampling and percentage sampling--- Row sampling is used to randomly
select some rows and move them as output to the required process as and when
required to divide the rows. Percentage Sampling on the other hand, selects
rows randomly by percentage.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin: 0in 0in 10pt;&quot;&gt;
&lt;b style=&quot;mso-bidi-font-weight: normal;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;Arial&amp;quot;,&amp;quot;sans-serif&amp;quot;; font-size: 10pt; line-height: 115%;&quot;&gt;&lt;span style=&quot;mso-tab-count: 1;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;e.&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;&amp;nbsp;
&lt;/span&gt;dts and ssis---- DTS is a set of objects using an ETS tool to extract,
transform, and load information to or from a database; SSIS is an ETL tool
provided by Microsoft to extract data from different sources. &lt;br style=&quot;mso-special-character: line-break;&quot; /&gt;
&lt;br style=&quot;mso-special-character: line-break;&quot; /&gt;
&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin: 0in 0in 10pt;&quot;&gt;
&lt;b style=&quot;mso-bidi-font-weight: normal;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;Arial&amp;quot;,&amp;quot;sans-serif&amp;quot;; font-size: 10pt; line-height: 115%;&quot;&gt;&lt;span style=&quot;mso-tab-count: 1;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;f.&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;&amp;nbsp;
&lt;/span&gt;pivot and unpivot----&lt;/span&gt;&lt;/b&gt;&lt;span style=&quot;font-family: &amp;quot;Arial&amp;quot;,&amp;quot;sans-serif&amp;quot;; font-size: 10pt; line-height: 115%;&quot;&gt; &lt;b style=&quot;mso-bidi-font-weight: normal;&quot;&gt;Pivot will convert rows to columns and un-pivot will go the other way,
columns to rows&lt;o:p&gt;&lt;/o:p&gt;&lt;/b&gt;&lt;/span&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin: 0in 0in 10pt;&quot;&gt;
&lt;b style=&quot;mso-bidi-font-weight: normal;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;Arial&amp;quot;,&amp;quot;sans-serif&amp;quot;; font-size: 10pt; line-height: 115%;&quot;&gt;&lt;span style=&quot;mso-tab-count: 1;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;g.&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;&amp;nbsp;
&lt;/span&gt;scnhronous transformation&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;&amp;nbsp; &lt;/span&gt;and
ascnchronous transformation---&lt;/span&gt;&lt;/b&gt;&lt;span style=&quot;font-family: &amp;quot;Arial&amp;quot;,&amp;quot;sans-serif&amp;quot;; font-size: 10pt; line-height: 115%;&quot;&gt; &lt;b style=&quot;mso-bidi-font-weight: normal;&quot;&gt;A synchronous transformation processes incoming rows and passes them on
in the data flow one row at a time. Output is synchronous with input, meaning
that it occurs at the same time.&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;&amp;nbsp; &lt;/span&gt;The
transformation does not need information about other rows in the data set. The
Rows are grouped into Buffers as they pass from one component to the next.
Meanwhile,&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;&amp;nbsp; &lt;/span&gt;in an asynchronous
transformation, you cannot pass each row along in the data flow as it is
processed, but instead must output data asynchronously, or at a different time,
than the input.&lt;/b&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin: 0in 0in 10pt;&quot;&gt;
&lt;b style=&quot;mso-bidi-font-weight: normal;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;Arial&amp;quot;,&amp;quot;sans-serif&amp;quot;; font-size: 10pt; line-height: 115%;&quot;&gt;&lt;span style=&quot;mso-tab-count: 1;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;h.&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;&amp;nbsp;
&lt;/span&gt;look-up and merge join---&lt;/span&gt;&lt;/b&gt;&lt;span style=&quot;font-family: &amp;quot;Arial&amp;quot;,&amp;quot;sans-serif&amp;quot;; font-size: 10pt; line-height: 115%;&quot;&gt; &lt;b style=&quot;mso-bidi-font-weight: normal;&quot;&gt;The Lookup transformation performs lookups by joining data in input
columns with columns in a reference dataset.&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;&amp;nbsp;
&lt;/span&gt;Lookup uses an ole db connection manager. While a merge join combines
two sorted datasets using a FULL, LEFT, or INNER join.&lt;o:p&gt;&lt;/o:p&gt;&lt;/b&gt;&lt;/span&gt;&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='http://sqlforever.blogspot.com/feeds/6053386767656004030/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://sqlforever.blogspot.com/2012/08/differences-between.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/557833918731583301/posts/default/6053386767656004030'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/557833918731583301/posts/default/6053386767656004030'/><link rel='alternate' type='text/html' href='http://sqlforever.blogspot.com/2012/08/differences-between.html' title='Differences between....'/><author><name>Anonymous</name><uri>http://www.blogger.com/profile/13522571212403373919</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-557833918731583301.post-5337461232670978157</id><published>2012-08-15T15:29:00.000-07:00</published><updated>2012-08-15T18:53:37.408-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="T-SQL Videos"/><title type='text'>Planning</title><content type='html'>&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;iframe allowfullscreen=&#39;allowfullscreen&#39; webkitallowfullscreen=&#39;webkitallowfullscreen&#39; mozallowfullscreen=&#39;mozallowfullscreen&#39; width=&#39;320&#39; height=&#39;266&#39; src=&#39;https://www.blogger.com/video.g?token=AD6v5dy1V8yny-n47HJ5Px73f8uDhJUWKuEnwxpMQ9e-sZOK8RLufCYq_RHtcm_UY9_YW9A-EFKXH4ucno-MvvLe&#39; class=&#39;b-hbp-video b-uploaded&#39; frameborder=&#39;0&#39;&gt;&lt;/iframe&gt;&lt;/div&gt;
&lt;br /&gt;
</content><link rel='replies' type='application/atom+xml' href='http://sqlforever.blogspot.com/feeds/5337461232670978157/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://sqlforever.blogspot.com/2012/08/planning.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/557833918731583301/posts/default/5337461232670978157'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/557833918731583301/posts/default/5337461232670978157'/><link rel='alternate' type='text/html' href='http://sqlforever.blogspot.com/2012/08/planning.html' title='Planning'/><author><name>Anonymous</name><uri>http://www.blogger.com/profile/13522571212403373919</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-557833918731583301.post-789860631833200472</id><published>2012-08-15T14:37:00.001-07:00</published><updated>2012-08-15T18:53:37.409-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="T-SQL Videos"/><title type='text'>Creating Sample Databases</title><content type='html'>&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;iframe allowfullscreen=&#39;allowfullscreen&#39; webkitallowfullscreen=&#39;webkitallowfullscreen&#39; mozallowfullscreen=&#39;mozallowfullscreen&#39; width=&#39;320&#39; height=&#39;266&#39; src=&#39;https://www.blogger.com/video.g?token=AD6v5dzNRc2mLYXkRSLJjRpS0L2fJEDzuidxvBk2toPfDPpSKvwaSmph6lL2bbvdet46knFhSe2UsQ2s_ZkpXncT_A&#39; class=&#39;b-hbp-video b-uploaded&#39; frameborder=&#39;0&#39;&gt;&lt;/iframe&gt;&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='http://sqlforever.blogspot.com/feeds/789860631833200472/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://sqlforever.blogspot.com/2012/08/creating-sample-databases.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/557833918731583301/posts/default/789860631833200472'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/557833918731583301/posts/default/789860631833200472'/><link rel='alternate' type='text/html' href='http://sqlforever.blogspot.com/2012/08/creating-sample-databases.html' title='Creating Sample Databases'/><author><name>Anonymous</name><uri>http://www.blogger.com/profile/13522571212403373919</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry></feed>