<?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: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-1146926327588070502</id><updated>2012-02-16T14:40:08.089-08:00</updated><category term='WITH NOWAIT'/><category term='Vertical Partition'/><category term='openrowset'/><category term='Guidelines for table partitioning'/><category term='FAQ'/><category term='ALTER Database'/><category term='Excel 2007'/><category term='Horizontal Partition'/><category term='WITH ROLLBACK IMMEDIATE'/><category term='Data import'/><category term='Advantage of Disadvantage of Table Partitioning'/><category term='Table Partition'/><category term='How to create files from images stored in database'/><title type='text'>Welcome onboard - Microsoft SQL Server</title><subtitle type='html'>I am a Ex-Sailor from Indian Navay who possesses rich experience in Microsoft SQL Server. I would take this opportunity to pay tribute to all those who serve their country with pride, always keeping “Service before Self”.</subtitle><link rel='http://schemas.google.com/g/2005#feed' type='application/atom+xml' href='http://madhuottapalam.blogspot.com/feeds/posts/default'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1146926327588070502/posts/default?max-results=100'/><link rel='alternate' type='text/html' href='http://madhuottapalam.blogspot.com/'/><link rel='hub' href='http://pubsubhubbub.appspot.com/'/><link rel='next' type='application/atom+xml' href='http://www.blogger.com/feeds/1146926327588070502/posts/default?start-index=101&amp;max-results=100'/><author><name>Madhu K Nair</name><uri>http://www.blogger.com/profile/08936146465563191414</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='30' height='32' src='http://1.bp.blogspot.com/_4wBIz276vTw/TKtTNRq6sZI/AAAAAAAAASA/DVQPmnwt50c/S220/Madhu.jpg'/></author><generator version='7.00' uri='http://www.blogger.com'>Blogger</generator><openSearch:totalResults>153</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>100</openSearch:itemsPerPage><entry><id>tag:blogger.com,1999:blog-1146926327588070502.post-8722146295965160887</id><published>2011-07-30T01:37:00.000-07:00</published><updated>2011-07-30T01:48:35.991-07:00</updated><title type='text'>SQL Server New Version Denali - New Feature Sequence</title><content type='html'>One of the new featured in SQL Server  2011 – Denali  is Sequence.  Whoever have worked in Oracle  or DB2 can easily connect to this feature and it is in the SQL Server wishlist for long time. While migrating Oracle database to SQL Server this was one area quite bit of effort  needed because in previoius versions of SQL Server Sequence was not supported.  Though there were workaround to achieve the same feature, there was no One to One mapping for sequence object in SQL Server. Now in  SQL Server 2011 Microsoft has comeup with an equivalent.  Having said that, there are behavioural changes in SQL Server sequcne from Oracle sequence. The syntex is different, there are limitation and flxibility as well.  Let us try to understand more about SQL Server Sequence. &lt;br /&gt;&lt;br /&gt;&lt;strong&gt;Problem : &lt;/strong&gt;&lt;br /&gt;In earlier versions of SQL Server, to Generate sequence of numeric values for a  Surrogate primary key or otherwise we used to use Identity property on a Numeric Column.  The Identity column was tightly coupled with the Table and it had its own advantage and disadvantage.  The main issue was if you want to have same Sequence   to be shared accross many tables or columns  , then we had to go for a workaround. In SuperType subtype kind of relations we used to face this problem of sharing same sequence across multiple tables.   &lt;br /&gt;&lt;br /&gt;&lt;strong&gt;Solution&lt;/strong&gt;&lt;br /&gt;In  SQL Server 2011, Microsoft has  added a new Object called Sequence which is more or less similar to Oracle Sequence object.   &lt;br /&gt;&lt;br /&gt;&lt;strong&gt;What is Sequence in SQL Server?&lt;/strong&gt;&lt;br /&gt;A sequence is a user-defined schema-bound object that generates a sequence of numeric values according to the specification with which the sequence was created. The sequence of numeric values is generated in an ascending or descending order at a defined interval and may cycle (repeat) as requested. Generally it is used to create auto generated Primary key (surrogate key) value. &lt;br /&gt;&lt;br /&gt;&lt;strong&gt;Create Sequence&lt;/strong&gt;&lt;br /&gt;As usual, you have TSQL command and GUI. TSQL Syntax is as follows&lt;br /&gt;&lt;br /&gt;CREATE SEQUENCE [schema_name . ] sequence_name&lt;br /&gt;    [ AS [ built_in_integer_type | user-defined_integer_type ] ]&lt;br /&gt;    [ START WITH &lt;constant&gt; ]&lt;br /&gt;    [ INCREMENT BY &lt;constant&gt; ]&lt;br /&gt;    [ { MINVALUE [ &lt;constant&gt; ] } | { NO MINVALUE } ]&lt;br /&gt;    [ { MAXVALUE [ &lt;constant&gt; ] } | { NO MAXVALUE } ]&lt;br /&gt;    [ CYCLE | { NO CYCLE } ]&lt;br /&gt;    [ { CACHE [ &lt;constant&gt; ] } | { NO CACHE } ]&lt;br /&gt;    [ ; ]&lt;br /&gt;You can refer this &lt;a href="http://msdn.microsoft.com/en-us/library/ff878091(v=SQL.110).aspx "&gt;Link &lt;/a&gt;for more detail on Syntax.  &lt;br /&gt;&lt;br /&gt;&lt;strong&gt;Eg.  Creating a Sequence with all arguments &lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;CREATE SEQUENCE [dbo].Seq_EmployeeID &lt;br /&gt; START WITH 0&lt;br /&gt; INCREMENT BY 2&lt;br /&gt; MINVALUE 0&lt;br /&gt; MAXVALUE 2000&lt;br /&gt; CYCLE &lt;br /&gt; CACHE  20 &lt;br /&gt;&lt;br /&gt;&lt;strong&gt;Eg. Creating Table with Sequence as Default value for PK. This is another way of usage.   &lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;CREATE TABLE Audit.ProcessEvents&lt;br /&gt;(&lt;br /&gt;    EventID int PRIMARY KEY CLUSTERED &lt;br /&gt;        DEFAULT (NEXT VALUE FOR Audit.EventCounter),&lt;br /&gt;    EventTime datetime NOT NULL DEFAULT (getdate()),&lt;br /&gt;    EventCode nvarchar(5) NOT NULL,&lt;br /&gt;    Description nvarchar(300) NULL&lt;br /&gt;) ;&lt;br /&gt;GO&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;Other system Functions and Objects related to Sequence&lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;NEXT VALUE FOR &lt;/strong&gt;: Generates a sequence number from the specified sequence object. The NEXT VALUE FOR function can be used in stored procedures and triggers. This function also have few limitations you may want to read the details &lt;a href="http://msdn.microsoft.com/en-us/library/ff878370(v=sql.110).aspx"&gt;here &lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;Sys.Sequence &lt;/strong&gt;: Contains a row for each sequence object in a database. For more info refer this &lt;a href="http://msdn.microsoft.com/en-us/library/ff877934(v=sql.110).aspx"&gt;link &lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;sp_sequence_get_range:&lt;/strong&gt; Returns a range of sequence values from a sequence object. The sequence object generates and issues the number of values requested and provides the application with metadata related to the range.&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;Modify Sequence&lt;/strong&gt;&lt;br /&gt;ALTER SEQUNCE : Modifies the arguments of an existing sequence object. If the sequence was created with the CACHE option, altering the sequence will recreate the cache. For more info refer this &lt;a href="http://msdn.microsoft.com/en-us/library/ff878572(v=sql.110).aspx"&gt;link &lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;Drop a sequence&lt;/strong&gt;&lt;br /&gt;DROP SEQUENCE : After generating a number, a sequence object has no continuing relationship to the number it generated, so the sequence object can be dropped, even though the number generated is still in use. For more info refer this &lt;a href=" http://msdn.microsoft.com/en-us/library/ff878471(v=sql.110).aspx"&gt;link&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;Important Architectural Consideration and Limitations&lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;(a) By default Sequence uses BIGINT Datatype and it take 8 Byte. If the requirement is to store  small  number, then  change the datatype to TinyInt, Smallint or Int accordingly&lt;br /&gt;(b) If the starting value is not defined while creating, then SQL Server set it to the lowest value what that datatype can support.  So by default  if the datatype is BIGINT the starting number will be (-9,223,372,036,854,775,808) &lt;br /&gt;(c) The Increment cannot be 0. If the increment is a negative value, the sequence object is descending; otherwise, it is ascending. By default the increment is 1&lt;br /&gt;(d) If the requirement is to migrate Oracle Sequence to SQL Server, then select the datatype as Numeric(28,0)&lt;br /&gt;(e) Specify CYCLE/NOCYCLE  to define  the behavior if  t the sequence number reaches the maximum value&lt;br /&gt;(f) SQL Server as of CTP 3 does not support Current Value &lt;br /&gt;(g) Cache option is different from Oracle. In oracle by default database caches 20 Sequence but in SQL Server database engine select the size. If the cache option is enabled without specifying a cache size, the Database Engine will select a size. However, users should not rely upon the selection being consistent. Microsoft might change the method of calculating the cache size without notice. &lt;br /&gt;(h) Sequence objects support ownership chaining. If the sequence object has the same owner as the calling stored procedure, trigger, or table (having a sequence object as a default constraint), no permission check is required on the sequence object. If the sequence object is not owned by the same user as the calling stored procedure, trigger, or table, a permission check is required on the sequence object&lt;br /&gt;(i) Altering a column and Adding Identity is not possible in SQL Server. In such scenario if adding a new column with Identity , dropping the old column and renaming the new column is not possible then may be adding SEQUENCE  as a default can be a workaround&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;How does it differ from Identity Column?&lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;Sequences, unlike identity columns, are not associated with tables. An application refers to a sequence object to receive its next value. The relationship between sequences and tables is controlled by the application. User applications can reference a sequence object and coordinate the values keys across multiple rows and tables. &lt;br /&gt;Unlike identity columns, whose values cannot be changed, sequence values are not automatically protected after insertion into the table. To prevent sequence values from being changed, use an update trigger on the table to roll back changes.&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;Performance Comparison of Sequence and Identity&lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;Aaron Bertrand has covered this in detail. Check this &lt;a href="http://sqlblog.com/blogs/aaron_bertrand/archive/2010/11/11/sql-server-11-denali-using-sequence.aspx"&gt;Blog &lt;/a&gt;&lt;br /&gt;Other than this I did test one more case, Table with Identity and Table with Sequence as Default for PK. In the table where sequence was used, I did not provide value for the PK column so that default gets fired.  In this case Identity table insert perform almost 60% Better from a table with Sequence as default.   Script to Reproduce the scenario I tested is as follows :-&lt;br /&gt;&lt;br /&gt;-- Table with sequence as default &lt;br /&gt;&lt;br /&gt;CREATE TABLE [dbo].[SequencePerf](&lt;br /&gt; [EventID] [int] NOT NULL,&lt;br /&gt; [Description] [nvarchar](300) NULL,&lt;br /&gt;PRIMARY KEY CLUSTERED &lt;br /&gt;(&lt;br /&gt; [EventID] ASC&lt;br /&gt;)&lt;br /&gt;) ON [PRIMARY]&lt;br /&gt;&lt;br /&gt;GO&lt;br /&gt;&lt;br /&gt;ALTER TABLE [dbo].[SequencePerf] ADD  DEFAULT (NEXT VALUE FOR [Seq_EventId]) FOR [EventID]&lt;br /&gt;GO&lt;br /&gt;&lt;br /&gt; &lt;br /&gt;CREATE TABLE [dbo].[IdentityPerf](&lt;br /&gt; [EventID] [int] IDENTITY(1,1) NOT NULL,&lt;br /&gt; [Description] [nvarchar](300) NULL,&lt;br /&gt;PRIMARY KEY CLUSTERED &lt;br /&gt;(&lt;br /&gt; [EventID] ASC&lt;br /&gt;)&lt;br /&gt;) ON [PRIMARY]&lt;br /&gt;&lt;br /&gt;GO&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;-- Run both the insert in single batch and see the cost it take. In my case it was 71:29&lt;br /&gt;&lt;br /&gt; &lt;br /&gt;Insert [SequencePerf] (Description) &lt;br /&gt;Select top 100000 o.name From sys.objects o,sys.columns&lt;br /&gt;&lt;br /&gt;Insert [IdentityPerf] (Description) &lt;br /&gt;Select top 100000 o.name From sys.objects o,sys.columns &lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;Different Scenario of Sequence Usage in SQL Server&lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;Create database [TestDenali]&lt;br /&gt;GO&lt;br /&gt;&lt;br /&gt;USE [TestDenali]&lt;br /&gt;GO&lt;br /&gt;  CREATE SEQUENCE [dbo].[Seq_EventId] &lt;br /&gt;   AS [bigint]&lt;br /&gt;   START WITH 1&lt;br /&gt;   INCREMENT BY 1&lt;br /&gt;   MINVALUE 1&lt;br /&gt;   MAXVALUE 9223372036854775807&lt;br /&gt;   CYCLE &lt;br /&gt;   CACHE  200 &lt;br /&gt;  GO&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;   CREATE TABLE [dbo].[SequenceTest](&lt;br /&gt;   [EventID] [int] NOT NULL ,&lt;br /&gt;   [Description] [nvarchar](300) NULL,&lt;br /&gt;  PRIMARY KEY CLUSTERED &lt;br /&gt;  (&lt;br /&gt;   [EventID] ASC&lt;br /&gt;  ) &lt;br /&gt;  ) ON [PRIMARY]&lt;br /&gt;&lt;br /&gt;  GO&lt;br /&gt;&lt;br /&gt;  ALTER TABLE [dbo].[SequenceTest] ADD  DEFAULT (NEXT VALUE FOR [Seq_EventId]) FOR [EventID]&lt;br /&gt;  GO&lt;br /&gt;&lt;br /&gt;-- Not providing EventID value so that Default &lt;br /&gt;&lt;br /&gt;  INSERT INTO dbo.[SequenceTest](Description)  select top 100 Name from sys.objects&lt;br /&gt;&lt;br /&gt;--  Inserting bulk number of records , getting sequence in Select&lt;br /&gt;  INSERT INTO dbo.[SequenceTest] ([EventID],description) &lt;br /&gt;  SELECT   top 100   NEXT VALUE FOR  Seq_EventId AS SecondUse, Name from sys.objects&lt;br /&gt; &lt;br /&gt;-- Insert a single row &lt;br /&gt;&lt;br /&gt;  INSERT  [SequenceTest] ([EventID],description)&lt;br /&gt;   VALUES (NEXT VALUE FOR Seq_EventId, 'Test') ;&lt;br /&gt;&lt;br /&gt;-- Usage with SELECT INTO&lt;br /&gt;  SELECT NEXT VALUE FOR Seq_EventId AS EventID, Description &lt;br /&gt;   INTO [SequenceTest_clone]&lt;br /&gt;   FROM [SequenceTest] ;&lt;br /&gt;-- Temp table&lt;br /&gt;  SELECT NEXT VALUE FOR Seq_EventId AS EventID, Description &lt;br /&gt;   INTO [#SequenceTest_clone]&lt;br /&gt;   FROM [SequenceTest] ;&lt;br /&gt;&lt;br /&gt;-- Creating Temp table with Sequence as Defualt &lt;br /&gt;&lt;br /&gt;  CREATE TABLE #SequenceTest  (&lt;br /&gt;   [EventID] [int] NOT NULL DEFAULT (NEXT VALUE FOR Seq_EventId) ,&lt;br /&gt;   [Description] [nvarchar](300) NULL,&lt;br /&gt;  PRIMARY KEY CLUSTERED &lt;br /&gt;  (&lt;br /&gt;   [EventID] ASC&lt;br /&gt;  ) &lt;br /&gt;  ) ON [PRIMARY]&lt;br /&gt;&lt;br /&gt;  INSERT  #SequenceTest ([EventID],description)&lt;br /&gt;   VALUES (NEXT VALUE FOR Seq_EventId, 'Test') ;&lt;br /&gt;  INSERT  #SequenceTest ( description)&lt;br /&gt;   VALUES (   'Test') ;&lt;br /&gt;  Select *from #SequenceTest&lt;br /&gt;&lt;br /&gt;-- Creating Table Variable with Sequence as Default&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;  Declare  @SequenceTest TABLE (&lt;br /&gt;   [EventID] [int] NOT NULL DEFAULT (NEXT VALUE FOR Seq_EventId) ,&lt;br /&gt;   [Description] [nvarchar](300) NULL)&lt;br /&gt;&lt;br /&gt;  INSERT  @SequenceTest ([EventID],description)&lt;br /&gt;  VALUES (NEXT VALUE FOR Seq_EventId, 'Test') ;&lt;br /&gt;  INSERT  @SequenceTest ( description)&lt;br /&gt;  VALUES (   'Test') ;&lt;br /&gt;&lt;br /&gt;  Select *From @SequenceTest&lt;br /&gt;-- Table Valued Parameter&lt;br /&gt;CREATE TYPE [dbo].[SequenceTestTableType] AS TABLE&lt;br /&gt;(&lt;br /&gt;    [EventID] INT DEFAULT (NEXT VALUE FOR Seq_EventId), description VARCHAR(128)&lt;br /&gt;)&lt;br /&gt;/*&lt;br /&gt;Msg 11719, Level 15, State 1, Line 3&lt;br /&gt;NEXT VALUE FOR function is not allowed in check constraints, default objects, computed columns, views, &lt;br /&gt;user-defined functions, user-defined aggregates, sub-queries, common table expressions, or derived tables.&lt;br /&gt;*/&lt;br /&gt;&lt;br /&gt;Create view vwTestSequence&lt;br /&gt;as&lt;br /&gt;SELECT   top 10000  NEXT VALUE FOR  Seq_EventId AS SecondUse,description FROM dbo.Sequencetest&lt;br /&gt;&lt;br /&gt;/*&lt;br /&gt;Msg 11719, Level 15, State 1, Procedure vwTestSequence, Line 4&lt;br /&gt;NEXT VALUE FOR function is not allowed in check constraints, default objects, computed columns, views,&lt;br /&gt; user-defined functions, user-defined aggregates, sub-queries, common table expressions, or derived tables.&lt;br /&gt;&lt;br /&gt;*/&lt;br /&gt;&lt;br /&gt;-- Capture the Inserted Sequencenumber using OUTPUT. In SuperType-Subtype scenario may be usefule&lt;br /&gt;Declare @tab table (Eventid int) &lt;br /&gt;Insert [SequencePerf] (Description) OUTPUT inserted.[EventID] Into @tab&lt;br /&gt;Select top 100000 o.name From sys.objects o,sys.columns&lt;br /&gt;SELECT *From @tab&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;Reference &lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;http://sqlblog.com/blogs/aaron_bertrand/archive/2010/11/11/sql-server-11-denali-using-sequence.aspx&lt;br /&gt;http://blogs.msdn.com/b/ssma/archive/2011/07/12/converting-oracle-sequence-using-ssma-for-oracle-v5-1.aspx&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1146926327588070502-8722146295965160887?l=madhuottapalam.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://madhuottapalam.blogspot.com/feeds/8722146295965160887/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=1146926327588070502&amp;postID=8722146295965160887' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1146926327588070502/posts/default/8722146295965160887'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1146926327588070502/posts/default/8722146295965160887'/><link rel='alternate' type='text/html' href='http://madhuottapalam.blogspot.com/2011/07/sql-server-new-version-denali-new.html' title='SQL Server New Version Denali - New Feature Sequence'/><author><name>Madhu K Nair</name><uri>http://www.blogger.com/profile/08936146465563191414</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='30' height='32' src='http://1.bp.blogspot.com/_4wBIz276vTw/TKtTNRq6sZI/AAAAAAAAASA/DVQPmnwt50c/S220/Madhu.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1146926327588070502.post-7542018308276364941</id><published>2011-07-23T00:50:00.001-07:00</published><updated>2011-07-30T01:37:45.362-07:00</updated><title type='text'>SQL Server New Version - Denali - Step by Step Installation</title><content type='html'>SQL Server 2011 – Denali CTP 3 is recently released and as usual there are many new features which will enhance SQL Server footprint in Enterprise Database arena. The main advantage with Microsoft what I see is, they have all three layer in their control ie. Operating system , Database and Programming languages. They can leverage this freedom and integrate all these three layer well and come up with good end products which of course have a limitation of Only on Windows platform. This is the reason why we have great tool like Management Studio which is powered by Visual Studio and makes database administrators /developers/users life easy.  &lt;br /&gt;&lt;br /&gt;The major new configuration change in installation process is Distributed Reply Component Configuration. This component enable Realtime stress Workload testing against your  database server.   If you don’t want to install this option while selecting services don’t opt “Distributor Replay Controller” and “Distributed Replay Controller Client”&lt;br /&gt;&lt;br /&gt;Another new service you can see while installation is “Data Quality Service”.  This is a new feature added in Denali for knowledge-driven data cleansing solution. &lt;br /&gt;You may want to see the FAQ &lt;a href="http://social.technet.microsoft.com/wiki/contents/articles/3919.aspx "&gt;link &lt;/a&gt;for DQS… &lt;br /&gt;&lt;br /&gt;For any installation you must be aware of the Hardware and software requirement. So for Denali. Here is the &lt;a href="http://msdn.microsoft.com/en-us/library/ms143506(v=sql.110).aspx"&gt;link &lt;/a&gt;for Pre-requisite&lt;br /&gt;&lt;br /&gt;Once you ensure that you have a system which meets the mentioned hardware and software requirement , here is the next steps&lt;br /&gt;&lt;br /&gt;SQL Server Code-Named “Denali” Evaluation Edition is supported on the Windows Vista SP2, Windows Server 2008 SP2, Windows 2008 R2 SP1, and Windows 7 SP1 operating systems.&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;Pre-Installation Steps&lt;/strong&gt;&lt;br /&gt;• Refer the above mentioned sites and ensured that your system meet all the requirements&lt;br /&gt;• Ensure that you have planned your Instance name if it is a named Instance&lt;br /&gt;• Ensure that you have planned all the Data Directory. Ie. Where to keep System Databases, TempDB, and User Databases.(if not you can go by Default but it is not generally recommended).&lt;br /&gt;• Ensure that you have planned Startup Account for all the services. (if not you can go by Default but it is not generally recommended.)&lt;br /&gt;• Ensure that you have a list of features that you wants to install. Like if you are not going to use Filestream no need to configure that during installation&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;My System Configuration&lt;/strong&gt;&lt;br /&gt;• Operating System : Windows Vista SP2&lt;br /&gt;• Existing SQL Server Instance &lt;br /&gt;o Default Instance : SQL Server 2008 SP 1&lt;br /&gt;o Named Instance 1: SQL Server 2008 RTM&lt;br /&gt;o Named Instance 2 : SQL Server 2008 R2 RTM&lt;br /&gt;   Named Instance 3 : SQL Server 2005 Express Edition SP3  &lt;br /&gt;&lt;br /&gt;Step 1 : Download the Binary from http http://www.microsoft.com/sqlserver/en/us/future-editions.aspx&lt;br /&gt;&lt;br /&gt;Step 2 : Extract the downloaded binary and start installation as shown below&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;Figure 1&lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;&lt;div&gt;&lt;a href="http://3.bp.blogspot.com/-GGZIY82-keo/Tip_KDw2BJI/AAAAAAAAATU/WLbmJCGF9CA/s1600/Screen1.jpg"&gt;&lt;img style="WIDTH: 320px; HEIGHT: 106px; CURSOR: hand" id="BLOGGER_PHOTO_ID_5632454094765819026" border="0" alt="" src="http://3.bp.blogspot.com/-GGZIY82-keo/Tip_KDw2BJI/AAAAAAAAATU/WLbmJCGF9CA/s320/Screen1.jpg" /&gt;&lt;/a&gt; &lt;/div&gt;&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;Figure 2&lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;&lt;a href="http://3.bp.blogspot.com/-NUjv9YaS1gU/TiqAI4PvKLI/AAAAAAAAATk/tU-8m9QU1e0/s1600/Screen2.jpg"&gt;&lt;img style="cursor:pointer; cursor:hand;width: 320px; height: 241px;" src="http://3.bp.blogspot.com/-NUjv9YaS1gU/TiqAI4PvKLI/AAAAAAAAATk/tU-8m9QU1e0/s320/Screen2.jpg" border="0" alt=""id="BLOGGER_PHOTO_ID_5632455174005926066" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;Figure 3&lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;&lt;a href="http://2.bp.blogspot.com/-CH__YDPEy78/Tir0_bEgABI/AAAAAAAAATs/w9e2Xuo5Ros/s1600/Screen3.jpg"&gt;&lt;img style="cursor:pointer; cursor:hand;width: 320px; height: 241px;" src="http://2.bp.blogspot.com/-CH__YDPEy78/Tir0_bEgABI/AAAAAAAAATs/w9e2Xuo5Ros/s320/Screen3.jpg" border="0" alt=""id="BLOGGER_PHOTO_ID_5632583654415794194" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;Figure 4&lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;&lt;a href="http://4.bp.blogspot.com/-_JiwYj7Ohng/Tir2gHWHJxI/AAAAAAAAAUM/qVzXMp32JjM/s1600/Screen4.jpg"&gt;&lt;img style="cursor:pointer; cursor:hand;width: 320px; height: 241px;" src="http://4.bp.blogspot.com/-_JiwYj7Ohng/Tir2gHWHJxI/AAAAAAAAAUM/qVzXMp32JjM/s320/Screen4.jpg" border="0" alt=""id="BLOGGER_PHOTO_ID_5632585315568264978" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;Figure 5&lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;&lt;a href="http://1.bp.blogspot.com/-xEw1NH-KAeI/Tir2s0ytyfI/AAAAAAAAAUU/1gJq7mFgU-Q/s1600/Screen5.jpg"&gt;&lt;img style="cursor:pointer; cursor:hand;width: 320px; height: 241px;" src="http://1.bp.blogspot.com/-xEw1NH-KAeI/Tir2s0ytyfI/AAAAAAAAAUU/1gJq7mFgU-Q/s320/Screen5.jpg" border="0" alt=""id="BLOGGER_PHOTO_ID_5632585533926263282" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;Figure 6&lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;&lt;a href="http://1.bp.blogspot.com/-rpy7GoEfg6E/Tir3t0VN2dI/AAAAAAAAAVk/lRgl1x0UbIA/s1600/Screen6.jpg"&gt;&lt;img style="cursor:pointer; cursor:hand;width: 320px; height: 241px;" src="http://1.bp.blogspot.com/-rpy7GoEfg6E/Tir3t0VN2dI/AAAAAAAAAVk/lRgl1x0UbIA/s320/Screen6.jpg" border="0" alt=""id="BLOGGER_PHOTO_ID_5632586650494032338" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;Figure 7&lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;&lt;a href="http://4.bp.blogspot.com/-kGczinn1NhI/Tir3pF2fgqI/AAAAAAAAAVc/cYKwa4qLYrE/s1600/Screen7.jpg"&gt;&lt;img style="cursor:pointer; cursor:hand;width: 320px; height: 241px;" src="http://4.bp.blogspot.com/-kGczinn1NhI/Tir3pF2fgqI/AAAAAAAAAVc/cYKwa4qLYrE/s320/Screen7.jpg" border="0" alt=""id="BLOGGER_PHOTO_ID_5632586569297658530" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;Figure 8&lt;/strong&gt;&lt;br /&gt;&lt;a href="http://2.bp.blogspot.com/-UTO_bOogsuI/Tir3h0yS6_I/AAAAAAAAAVU/zlEfiRI8EwE/s1600/Screen8.jpg"&gt;&lt;img style="cursor:pointer; cursor:hand;width: 320px; height: 241px;" src="http://2.bp.blogspot.com/-UTO_bOogsuI/Tir3h0yS6_I/AAAAAAAAAVU/zlEfiRI8EwE/s320/Screen8.jpg" border="0" alt=""id="BLOGGER_PHOTO_ID_5632586444457569266" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;Figure 9&lt;/strong&gt;&lt;br /&gt;&lt;a href="http://1.bp.blogspot.com/-bwWEZsxza9k/Tir3dIygxBI/AAAAAAAAAVM/jWJJ54GYiFU/s1600/Screen9.jpg"&gt;&lt;img style="cursor:pointer; cursor:hand;width: 320px; height: 241px;" src="http://1.bp.blogspot.com/-bwWEZsxza9k/Tir3dIygxBI/AAAAAAAAAVM/jWJJ54GYiFU/s320/Screen9.jpg" border="0" alt=""id="BLOGGER_PHOTO_ID_5632586363927839762" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;Figure 10&lt;/strong&gt;&lt;br /&gt;&lt;a href="http://2.bp.blogspot.com/-IlcEk1eweLg/Tir3YnsrJGI/AAAAAAAAAVE/7C5-egdkkdc/s1600/Screen10.jpg"&gt;&lt;img style="cursor:pointer; cursor:hand;width: 320px; height: 241px;" src="http://2.bp.blogspot.com/-IlcEk1eweLg/Tir3YnsrJGI/AAAAAAAAAVE/7C5-egdkkdc/s320/Screen10.jpg" border="0" alt=""id="BLOGGER_PHOTO_ID_5632586286325507170" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;Figure 11&lt;/strong&gt;&lt;br /&gt;&lt;a href="http://2.bp.blogspot.com/-woaX8WXDO00/Tir3TXEEBFI/AAAAAAAAAU8/IjdvbkEqeY0/s1600/Screen11.jpg"&gt;&lt;img style="cursor:pointer; cursor:hand;width: 320px; height: 241px;" src="http://2.bp.blogspot.com/-woaX8WXDO00/Tir3TXEEBFI/AAAAAAAAAU8/IjdvbkEqeY0/s320/Screen11.jpg" border="0" alt=""id="BLOGGER_PHOTO_ID_5632586195960857682" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;Figure 12&lt;/strong&gt;&lt;br /&gt;&lt;a href="http://3.bp.blogspot.com/-5gf0d9KyXG0/Tir3OrjczPI/AAAAAAAAAU0/52H8XbOnBPY/s1600/Screen12.jpg"&gt;&lt;img style="cursor:pointer; cursor:hand;width: 320px; height: 241px;" src="http://3.bp.blogspot.com/-5gf0d9KyXG0/Tir3OrjczPI/AAAAAAAAAU0/52H8XbOnBPY/s320/Screen12.jpg" border="0" alt=""id="BLOGGER_PHOTO_ID_5632586115561868530" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;Figure 13&lt;/strong&gt;&lt;br /&gt;&lt;a href="http://4.bp.blogspot.com/-ZMaIlNE4P2E/Tir3JXUqGfI/AAAAAAAAAUs/ru0cwr8fm80/s1600/Screen13.jpg"&gt;&lt;img style="cursor:pointer; cursor:hand;width: 320px; height: 241px;" src="http://4.bp.blogspot.com/-ZMaIlNE4P2E/Tir3JXUqGfI/AAAAAAAAAUs/ru0cwr8fm80/s320/Screen13.jpg" border="0" alt=""id="BLOGGER_PHOTO_ID_5632586024231770610" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;Figure 14&lt;/strong&gt;&lt;br /&gt;&lt;a href="http://1.bp.blogspot.com/-KjFcVWDK6MU/Tir3BOIkyWI/AAAAAAAAAUk/PuQOSVx5sCA/s1600/Screen14.jpg"&gt;&lt;img style="cursor:pointer; cursor:hand;width: 224px; height: 320px;" src="http://1.bp.blogspot.com/-KjFcVWDK6MU/Tir3BOIkyWI/AAAAAAAAAUk/PuQOSVx5sCA/s320/Screen14.jpg" border="0" alt=""id="BLOGGER_PHOTO_ID_5632585884326218082" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;Figure 15&lt;/strong&gt;&lt;br /&gt;&lt;a href="http://2.bp.blogspot.com/-NZ7yJicAYGs/Tir25ICt4-I/AAAAAAAAAUc/UoN8PF4hfkg/s1600/Screen15.jpg"&gt;&lt;img style="cursor:pointer; cursor:hand;width: 320px; height: 241px;" src="http://2.bp.blogspot.com/-NZ7yJicAYGs/Tir25ICt4-I/AAAAAAAAAUc/UoN8PF4hfkg/s320/Screen15.jpg" border="0" alt=""id="BLOGGER_PHOTO_ID_5632585745252082658" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;Figure 16&lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;&lt;a href="http://2.bp.blogspot.com/--Ory-BYR9kU/TisQHGcMzAI/AAAAAAAAAWk/vVvIlyQ6ji4/s1600/Screen16.jpg"&gt;&lt;img style="cursor:pointer; cursor:hand;width: 320px; height: 241px;" src="http://2.bp.blogspot.com/--Ory-BYR9kU/TisQHGcMzAI/AAAAAAAAAWk/vVvIlyQ6ji4/s320/Screen16.jpg" border="0" alt=""id="BLOGGER_PHOTO_ID_5632613473130957826" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;Figure 17&lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;&lt;a href="http://2.bp.blogspot.com/-GSTyEawhlqs/TisQCqW6OWI/AAAAAAAAAWc/xIOrobgEgDs/s1600/Screen17.jpg"&gt;&lt;img style="cursor:pointer; cursor:hand;width: 320px; height: 241px;" src="http://2.bp.blogspot.com/-GSTyEawhlqs/TisQCqW6OWI/AAAAAAAAAWc/xIOrobgEgDs/s320/Screen17.jpg" border="0" alt=""id="BLOGGER_PHOTO_ID_5632613396873099618" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;Figure 18&lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;&lt;a href="http://3.bp.blogspot.com/-oQkv5502mDI/TisP8oCf0iI/AAAAAAAAAWU/XuVsO2Rcaec/s1600/Screen18.jpg"&gt;&lt;img style="cursor:pointer; cursor:hand;width: 320px; height: 241px;" src="http://3.bp.blogspot.com/-oQkv5502mDI/TisP8oCf0iI/AAAAAAAAAWU/XuVsO2Rcaec/s320/Screen18.jpg" border="0" alt=""id="BLOGGER_PHOTO_ID_5632613293171397154" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;Figure 19&lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;&lt;a href="http://1.bp.blogspot.com/-qs6V9trQEWA/TisP39MwH2I/AAAAAAAAAWM/WPTpM81kUQA/s1600/Screen19.jpg"&gt;&lt;img style="cursor:pointer; cursor:hand;width: 320px; height: 241px;" src="http://1.bp.blogspot.com/-qs6V9trQEWA/TisP39MwH2I/AAAAAAAAAWM/WPTpM81kUQA/s320/Screen19.jpg" border="0" alt=""id="BLOGGER_PHOTO_ID_5632613212952207202" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;Figure 20&lt;/strong&gt;&lt;br /&gt;&lt;br /&gt; &lt;a href="http://3.bp.blogspot.com/-3HcaIxepjJs/TisPkg_HM0I/AAAAAAAAAV8/0a3c6ayU7-g/s1600/Screen20.jpg"&gt;&lt;img style="cursor:pointer; cursor:hand;width: 320px; height: 241px;" src="http://3.bp.blogspot.com/-3HcaIxepjJs/TisPkg_HM0I/AAAAAAAAAV8/0a3c6ayU7-g/s320/Screen20.jpg" border="0" alt=""id="BLOGGER_PHOTO_ID_5632612878961292098" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;Figure 21&lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;a href="http://3.bp.blogspot.com/--AIpqC0OW-M/TisPklh_6gI/AAAAAAAAAV0/-UF9jIA_A3E/s1600/Screen21.jpg"&gt;&lt;img style="cursor:pointer; cursor:hand;width: 320px; height: 241px;" src="http://3.bp.blogspot.com/--AIpqC0OW-M/TisPklh_6gI/AAAAAAAAAV0/-UF9jIA_A3E/s320/Screen21.jpg" border="0" alt=""id="BLOGGER_PHOTO_ID_5632612880181357058" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;Figure 22&lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;&lt;a href="http://1.bp.blogspot.com/-jP6moI4s6Fc/TisPWBTDFGI/AAAAAAAAAVs/gd3VoB1IwwA/s1600/Screen22.jpg"&gt;&lt;img style="cursor:pointer; cursor:hand;width: 320px; height: 241px;" src="http://1.bp.blogspot.com/-jP6moI4s6Fc/TisPWBTDFGI/AAAAAAAAAVs/gd3VoB1IwwA/s320/Screen22.jpg" border="0" alt=""id="BLOGGER_PHOTO_ID_5632612629936804962" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;Figure 23&lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;&lt;a href="http://3.bp.blogspot.com/-U3LPgHooCWQ/TisSjdQsRrI/AAAAAAAAAWs/RH1yhyjaUgA/s1600/Screen23.jpg"&gt;&lt;img style="cursor:pointer; cursor:hand;width: 320px; height: 194px;" src="http://3.bp.blogspot.com/-U3LPgHooCWQ/TisSjdQsRrI/AAAAAAAAAWs/RH1yhyjaUgA/s320/Screen23.jpg" border="0" alt=""id="BLOGGER_PHOTO_ID_5632616159316297394" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;Summary : I had SQL Server 2005 Express Edition, SQL Server 2008 Developer Edition, SQL Server 2008 R2 Evaluation Edition on my Machine and all of these instance in the first look working fine. Not found any abnormal behaviour so far. Hope all these versions can co-exists.  My SQL Server 2011 CP3 is installed and good to go&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1146926327588070502-7542018308276364941?l=madhuottapalam.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://madhuottapalam.blogspot.com/feeds/7542018308276364941/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=1146926327588070502&amp;postID=7542018308276364941' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1146926327588070502/posts/default/7542018308276364941'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1146926327588070502/posts/default/7542018308276364941'/><link rel='alternate' type='text/html' href='http://madhuottapalam.blogspot.com/2011/07/sql-server-2011-denali-step-by-step.html' title='SQL Server New Version - Denali - Step by Step Installation'/><author><name>Madhu K Nair</name><uri>http://www.blogger.com/profile/08936146465563191414</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='30' height='32' src='http://1.bp.blogspot.com/_4wBIz276vTw/TKtTNRq6sZI/AAAAAAAAASA/DVQPmnwt50c/S220/Madhu.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://3.bp.blogspot.com/-GGZIY82-keo/Tip_KDw2BJI/AAAAAAAAATU/WLbmJCGF9CA/s72-c/Screen1.jpg' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1146926327588070502.post-3045192512140944816</id><published>2009-11-29T03:54:00.001-08:00</published><updated>2009-11-29T04:04:27.290-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='FAQ'/><category scheme='http://www.blogger.com/atom/ns#' term='Table Partition'/><title type='text'>FAQ : What is Partition Scheme in SQL Server?</title><content type='html'>Once you have created the Partition Function then the next step is to create Partition Scheme.  As already mentioned, One partition function may have one or more Partition Scheme. . The partition scheme defines how any resulting partitions will be stored on filegroups. You list the filegroups for a partition scheme in the same order that you want to have them map to the partitions defined by the partition function. Creating a partition scheme assumes that you have already created the filegroups. You can mention ALL TO keyword to create all the partition to a single filegroup. &lt;br /&gt;&lt;br /&gt;Eg. From BOL&lt;br /&gt;CREATE PARTITION FUNCTION myRangePF1 (int)&lt;br /&gt;AS RANGE LEFT FOR VALUES (1, 100, 1000);&lt;br /&gt;GO&lt;br /&gt;CREATE PARTITION SCHEME myRangePS1&lt;br /&gt;AS PARTITION myRangePF1&lt;br /&gt;TO (test1fg, test2fg, test3fg, test4fg);&lt;br /&gt;&lt;br /&gt;Edit : Should Filegroup single file or multiple files considered as out of scope in this context. But selecting single filegroup VS multiple filegroup and Single files per filegroup VS multiple files also a significant decision to be made in terms of performance.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1146926327588070502-3045192512140944816?l=madhuottapalam.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://madhuottapalam.blogspot.com/feeds/3045192512140944816/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=1146926327588070502&amp;postID=3045192512140944816' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1146926327588070502/posts/default/3045192512140944816'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1146926327588070502/posts/default/3045192512140944816'/><link rel='alternate' type='text/html' href='http://madhuottapalam.blogspot.com/2009/11/faq-what-is-partition-scheme-in-sql.html' title='FAQ : What is Partition Scheme in SQL Server?'/><author><name>Madhu K Nair</name><uri>http://www.blogger.com/profile/08936146465563191414</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='30' height='32' src='http://1.bp.blogspot.com/_4wBIz276vTw/TKtTNRq6sZI/AAAAAAAAASA/DVQPmnwt50c/S220/Madhu.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1146926327588070502.post-2737232733092156438</id><published>2009-11-28T20:19:00.000-08:00</published><updated>2009-11-28T21:21:35.934-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='FAQ'/><category scheme='http://www.blogger.com/atom/ns#' term='Table Partition'/><title type='text'>FAQ : What is Partition Function in SQL Server?</title><content type='html'>Partition functions are special kind of objects (of course created by user) created in a database which can be used only by partition scheme.  Partition function contains a data type , that must be the same data type as the partition column chosen in the table.  Partition Function as such not directly related to any table. &lt;br /&gt;&lt;br /&gt;NOTE: Even though Partition Function to Partition scheme is One to Many, in sliding window scenario moving data between in and out of partition is a common requirement, which require Partition function modification. So practically it makes each Partition table should have exclusive partition function and scheme. &lt;br /&gt;Partition functions are not user defined functions.  &lt;br /&gt;&lt;br /&gt;&lt;strong&gt;Here are few of facts to be known about partition functions&lt;/strong&gt;• Partition functions are not listed as database objects in the sys.all_objects or sys.objects system tables; instead, you can find them listed in sys.partition_functions.&lt;br /&gt;• Partition functions are not contained by a database schema.&lt;br /&gt;• Special commands must be used for creating, altering, and dropping a partition function: &lt;br /&gt;         o CREATE PARTITION FUNCTION&lt;br /&gt;         o ALTER PARTITION FUNCTION&lt;br /&gt;         o DROP PARTITION FUNCTION&lt;br /&gt;• Partition functions can be invoked interactively in Transact-SQL by using the $PARTITION function.&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;Partition Functions System Objects &lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;• sys.partition_functions : Contains a row for each partition function.&lt;br /&gt;• sys.partition_range_values : Contains a row for each range boundary value of a partition function of type R.&lt;br /&gt;• sys.partition_parameters  : Contains a row for each parameter of a partition function.&lt;br /&gt;• $PARTITION. :Returns the partition number into which a set of partitioning column values would be mapped for any specified partition function. &lt;br /&gt;Eg. SELECT $PARTITION.RangePF1 (10) ;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1146926327588070502-2737232733092156438?l=madhuottapalam.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://madhuottapalam.blogspot.com/feeds/2737232733092156438/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=1146926327588070502&amp;postID=2737232733092156438' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1146926327588070502/posts/default/2737232733092156438'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1146926327588070502/posts/default/2737232733092156438'/><link rel='alternate' type='text/html' href='http://madhuottapalam.blogspot.com/2009/11/faq-what-is-partition-function-in-sql.html' title='FAQ : What is Partition Function in SQL Server?'/><author><name>Madhu K Nair</name><uri>http://www.blogger.com/profile/08936146465563191414</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='30' height='32' src='http://1.bp.blogspot.com/_4wBIz276vTw/TKtTNRq6sZI/AAAAAAAAASA/DVQPmnwt50c/S220/Madhu.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1146926327588070502.post-9189555332055774627</id><published>2009-11-27T19:59:00.001-08:00</published><updated>2009-11-28T20:06:18.366-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Guidelines for table partitioning'/><category scheme='http://www.blogger.com/atom/ns#' term='FAQ'/><category scheme='http://www.blogger.com/atom/ns#' term='Advantage of Disadvantage of Table Partitioning'/><title type='text'>FAQ : What is the advantages and disadvantages of Table Partitioning of 2005 over Partition View of earlier versions?</title><content type='html'>&lt;strong&gt;Advantage of Table Partitioning &lt;/strong&gt;&lt;br /&gt;• No need to create separate physical tables for each ranges manually.&lt;br /&gt;• There are few limitations when you insert data into Partition View like you cannot use BULK INSERT/BCP etc. &lt;br /&gt;• Less complex to manage and administrate&lt;br /&gt;• SQL Server automatically manages the placement of data in the proper partitions.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;Disadvantage  of Table Partitioning&lt;/strong&gt;&lt;br /&gt;• Major disadvantage is, we cannot have different index model for different range. Ie. In general, we may need to have more number of indexes when the data is READ ONLY and less or different index model for the data which is READWRITE. That is not possible with partition table.&lt;br /&gt;• You cannot rebuild a partitioned index with the ONLINE option set to ON, because the entire table will be locked during the rebuild.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1146926327588070502-9189555332055774627?l=madhuottapalam.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://madhuottapalam.blogspot.com/feeds/9189555332055774627/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=1146926327588070502&amp;postID=9189555332055774627' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1146926327588070502/posts/default/9189555332055774627'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1146926327588070502/posts/default/9189555332055774627'/><link rel='alternate' type='text/html' href='http://madhuottapalam.blogspot.com/2009/11/faq-what-is-advantages-and.html' title='FAQ : What is the advantages and disadvantages of Table Partitioning of 2005 over Partition View of earlier versions?'/><author><name>Madhu K Nair</name><uri>http://www.blogger.com/profile/08936146465563191414</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='30' height='32' src='http://1.bp.blogspot.com/_4wBIz276vTw/TKtTNRq6sZI/AAAAAAAAASA/DVQPmnwt50c/S220/Madhu.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1146926327588070502.post-1111496522971371985</id><published>2009-11-27T19:18:00.000-08:00</published><updated>2009-11-29T03:57:16.428-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='FAQ'/><category scheme='http://www.blogger.com/atom/ns#' term='Table Partition'/><title type='text'>Partition is not recommended for a table in following condition</title><content type='html'>1. If you want to have different indexing structure for READ ONLY and READ WRITE data then partition is not recommended. &lt;br /&gt;2. If the table is not accessed much or do not required much index maintenance &lt;br /&gt;3. If the query on the tables are filtered(WHERE  condition) by some column which cannot be used for partitioned.&lt;br /&gt;4. If you planning to use ONLINE INDEX REBUILD option you cannot use partition. You cannot rebuild a partitioned index with the ONLINE option set to ON, because the entire table will be locked during the rebuild.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1146926327588070502-1111496522971371985?l=madhuottapalam.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://madhuottapalam.blogspot.com/feeds/1111496522971371985/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=1146926327588070502&amp;postID=1111496522971371985' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1146926327588070502/posts/default/1111496522971371985'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1146926327588070502/posts/default/1111496522971371985'/><link rel='alternate' type='text/html' href='http://madhuottapalam.blogspot.com/2009/11/partition-is-not-suited-for-table-in.html' title='Partition is not recommended for a table in following condition'/><author><name>Madhu K Nair</name><uri>http://www.blogger.com/profile/08936146465563191414</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='30' height='32' src='http://1.bp.blogspot.com/_4wBIz276vTw/TKtTNRq6sZI/AAAAAAAAASA/DVQPmnwt50c/S220/Madhu.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1146926327588070502.post-846583908799657454</id><published>2009-11-27T19:13:00.000-08:00</published><updated>2009-11-27T23:17:10.367-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Guidelines for table partitioning'/><category scheme='http://www.blogger.com/atom/ns#' term='FAQ'/><category scheme='http://www.blogger.com/atom/ns#' term='Table Partition'/><title type='text'>FAQ: How to determine partition suits for a table  ?</title><content type='html'>There are few general guidelines for determining whether the partition feature is suited for a table  or not.  One point to be noted here is, if a table is not partitioned properly (ie. Not selected the most suitable partition column), though it will not adversely affect the performance but  it will not give any performance benefit either.   Remember that the query optimizer can limit the partitions that are scanned to resolve a query only if the query filters on the partitioning column.  Precisely, just because the table is partitioned, we will not have performance benefit. &lt;br /&gt;&lt;br /&gt;1. First of all,  just because of a table is big, it should not be partitioned. Ie. Only size of the table cannot  be "THE" criteria for partition.  &lt;br /&gt;2. If the index maintenance on a table is time consuming or make the table offline for the users, you may opt partition because re-indexing on only required partition is better than re-indexing the whole table. Partitioning a large table divides the table and its indexes into smaller partitions, so that maintenance operations can be applied on a partition-by-partition basis, rather than on the entire table.&lt;br /&gt;3. You can go for  partition if the data must be aged out of the table (archived) periodically  and the current delete process is taking time or blocking other users.&lt;br /&gt;4. If the table is loaded with new data periodically and the loading process takes time and the table data lends itself to a partition column based on ascending date or time we may go for partition. &lt;br /&gt;5. Table backup of huge table can be managed smartly by using new backup features of sql server 2005 and partitioning. &lt;br /&gt;6. To summarize, the best way to put this in single statement is, if you have any table which fits into SLIDING WINDOW scenario you must partition it.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1146926327588070502-846583908799657454?l=madhuottapalam.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://madhuottapalam.blogspot.com/feeds/846583908799657454/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=1146926327588070502&amp;postID=846583908799657454' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1146926327588070502/posts/default/846583908799657454'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1146926327588070502/posts/default/846583908799657454'/><link rel='alternate' type='text/html' href='http://madhuottapalam.blogspot.com/2009/11/faq-how-to-determine-partition-suits.html' title='FAQ: How to determine partition suits for a table  ?'/><author><name>Madhu K Nair</name><uri>http://www.blogger.com/profile/08936146465563191414</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='30' height='32' src='http://1.bp.blogspot.com/_4wBIz276vTw/TKtTNRq6sZI/AAAAAAAAASA/DVQPmnwt50c/S220/Madhu.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1146926327588070502.post-5402308578352063261</id><published>2009-11-27T19:09:00.000-08:00</published><updated>2009-11-27T23:17:24.279-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='FAQ'/><category scheme='http://www.blogger.com/atom/ns#' term='Vertical Partition'/><category scheme='http://www.blogger.com/atom/ns#' term='Horizontal Partition'/><category scheme='http://www.blogger.com/atom/ns#' term='Table Partition'/><title type='text'>FAQ: What all are the types of table partitions in SQL Server</title><content type='html'>There are two types of partitions. Horizontal and vertical.&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;Horizontal partition &lt;/strong&gt;&lt;br /&gt;Horizontal partition divides the data on subset of rows. Ie.  Divide the data in such a way that all the rows of single year /month /week(Range) may be in one partition kind.  In earlier versions of SQL Server this method was achieved by creating physical tables for each subsets and UNION the tables using a View(Partition View) and application access the data using Views.  &lt;br /&gt;&lt;br /&gt;&lt;strong&gt;Vertical partition &lt;/strong&gt;&lt;br /&gt;In Vertical Partition , the columns of a very wide table are spread across multiple physical tables containing distinct subsets of the columns with the same number of rows. The relation would be ONE TO ONE among the tables.  The result is multiple tables containing the same number of rows but different columns, usually with the same primary key column in each table. Often a view is defined across the multiple tables and queries directed against the view.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1146926327588070502-5402308578352063261?l=madhuottapalam.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://madhuottapalam.blogspot.com/feeds/5402308578352063261/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=1146926327588070502&amp;postID=5402308578352063261' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1146926327588070502/posts/default/5402308578352063261'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1146926327588070502/posts/default/5402308578352063261'/><link rel='alternate' type='text/html' href='http://madhuottapalam.blogspot.com/2009/11/faq-what-all-are-types-of-table.html' title='FAQ: What all are the types of table partitions in SQL Server'/><author><name>Madhu K Nair</name><uri>http://www.blogger.com/profile/08936146465563191414</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='30' height='32' src='http://1.bp.blogspot.com/_4wBIz276vTw/TKtTNRq6sZI/AAAAAAAAASA/DVQPmnwt50c/S220/Madhu.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1146926327588070502.post-4450974510069158876</id><published>2009-11-27T19:08:00.001-08:00</published><updated>2009-11-28T08:35:33.710-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='FAQ'/><category scheme='http://www.blogger.com/atom/ns#' term='Table Partition'/><title type='text'>FAQ : What is Table Partitioning in SQL Server?</title><content type='html'>Partitioning is the process of dividing data into small , more manageable chunks. We can divide the data horizontally (on rows ) or vertically (on columns) . Table partitioning can make very large tables and indexes easier to manage, and improve the performance of APPROPRIATELY FILTERED queries. Horizontal Partitioning  is one of the new feature added in SQL Server 2005  (in earlier versions we used to create separate physical table and create a wrapper view which union all the tables which is also known as Partition View). When a table is created as a partitioned table, SQL Server automatically places the table's rows in the correct partition, and SQL Server maintains the partitions behind the scenes. You can then perform maintenance operations on individual partitions, and properly filtered queries will access only the correct partitions. But it is still one table as far as SQL Server is concerned&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1146926327588070502-4450974510069158876?l=madhuottapalam.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://madhuottapalam.blogspot.com/feeds/4450974510069158876/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=1146926327588070502&amp;postID=4450974510069158876' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1146926327588070502/posts/default/4450974510069158876'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1146926327588070502/posts/default/4450974510069158876'/><link rel='alternate' type='text/html' href='http://madhuottapalam.blogspot.com/2009/11/faq-what-is-table-partitioning-in-sql.html' title='FAQ : What is Table Partitioning in SQL Server?'/><author><name>Madhu K Nair</name><uri>http://www.blogger.com/profile/08936146465563191414</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='30' height='32' src='http://1.bp.blogspot.com/_4wBIz276vTw/TKtTNRq6sZI/AAAAAAAAASA/DVQPmnwt50c/S220/Madhu.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1146926327588070502.post-2678589916624958983</id><published>2009-11-23T03:52:00.000-08:00</published><updated>2009-11-23T03:56:38.027-08:00</updated><title type='text'>Error : CREATE FILE encountered operating system error 32(The process cannot access the file because it is being used by another process.</title><content type='html'>One of the common reason for this error is, when we try to attach a MDF file which is already attached (to the same instance or any other instance) we get this error. So the solution is this, if you get this error when you try to attach a MDF file, then ensure that the file is not accessed by any other process or attached to any SQL Server instance already.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1146926327588070502-2678589916624958983?l=madhuottapalam.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://madhuottapalam.blogspot.com/feeds/2678589916624958983/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=1146926327588070502&amp;postID=2678589916624958983' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1146926327588070502/posts/default/2678589916624958983'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1146926327588070502/posts/default/2678589916624958983'/><link rel='alternate' type='text/html' href='http://madhuottapalam.blogspot.com/2009/11/error-create-file-encountered-operating.html' title='Error : CREATE FILE encountered operating system error 32(The process cannot access the file because it is being used by another process.'/><author><name>Madhu K Nair</name><uri>http://www.blogger.com/profile/08936146465563191414</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='30' height='32' src='http://1.bp.blogspot.com/_4wBIz276vTw/TKtTNRq6sZI/AAAAAAAAASA/DVQPmnwt50c/S220/Madhu.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1146926327588070502.post-6403796723931489938</id><published>2009-11-19T09:20:00.000-08:00</published><updated>2009-11-27T23:17:50.245-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='FAQ'/><title type='text'>FAQ : How to disable AUTO UPATE STATISTICS  for a specific table or index in SQL Server</title><content type='html'>Using sp_autostats system stored procedure we can switch off AUTO UPDATE STATISTICS on a specific table or index. Please note that, if AUTO UPDATE STAT is OFF in Database level, you can not switch ON object level. In otherwords, if the DB level Auto update stat is ON then you can override the DB level setting and switch off AUTO UPDATE STAT object level using this stored procedure. &lt;br /&gt;&lt;br /&gt;&lt;strong&gt;Syntax&lt;/strong&gt;&lt;br /&gt;sp_autostats [ @tblname = ] 'table_name' &lt;br /&gt;    [ , [ @flagc = ] 'stats_flag' ] &lt;br /&gt;    [ , [ @indname = ] 'index_name' ]&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;Enabling automatic statistics for all indexes of a table&lt;/strong&gt;&lt;br /&gt;The following example enables the automatic statistics setting for all indexes of the Product table.&lt;br /&gt;&lt;br /&gt;USE AdventureWorks;&lt;br /&gt;GO&lt;br /&gt;EXEC sp_autostats 'Production.Product', 'ON'&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1146926327588070502-6403796723931489938?l=madhuottapalam.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://madhuottapalam.blogspot.com/feeds/6403796723931489938/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=1146926327588070502&amp;postID=6403796723931489938' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1146926327588070502/posts/default/6403796723931489938'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1146926327588070502/posts/default/6403796723931489938'/><link rel='alternate' type='text/html' href='http://madhuottapalam.blogspot.com/2009/11/faq-how-to-disable-auto-upate.html' title='FAQ : How to disable AUTO UPATE STATISTICS  for a specific table or index in SQL Server'/><author><name>Madhu K Nair</name><uri>http://www.blogger.com/profile/08936146465563191414</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='30' height='32' src='http://1.bp.blogspot.com/_4wBIz276vTw/TKtTNRq6sZI/AAAAAAAAASA/DVQPmnwt50c/S220/Madhu.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1146926327588070502.post-56042155010522101</id><published>2009-11-15T16:30:00.000-08:00</published><updated>2009-11-15T16:32:20.533-08:00</updated><title type='text'>Community Technology Preview of Microsoft SQL 2008 R2 is available for download</title><content type='html'>The latest Community Technology Preview (CTP) for SQL Server 2008 R2 available to the general public today. The new capabilities in the latest CTP include support for Windows Server 2008 R2 – including Hyper-V with Live Migration – as well as enhanced data compression with support for Unicode UCS-2.  Also included are new visualization features and a Report Part Gallery to Report Builder 3.0.&lt;br /&gt;&lt;br /&gt; &lt;br /&gt;&lt;br /&gt;SQL Server 2008 R2 includes enhancements designed to help administrators centrally monitor and manage multiple database applications, instances or servers. In addition, it has enabled high-scale complex event-stream processing through SQL Server StreamInsight, and expanded business intelligence capabilities with SQL Server PowerPivot for Excel.&lt;br /&gt;&lt;br /&gt; &lt;br /&gt;&lt;br /&gt;At the PASS Summit last week in Seattle, Microsoft announced two new premium editions – SQL Server 2008 R2 Datacenter and SQL Server 2008 R2 Parallel Data Warehouse – these will be available once SQL Server 2008 R2 is released.  SQL Server 2008 R2 is on track for general availability in the first half of 2010. &lt;br /&gt;&lt;br /&gt; &lt;br /&gt;&lt;br /&gt;The Community Technology Preview of Microsoft SQL 2008 R2 is available for download &lt;a href="http://www.microsoft.com/sqlserver/2008/en/us/R2.aspx"&gt;Here&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1146926327588070502-56042155010522101?l=madhuottapalam.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://madhuottapalam.blogspot.com/feeds/56042155010522101/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=1146926327588070502&amp;postID=56042155010522101' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1146926327588070502/posts/default/56042155010522101'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1146926327588070502/posts/default/56042155010522101'/><link rel='alternate' type='text/html' href='http://madhuottapalam.blogspot.com/2009/11/community-technology-preview-of.html' title='Community Technology Preview of Microsoft SQL 2008 R2 is available for download'/><author><name>Madhu K Nair</name><uri>http://www.blogger.com/profile/08936146465563191414</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='30' height='32' src='http://1.bp.blogspot.com/_4wBIz276vTw/TKtTNRq6sZI/AAAAAAAAASA/DVQPmnwt50c/S220/Madhu.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1146926327588070502.post-8546116832027392082</id><published>2009-11-08T04:30:00.000-08:00</published><updated>2009-11-27T23:18:13.306-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='FAQ'/><title type='text'>FAQ : Why we need to have different service account for each service in SQL Server?</title><content type='html'>In SQL Server, as per the components we select, different services gets installed like SQL SERVER Database engine, Analysis Service, Integration Services, Reporting Services and SQL Server Agent Services. But each service have its own specific tasks to do which requires different privilege and permissions. If we are configuring all the services startup account with a single user, this user will have to have a sum of all the permission required by all the services, which is very against security policy recommended by Microsoft.  For eg. DB Engine needs permission to the folder where the data and log files are kept why because it has to write the data into these files. Whereas SQL Server Agent does not need this permission. So, if we are using same user for both the services,  if the SQL Server Agent service got hacked or compromised , even the database engine is at risk.  This is the very basic reason why we need different windows user for each service.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1146926327588070502-8546116832027392082?l=madhuottapalam.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://madhuottapalam.blogspot.com/feeds/8546116832027392082/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=1146926327588070502&amp;postID=8546116832027392082' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1146926327588070502/posts/default/8546116832027392082'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1146926327588070502/posts/default/8546116832027392082'/><link rel='alternate' type='text/html' href='http://madhuottapalam.blogspot.com/2009/11/faq-why-we-need-to-have-different.html' title='FAQ : Why we need to have different service account for each service in SQL Server?'/><author><name>Madhu K Nair</name><uri>http://www.blogger.com/profile/08936146465563191414</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='30' height='32' src='http://1.bp.blogspot.com/_4wBIz276vTw/TKtTNRq6sZI/AAAAAAAAASA/DVQPmnwt50c/S220/Madhu.jpg'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1146926327588070502.post-3071511343850664408</id><published>2009-11-05T00:03:00.000-08:00</published><updated>2009-11-05T00:05:36.273-08:00</updated><title type='text'>SQL Server BI Webcast series by Amit Bansal</title><content type='html'>There is a webcast series starting soon on SQL Server BI by Amit Bansal. &lt;br /&gt;&lt;br /&gt;Webcast 1: BI for you     -November 6, Friday, 3 pm to 4.30 pm&lt;br /&gt;&lt;br /&gt;Webcast 2: Create your first cube   -November 9, Monday, 3 pm to 4.30 pm&lt;br /&gt;&lt;br /&gt;Webcast 3: Extract data from the cube   -November 11, Wednesday, 3 pm to 4.30 pm&lt;br /&gt;&lt;br /&gt;Webcast 4: Learn MDX scripting     -November 13, Friday, 3 pm to 4.30 pm&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;a href="www.SQLServerGeeks.com/Events/SQLBIwebcasts.htm"&gt;To register &amp; browse more details about each webcast, visit &lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1146926327588070502-3071511343850664408?l=madhuottapalam.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://madhuottapalam.blogspot.com/feeds/3071511343850664408/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=1146926327588070502&amp;postID=3071511343850664408' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1146926327588070502/posts/default/3071511343850664408'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1146926327588070502/posts/default/3071511343850664408'/><link rel='alternate' type='text/html' href='http://madhuottapalam.blogspot.com/2009/11/sql-server-bi-webcast-series-by-amit.html' title='SQL Server BI Webcast series by Amit Bansal'/><author><name>Madhu K Nair</name><uri>http://www.blogger.com/profile/08936146465563191414</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='30' height='32' src='http://1.bp.blogspot.com/_4wBIz276vTw/TKtTNRq6sZI/AAAAAAAAASA/DVQPmnwt50c/S220/Madhu.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1146926327588070502.post-8718040223127931346</id><published>2009-10-28T06:04:00.000-07:00</published><updated>2009-10-28T06:06:20.011-07:00</updated><title type='text'>Check this nice article on A-Z Guide to Being an Architect</title><content type='html'>&lt;a href="http://msdn.microsoft.com/hi-in/architecture/cc505969(en-us).aspx"&gt;A-Z Guide to Being an Architect&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1146926327588070502-8718040223127931346?l=madhuottapalam.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://madhuottapalam.blogspot.com/feeds/8718040223127931346/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=1146926327588070502&amp;postID=8718040223127931346' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1146926327588070502/posts/default/8718040223127931346'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1146926327588070502/posts/default/8718040223127931346'/><link rel='alternate' type='text/html' href='http://madhuottapalam.blogspot.com/2009/10/check-this-nice-article-on-z-guide-to.html' title='Check this nice article on A-Z Guide to Being an Architect'/><author><name>Madhu K Nair</name><uri>http://www.blogger.com/profile/08936146465563191414</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='30' height='32' src='http://1.bp.blogspot.com/_4wBIz276vTw/TKtTNRq6sZI/AAAAAAAAASA/DVQPmnwt50c/S220/Madhu.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1146926327588070502.post-8326437272051075034</id><published>2009-10-06T09:31:00.000-07:00</published><updated>2009-11-27T23:18:43.890-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='FAQ'/><title type='text'>FAQ : What is Domain of a column? How it defer from Datatype</title><content type='html'>Domain of a columm is the set of the values that are applicable for a column. For example, Gender column can have Female or Male so these value make the domain for Gender column.&lt;br /&gt;&lt;br /&gt;Though Domain and Datatype looks similar but it is not so. Datatype is the type of data that can be stored in the column . ie. Integer datatype column can only store numeric data.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1146926327588070502-8326437272051075034?l=madhuottapalam.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://madhuottapalam.blogspot.com/feeds/8326437272051075034/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=1146926327588070502&amp;postID=8326437272051075034' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1146926327588070502/posts/default/8326437272051075034'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1146926327588070502/posts/default/8326437272051075034'/><link rel='alternate' type='text/html' href='http://madhuottapalam.blogspot.com/2009/10/faq-what-is-domain-of-column-how-it.html' title='FAQ : What is Domain of a column? How it defer from Datatype'/><author><name>Madhu K Nair</name><uri>http://www.blogger.com/profile/08936146465563191414</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='30' height='32' src='http://1.bp.blogspot.com/_4wBIz276vTw/TKtTNRq6sZI/AAAAAAAAASA/DVQPmnwt50c/S220/Madhu.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1146926327588070502.post-7231640945818461500</id><published>2009-10-03T21:49:00.001-07:00</published><updated>2009-11-27T23:18:58.834-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='FAQ'/><title type='text'>FAQ : What is the difference between Framework and Standard?</title><content type='html'>We have heard lot about ITIL and ISOS.  Here ITIL is framework where as ISOS is Standard. What is the difference between standard and framework? Have you ever thought  about this? &lt;br /&gt;&lt;br /&gt;&lt;strong&gt;Standard :&lt;/strong&gt; Standard is something very rigid which should be followed across.  Standard will define proper method to do a process. ISOS is a standard. &lt;br /&gt;&lt;br /&gt;&lt;strong&gt;Framework :&lt;/strong&gt; Framework is something where you have the boundary defined. It is flexible and not always defined  with step by step process.  ITIL is a framework.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1146926327588070502-7231640945818461500?l=madhuottapalam.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://madhuottapalam.blogspot.com/feeds/7231640945818461500/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=1146926327588070502&amp;postID=7231640945818461500' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1146926327588070502/posts/default/7231640945818461500'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1146926327588070502/posts/default/7231640945818461500'/><link rel='alternate' type='text/html' href='http://madhuottapalam.blogspot.com/2009/10/faq-what-is-difference-between.html' title='FAQ : What is the difference between Framework and Standard?'/><author><name>Madhu K Nair</name><uri>http://www.blogger.com/profile/08936146465563191414</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='30' height='32' src='http://1.bp.blogspot.com/_4wBIz276vTw/TKtTNRq6sZI/AAAAAAAAASA/DVQPmnwt50c/S220/Madhu.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1146926327588070502.post-525273436275732144</id><published>2009-10-02T05:33:00.000-07:00</published><updated>2009-11-27T23:19:15.110-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='FAQ'/><title type='text'>FAQ : What is SQL Server PRINT equivalent in Oracle</title><content type='html'>&lt;strong&gt;Print In SQL Server&lt;/strong&gt;&lt;br /&gt;Returns a user-defined message to the client. Mainly Print is used while debugging procedures or triggers. &lt;br /&gt;Eg&lt;br /&gt;PRINT N'This is from first Loop.';&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;Oracle Equivalent :&lt;/strong&gt; &lt;br /&gt;What can come close in Oracle is DBMS_OUTPUT.PUT_LINE. Dbms_output is a PL/SQL Package which has a put_line procedure which write data to flat file or to direct your PL/SQL output to a screen.&lt;br /&gt;&lt;br /&gt;DBMS_OUTPUT.PUT_LINE ('This is from first Loop);&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1146926327588070502-525273436275732144?l=madhuottapalam.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://madhuottapalam.blogspot.com/feeds/525273436275732144/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=1146926327588070502&amp;postID=525273436275732144' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1146926327588070502/posts/default/525273436275732144'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1146926327588070502/posts/default/525273436275732144'/><link rel='alternate' type='text/html' href='http://madhuottapalam.blogspot.com/2009/10/faq-what-is-sql-server-print-equivalent.html' title='FAQ : What is SQL Server PRINT equivalent in Oracle'/><author><name>Madhu K Nair</name><uri>http://www.blogger.com/profile/08936146465563191414</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='30' height='32' src='http://1.bp.blogspot.com/_4wBIz276vTw/TKtTNRq6sZI/AAAAAAAAASA/DVQPmnwt50c/S220/Madhu.jpg'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1146926327588070502.post-6694207887558093945</id><published>2009-10-02T04:47:00.000-07:00</published><updated>2009-11-27T23:19:29.233-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='FAQ'/><title type='text'>FAQ : What is Oracle Predefined Exceptions equivalent in SQL Server</title><content type='html'>&lt;strong&gt;What is Oracle Predefined Exceptions&lt;/strong&gt;&lt;br /&gt;An exception is a runtime error or warning condition, which can be predefined or user-defined. Predefined exceptions are raised implicitly (automatically) by the runtime system. User-defined exceptions must be raised explicitly by RAISE statements. To handle raised exceptions, you write separate routines called exception handlers. PL/SQL declares predefined exceptions globally in package STANDARD, which defines the PL/SQL environment. So, you need not declare them yourself.  &lt;br /&gt;&lt;strong&gt;Here are few examples&lt;/strong&gt;&lt;br /&gt;NO_DATA_FOUND : A SELECT INTO statement returns no rows, or your program references a deleted element in a nested table or an uninitialized element in an index-by table. SQL aggregate functions such as AVG and SUM always return a value or a null. So, a SELECT INTO statement that calls an aggregate function never raises NO_DATA_FOUND. The FETCH statement is expected to return no rows eventually, so when that happens, no exception is raised.&lt;br /&gt;&lt;br /&gt;TOO_MANY_ROWS :  A SELECT INTO statement returns more than one row.&lt;br /&gt;&lt;br /&gt;DUP_VAL_ON_INDEX : Your program attempts to store duplicate values in a database column that is constrained by a unique index.&lt;br /&gt;  &lt;br /&gt;Read more about Predefined exceptions &lt;a href="http://download.oracle.com/docs/cd/B10501_01/appdev.920/a96624/07_errs.htm#784"&gt;here&lt;/a&gt; &lt;br /&gt;&lt;br /&gt;&lt;strong&gt;What is SQL Server Equivalent?&lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;Till SQL Server 2008 we do not have any equivalent. Ie there is no Predefined Exceptions in SQL Server.  But this can be achieved by BEGIN TRY .. END TRY BEGIN CATCH … END CATCH. ERROR Number/Message combination.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1146926327588070502-6694207887558093945?l=madhuottapalam.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://madhuottapalam.blogspot.com/feeds/6694207887558093945/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=1146926327588070502&amp;postID=6694207887558093945' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1146926327588070502/posts/default/6694207887558093945'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1146926327588070502/posts/default/6694207887558093945'/><link rel='alternate' type='text/html' href='http://madhuottapalam.blogspot.com/2009/10/faq-what-is-oracle-predefined.html' title='FAQ : What is Oracle Predefined Exceptions equivalent in SQL Server'/><author><name>Madhu K Nair</name><uri>http://www.blogger.com/profile/08936146465563191414</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='30' height='32' src='http://1.bp.blogspot.com/_4wBIz276vTw/TKtTNRq6sZI/AAAAAAAAASA/DVQPmnwt50c/S220/Madhu.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1146926327588070502.post-3959070857737176546</id><published>2009-10-02T04:25:00.000-07:00</published><updated>2009-11-27T23:19:46.099-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='FAQ'/><title type='text'>FAQ : Oracle %ROWTYPE    equivalent in SQL Server</title><content type='html'>&lt;strong&gt;What is %ROWTYPE  in Oracle?&lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;The %ROWTYPE attribute provides a feature to create Table based or Cursor Based record.  Ie. If you have a table with 5 column and you want to select all the five column value of a single record at a stretch instead of declaring 5 scalar variable you just declare a single variable of %ROWTYPE which will intern have all the five column. Consider we have a table called Department with three columns Department_ID, Description and Name. Either you can declare three scalar variable or you can declare single variable of %ROWTYPE attribute.  If you want to store a collection (multiple records ) then you can use TABLE OF TableName%RowType;&lt;br /&gt;See the below eg. &lt;br /&gt;DECLARE&lt;br /&gt;Dept_REC DEPARTMENT%ROWTYPE;&lt;br /&gt;BEGIN&lt;br /&gt;SELECT *&lt;br /&gt;INTO Dept_REC&lt;br /&gt;FROM DEPARTMENT&lt;br /&gt;WHERE DEPARTMENT_ID = 1;&lt;br /&gt;DBMS_OUTPUT.PUT_LINE (' DEPARTMENT ID: '|| Dept_REC.DEPARTMENT_ID);&lt;br /&gt;DBMS_OUTPUT.PUT_LINE ('COURSE DESCRIPTION: '||&lt;br /&gt;Dept_REC.DESCRIPTION);&lt;br /&gt;DBMS_OUTPUT.PUT_LINE ('Name: '||&lt;br /&gt;Dept_REC.Name);&lt;br /&gt;END;&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;SQL Server Equivalent.&lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;In SQL Server what can come close to  TABLE OF TableName%RowType  is Declare a table type variable (in case it is collection). Another way may be create a #temp table.  But temp table method may involve IO which need to be aware of and also in there are limitation where you can create #temp table. For a single row, it is better to declare separate scalar variable for each columns &lt;br /&gt;&lt;br /&gt;&lt;strong&gt;Table variable Method&lt;/strong&gt;&lt;br /&gt;Declare @Dept Table (Department_id Int,Name Varchar(100),Description Varchar(1000))&lt;br /&gt;The below statement will insert all the rows from Department to @Dept variable. &lt;br /&gt;Select *INTO @Dept&lt;br /&gt;FROM &lt;br /&gt;Department &lt;br /&gt;&lt;br /&gt;&lt;strong&gt;Temp table method&lt;/strong&gt;&lt;br /&gt;Select *into #Temp_Dept &lt;br /&gt;FROM Department&lt;br /&gt;The above statement will create a temp table on the fly. This can be used in Procedure but not in Function.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1146926327588070502-3959070857737176546?l=madhuottapalam.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://madhuottapalam.blogspot.com/feeds/3959070857737176546/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=1146926327588070502&amp;postID=3959070857737176546' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1146926327588070502/posts/default/3959070857737176546'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1146926327588070502/posts/default/3959070857737176546'/><link rel='alternate' type='text/html' href='http://madhuottapalam.blogspot.com/2009/10/faq-oracle-rowtype-equivalent-in-sql.html' title='FAQ : Oracle %ROWTYPE    equivalent in SQL Server'/><author><name>Madhu K Nair</name><uri>http://www.blogger.com/profile/08936146465563191414</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='30' height='32' src='http://1.bp.blogspot.com/_4wBIz276vTw/TKtTNRq6sZI/AAAAAAAAASA/DVQPmnwt50c/S220/Madhu.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1146926327588070502.post-4619641059113630480</id><published>2009-10-01T22:38:00.000-07:00</published><updated>2009-11-27T23:19:59.888-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='FAQ'/><title type='text'>FAQ : What is SQL Server Profiler  equivalent   in Oracle</title><content type='html'>&lt;strong&gt;What is SQL Server Profiler?&lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;Microsoft SQL Server Profiler is a graphical user interface to SQL Trace for monitoring an instance of the Database Engine or Analysis Services. You can capture and save data about each event to a file or table to analyze later. For example, you can monitor a production environment to see which stored procedures are affecting performance by executing too slowly. Basically this tool is a wrapper which internally calls SQL Trace system stored procedures.  Generally, running profiler is not recommended in production if you need to trace events, then in production it is better to go for SQL Trace system Stored procedure. Refer this &lt;a href="http://vyaskn.tripod.com/server_side_tracing_in_sql_server.htm"&gt;link &lt;/a&gt;for more info. &lt;br /&gt;&lt;br /&gt;&lt;strong&gt;Oracle Equivalent . (please note that this is based on my little experience in Oracle and If anyone feels that If I am going wrong please feel free to correct me)&lt;br /&gt;&lt;br /&gt;Automatic Workload Repository (AWR) &lt;/strong&gt; &lt;br /&gt;&lt;br /&gt;Oracle offers many ways to trace events which again later version may have new tools and features. In 10 G, Oracle offers Automatic Workload Repository (AWR) which is used to collect statistics including &lt;br /&gt;• Wait events used to identify performance problems.&lt;br /&gt;• Time model statistics indicating the amount of DB time associated with a process from the V$SESS_TIME_MODEL and V$SYS_TIME_MODEL views.&lt;br /&gt;• Active Session History (ASH) statistics from the V$ACTIVE_SESSION_HISTORY view.&lt;br /&gt;• Some system and session statistics from the V$SYSSTAT and V$SESSTAT views.&lt;br /&gt;• Object usage statistics.&lt;br /&gt;• Resource intensive SQL statements.&lt;br /&gt;&lt;br /&gt;Read more about AWR &lt;a href="http://www.oracle-base.com/articles/10g/AutomaticWorkloadRepository10g.php"&gt;here &lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;SQL trace files and TKPROF&lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;If you are still in Oracle 9, you can go for SQL trace files which gives you statement by statement log of SQL and PL/SQL executed by Database Client(s).  The SQL Trace facility and TKPROF are two basic performance diagnostic tools that can help you monitor and tune applications running against the Oracle Server. SQL Trace files entries can be classified in to mainly four categories.&lt;br /&gt;• Database calls (parse, execute, and fetch)&lt;br /&gt;• Wait events&lt;br /&gt;• Bind variable values&lt;br /&gt;• Miscellaneous events like timestamps, instance service name, session, module, action, and client&lt;br /&gt;identifier&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;TKPROF&lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;You can run the TKPROF program to format the contents of the trace file and place the output into a readable output file. Optionally, TKPROF can also:&lt;br /&gt;• Determine the execution plans of SQL statements &lt;br /&gt;• Create a SQL script that stores the statistics in the database &lt;br /&gt;Read more about SQL Trace files and TKPROF &lt;a href="http://download.oracle.com/docs/cd/B10501_01/server.920/a96533/sqltrace.htm"&gt;here &lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1146926327588070502-4619641059113630480?l=madhuottapalam.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://madhuottapalam.blogspot.com/feeds/4619641059113630480/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=1146926327588070502&amp;postID=4619641059113630480' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1146926327588070502/posts/default/4619641059113630480'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1146926327588070502/posts/default/4619641059113630480'/><link rel='alternate' type='text/html' href='http://madhuottapalam.blogspot.com/2009/10/faq-what-is-sql-server-profiler.html' title='FAQ : What is SQL Server Profiler  equivalent   in Oracle'/><author><name>Madhu K Nair</name><uri>http://www.blogger.com/profile/08936146465563191414</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='30' height='32' src='http://1.bp.blogspot.com/_4wBIz276vTw/TKtTNRq6sZI/AAAAAAAAASA/DVQPmnwt50c/S220/Madhu.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1146926327588070502.post-2446658512356932542</id><published>2009-09-11T21:05:00.000-07:00</published><updated>2009-11-27T23:20:13.254-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='FAQ'/><title type='text'>FAQ: What is optimizer in SQL Server?</title><content type='html'>Unlike procedural language SQL Statements does not state the exact steps that database engine should follow to extract the data or manipulate the data. In procedural language the statements are ran as per the sequence they have written. But in SQL , database engine must analyse the statement to determine the most efficient way to extract/manipulate data. This process is called optimization and the component which does this process is called Optimizer.&lt;br /&gt;&lt;br /&gt;The input to the optimizer contains , Query , schema (table/indexes definitions) and the statistics available. &lt;br /&gt;&lt;br /&gt;The output from the optimizer is query execution plan.  &lt;br /&gt;&lt;br /&gt;&lt;a href="http://3.bp.blogspot.com/_4wBIz276vTw/SqseU_Cu1aI/AAAAAAAAAQU/AYAsXUqbrdM/s1600-h/ex.bmp"&gt;&lt;img style="display:block; margin:0px auto 10px; text-align:center;cursor:pointer; cursor:hand;width: 237px; height: 124px;" src="http://3.bp.blogspot.com/_4wBIz276vTw/SqseU_Cu1aI/AAAAAAAAAQU/AYAsXUqbrdM/s320/ex.bmp" border="0" alt=""id="BLOGGER_PHOTO_ID_5380427525693298082" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;The SQL Server query optimizer is a cost-based optimizer. Each possible execution plan has an associated cost in terms of the amount of computing resources used. The query optimizer must analyze the possible plans and choose the one with the lowest estimated cost. Some complex SELECT statements have thousands of possible execution plans. In these cases, the query optimizer does not analyze all possible combinations. Instead, it uses complex algorithms to find an execution plan that has a cost reasonably close to the minimum possible cost.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1146926327588070502-2446658512356932542?l=madhuottapalam.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://madhuottapalam.blogspot.com/feeds/2446658512356932542/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=1146926327588070502&amp;postID=2446658512356932542' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1146926327588070502/posts/default/2446658512356932542'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1146926327588070502/posts/default/2446658512356932542'/><link rel='alternate' type='text/html' href='http://madhuottapalam.blogspot.com/2009/09/faq-what-is-optimizer-in-sql-server.html' title='FAQ: What is optimizer in SQL Server?'/><author><name>Madhu K Nair</name><uri>http://www.blogger.com/profile/08936146465563191414</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='30' height='32' src='http://1.bp.blogspot.com/_4wBIz276vTw/TKtTNRq6sZI/AAAAAAAAASA/DVQPmnwt50c/S220/Madhu.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://3.bp.blogspot.com/_4wBIz276vTw/SqseU_Cu1aI/AAAAAAAAAQU/AYAsXUqbrdM/s72-c/ex.bmp' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1146926327588070502.post-4507696472439281133</id><published>2009-09-06T21:04:00.000-07:00</published><updated>2009-11-27T23:20:23.473-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='FAQ'/><title type='text'>FAQ : What is Optimizing  SQL statement .</title><content type='html'>Unlike procedural language SQL Statements does not state the exact steps that database engine should follow to extract the data or manipulate the data. In procedural language the statements are ran as per the sequence they have written. But in SQL , database engine must analyse the statement to determine the most efficient way to extract/manipulate data. This process is called optimization.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1146926327588070502-4507696472439281133?l=madhuottapalam.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://madhuottapalam.blogspot.com/feeds/4507696472439281133/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=1146926327588070502&amp;postID=4507696472439281133' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1146926327588070502/posts/default/4507696472439281133'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1146926327588070502/posts/default/4507696472439281133'/><link rel='alternate' type='text/html' href='http://madhuottapalam.blogspot.com/2009/09/faq-what-is-optimizing-sql-statement.html' title='FAQ : What is Optimizing  SQL statement .'/><author><name>Madhu K Nair</name><uri>http://www.blogger.com/profile/08936146465563191414</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='30' height='32' src='http://1.bp.blogspot.com/_4wBIz276vTw/TKtTNRq6sZI/AAAAAAAAASA/DVQPmnwt50c/S220/Madhu.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1146926327588070502.post-3903152385731652402</id><published>2009-09-02T21:16:00.000-07:00</published><updated>2009-11-27T23:20:35.836-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='FAQ'/><title type='text'>FAQ :  What is the equivalent of SELECT * INTO of SQL Server in Oracle</title><content type='html'>&lt;strong&gt;SQL Server&lt;/strong&gt;&lt;br /&gt;Select * into TargettableName from sourceTableName&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;Oracle&lt;/strong&gt;&lt;br /&gt;Create table targetTableName as Select *From sourceTableName&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1146926327588070502-3903152385731652402?l=madhuottapalam.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://madhuottapalam.blogspot.com/feeds/3903152385731652402/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=1146926327588070502&amp;postID=3903152385731652402' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1146926327588070502/posts/default/3903152385731652402'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1146926327588070502/posts/default/3903152385731652402'/><link rel='alternate' type='text/html' href='http://madhuottapalam.blogspot.com/2009/09/faq-what-is-equivalent-of-select-into.html' title='FAQ :  What is the equivalent of SELECT * INTO of SQL Server in Oracle'/><author><name>Madhu K Nair</name><uri>http://www.blogger.com/profile/08936146465563191414</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='30' height='32' src='http://1.bp.blogspot.com/_4wBIz276vTw/TKtTNRq6sZI/AAAAAAAAASA/DVQPmnwt50c/S220/Madhu.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1146926327588070502.post-5483937213895856997</id><published>2009-09-02T21:15:00.001-07:00</published><updated>2009-11-27T23:20:53.282-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='FAQ'/><title type='text'>FAQ : What is Packages in Oracle and its equivalent in SQL Server</title><content type='html'>A package is a schema object that groups logically related PL/SQL types, variables, and subprograms. Packages usually have two parts, a specification (spec) and a body; sometimes the body is unnecessary. The specification is the interface to the package. It declares the types, variables, constants, exceptions, cursors, and subprograms that can be referenced from outside the package. The body defines the queries for the cursors and the code for the subprograms.&lt;br /&gt;&lt;br /&gt;There is no equivalent in SQL Server yet.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1146926327588070502-5483937213895856997?l=madhuottapalam.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://madhuottapalam.blogspot.com/feeds/5483937213895856997/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=1146926327588070502&amp;postID=5483937213895856997' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1146926327588070502/posts/default/5483937213895856997'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1146926327588070502/posts/default/5483937213895856997'/><link rel='alternate' type='text/html' href='http://madhuottapalam.blogspot.com/2009/09/faq-6-what-is-packages-in-oracle-and.html' title='FAQ : What is Packages in Oracle and its equivalent in SQL Server'/><author><name>Madhu K Nair</name><uri>http://www.blogger.com/profile/08936146465563191414</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='30' height='32' src='http://1.bp.blogspot.com/_4wBIz276vTw/TKtTNRq6sZI/AAAAAAAAASA/DVQPmnwt50c/S220/Madhu.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1146926327588070502.post-8414031898418239653</id><published>2009-09-02T21:11:00.001-07:00</published><updated>2009-11-27T23:21:03.816-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='FAQ'/><title type='text'>FAQ :  How to declare a variable in SQL Server (T-SQL) and in Oracle PL/SQL</title><content type='html'>&lt;strong&gt;SQL  Server&lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;Variables are  declared in the body of a batch or procedure with the DECLARE  Statement and are assigned to values with either a SET or SELECT Statement.After declaration all variables are initialized as NULL&lt;br /&gt;Variables are often used in batch or procedure /functions as counters for WHILE, LOOP or for an IF..ELSE block. Variables can be used only in expression, not in the place of object names or key words (in that case you need to use Dynamic SQL. See Dynamic SQL for more info).&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;Types of Variable :&lt;/strong&gt;  Three types of variables are available&lt;br /&gt;•       @local variable&lt;br /&gt;•      @Cursor_Variable_Name&lt;br /&gt;•      @table_variable_name&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;Declare a variable :&lt;/strong&gt;&lt;br /&gt;               DECLARE @VariableName datatype : Variable prefixed with @ symbol.&lt;br /&gt; Eg.   DECLARE @Count INT&lt;br /&gt;                 DECLARE @Name varchar(50), @Address varchar(200)&lt;br /&gt;&lt;br /&gt; &lt;strong&gt;Seting /initialising a variable  :   &lt;/strong&gt;     &lt;br /&gt;&lt;br /&gt;               SET @Name=’Madhu’&lt;br /&gt;               SET @Count=100&lt;br /&gt; Initialise multiple variable using Select statement :&lt;br /&gt;&lt;br /&gt;SET can be used for only single variable where as SELECT can be used for multiple variable in a single statement&lt;br /&gt;&lt;br /&gt; SELECT @Name=’Madhu’ , @Count=0 , @Address=’XYZ’&lt;br /&gt;&lt;br /&gt;             WHILE(@i&lt;@Count)&lt;br /&gt;              BEGIN&lt;br /&gt;  SET @i=@i+1&lt;br /&gt;           PRINT @i&lt;br /&gt;   END   &lt;br /&gt;&lt;br /&gt;&lt;strong&gt;Oracle (PL/SQL)  : Declaring Variables&lt;/strong&gt;&lt;br /&gt;In oracle,  Variables can have any SQL datatype, such as CHAR, DATE, or NUMBER, or a PL/SQL-only datatype, such as BOOLEAN or PLS_INTEGER. For example, assume that you want to declare variables for part data, such as part_no to hold 6-digit numbers  and in_stock to hold the Boolean value TRUE or FALSE. You declare these and related part variables as shown in Example 1. Note that there is a semi-colon (;) at the end of each line in the declaration section. &lt;br /&gt;&lt;br /&gt; Example 1–1. Declaring Variables in PL/SQL&lt;br /&gt;DECLARE&lt;br /&gt;part_no NUMBER(6);&lt;br /&gt;part_name VARCHAR2(20);&lt;br /&gt;&lt;br /&gt;You can also declare nested tables, variable-size arrays (varrays for short), and records using the TABLE, VARRAY, and RECORD composite datatypes.  &lt;br /&gt;&lt;br /&gt;&lt;strong&gt;Assigning Values to a Variable&lt;/strong&gt;&lt;br /&gt;You can assign values to a variable in three ways. The first way uses the assignment operator (:=), a colon followed by an equal sign, as shown in Example 2. You place the variable to the left of the operator and an expression,  including function calls, to the right. Note that you can assign a value to a variable when it is declared.&lt;br /&gt;&lt;br /&gt;Example 1–2 Assigning Values to Variables With the Assignment Operator&lt;br /&gt;DECLARE&lt;br /&gt;wages NUMBER;&lt;br /&gt;hours_worked NUMBER := 40;&lt;br /&gt;emp_rec1 employees%ROWTYPE;&lt;br /&gt;country := UPPER('Canada');&lt;br /&gt;&lt;br /&gt; &lt;br /&gt;The second way to assign values to a variable is by selecting (or fetching) database values into it. In Example 1–3, 10% of an employee's salary is selected into the bonus variable. Now you can use the bonus variable in another computation or insert its value into a database table.&lt;br /&gt;&lt;br /&gt;Example 1–3 Assigning Values to Variables by SELECTing INTO&lt;br /&gt;&lt;br /&gt;DECLARE&lt;br /&gt;bonus NUMBER(8,2);&lt;br /&gt;emp_id NUMBER(6) := 100;&lt;br /&gt;BEGIN&lt;br /&gt;SELECT salary * 0.10 INTO bonus FROM employees&lt;br /&gt;WHERE employee_id = emp_id;&lt;br /&gt;END;&lt;br /&gt;&lt;br /&gt;The third way to assign a value to a variable is by passing it as an OUT or IN OUT parameter to a subprogram, and then assigning the value inside the subprogram.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1146926327588070502-8414031898418239653?l=madhuottapalam.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://madhuottapalam.blogspot.com/feeds/8414031898418239653/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=1146926327588070502&amp;postID=8414031898418239653' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1146926327588070502/posts/default/8414031898418239653'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1146926327588070502/posts/default/8414031898418239653'/><link rel='alternate' type='text/html' href='http://madhuottapalam.blogspot.com/2009/09/2-how-to-declare-variable-in-sql-server.html' title='FAQ :  How to declare a variable in SQL Server (T-SQL) and in Oracle PL/SQL'/><author><name>Madhu K Nair</name><uri>http://www.blogger.com/profile/08936146465563191414</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='30' height='32' src='http://1.bp.blogspot.com/_4wBIz276vTw/TKtTNRq6sZI/AAAAAAAAASA/DVQPmnwt50c/S220/Madhu.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1146926327588070502.post-3716999242062589553</id><published>2009-09-02T21:11:00.000-07:00</published><updated>2009-11-27T23:21:18.203-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='FAQ'/><title type='text'>FAQ : How to declare a variable in SQL Server (T-SQL) and in Oracle PL/SQL</title><content type='html'>&lt;strong&gt;SQL  Server&lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;Variables are  declared in the body of a batch or procedure with the DECLARE  Statement and are assigned to values with either a SET or SELECT Statement.After declaration all variables are initialized as NULL&lt;br /&gt;Variables are often used in batch or procedure /functions as counters for WHILE, LOOP or for an IF..ELSE block. Variables can be used only in expression, not in the place of object names or key words (in that case you need to use Dynamic SQL. See Dynamic SQL for more info).&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;Types of Variable :&lt;/strong&gt;  Three types of variables are available&lt;br /&gt;•       @local variable&lt;br /&gt;•      @Cursor_Variable_Name&lt;br /&gt;•      @table_variable_name&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;Declare a variable :&lt;/strong&gt;&lt;br /&gt;               DECLARE @VariableName datatype : Variable prefixed with @ symbol.&lt;br /&gt; Eg.   DECLARE @Count INT&lt;br /&gt;                 DECLARE @Name varchar(50), @Address varchar(200)&lt;br /&gt;&lt;br /&gt; &lt;strong&gt;Seting /initialising a variable  :   &lt;/strong&gt;     &lt;br /&gt;&lt;br /&gt;               SET @Name=’Madhu’&lt;br /&gt;               SET @Count=100&lt;br /&gt; Initialise multiple variable using Select statement :&lt;br /&gt;&lt;br /&gt;SET can be used for only single variable where as SELECT can be used for multiple variable in a single statement&lt;br /&gt;&lt;br /&gt; SELECT @Name=’Madhu’ , @Count=0 , @Address=’XYZ’&lt;br /&gt;&lt;br /&gt;             WHILE(@i&lt;@Count)&lt;br /&gt;              BEGIN&lt;br /&gt;  SET @i=@i+1&lt;br /&gt;           PRINT @i&lt;br /&gt;   END   &lt;br /&gt;&lt;br /&gt;&lt;strong&gt;Oracle (PL/SQL)  : Declaring Variables&lt;/strong&gt;&lt;br /&gt;In oracle,  Variables can have any SQL datatype, such as CHAR, DATE, or NUMBER, or a PL/SQL-only datatype, such as BOOLEAN or PLS_INTEGER. For example, assume that you want to declare variables for part data, such as part_no to hold 6-digit numbers  and in_stock to hold the Boolean value TRUE or FALSE. You declare these and related part variables as shown in Example 1. Note that there is a semi-colon (;) at the end of each line in the declaration section. &lt;br /&gt;&lt;br /&gt; Example 1–1. Declaring Variables in PL/SQL&lt;br /&gt;DECLARE&lt;br /&gt;part_no NUMBER(6);&lt;br /&gt;part_name VARCHAR2(20);&lt;br /&gt;&lt;br /&gt;You can also declare nested tables, variable-size arrays (varrays for short), and records using the TABLE, VARRAY, and RECORD composite datatypes.  &lt;br /&gt;&lt;br /&gt;&lt;strong&gt;Assigning Values to a Variable&lt;/strong&gt;&lt;br /&gt;You can assign values to a variable in three ways. The first way uses the assignment operator (:=), a colon followed by an equal sign, as shown in Example 2. You place the variable to the left of the operator and an expression,  including function calls, to the right. Note that you can assign a value to a variable when it is declared.&lt;br /&gt;&lt;br /&gt;Example 1–2 Assigning Values to Variables With the Assignment Operator&lt;br /&gt;DECLARE&lt;br /&gt;wages NUMBER;&lt;br /&gt;hours_worked NUMBER := 40;&lt;br /&gt;emp_rec1 employees%ROWTYPE;&lt;br /&gt;country := UPPER('Canada');&lt;br /&gt;&lt;br /&gt; &lt;br /&gt;The second way to assign values to a variable is by selecting (or fetching) database values into it. In Example 1–3, 10% of an employee's salary is selected into the bonus variable. Now you can use the bonus variable in another computation or insert its value into a database table.&lt;br /&gt;&lt;br /&gt;Example 1–3 Assigning Values to Variables by SELECTing INTO&lt;br /&gt;&lt;br /&gt;DECLARE&lt;br /&gt;bonus NUMBER(8,2);&lt;br /&gt;emp_id NUMBER(6) := 100;&lt;br /&gt;BEGIN&lt;br /&gt;SELECT salary * 0.10 INTO bonus FROM employees&lt;br /&gt;WHERE employee_id = emp_id;&lt;br /&gt;END;&lt;br /&gt;&lt;br /&gt;The third way to assign a value to a variable is by passing it as an OUT or IN OUT parameter to a subprogram, and then assigning the value inside the subprogram.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1146926327588070502-3716999242062589553?l=madhuottapalam.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://madhuottapalam.blogspot.com/feeds/3716999242062589553/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=1146926327588070502&amp;postID=3716999242062589553' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1146926327588070502/posts/default/3716999242062589553'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1146926327588070502/posts/default/3716999242062589553'/><link rel='alternate' type='text/html' href='http://madhuottapalam.blogspot.com/2009/09/faq-how-to-declare-variable-in-sql.html' title='FAQ : How to declare a variable in SQL Server (T-SQL) and in Oracle PL/SQL'/><author><name>Madhu K Nair</name><uri>http://www.blogger.com/profile/08936146465563191414</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='30' height='32' src='http://1.bp.blogspot.com/_4wBIz276vTw/TKtTNRq6sZI/AAAAAAAAASA/DVQPmnwt50c/S220/Madhu.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1146926327588070502.post-7239211954063682358</id><published>2009-09-02T21:09:00.000-07:00</published><updated>2009-11-27T23:21:35.958-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='FAQ'/><title type='text'>FAQ :  How to find Product version in SQL Server and in Oracle</title><content type='html'>&lt;strong&gt;SQL Server &lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;Select @@Version&lt;br /&gt;Or &lt;br /&gt;SET NOCOUNT ON;&lt;br /&gt;SELECT &lt;br /&gt;      CONVERT( varchar, SERVERPROPERTY('Edition')) AS Edition&lt;br /&gt;    , CONVERT( varchar, SERVERPROPERTY('ProductVersion')) AS Version&lt;br /&gt;    , CONVERT( varchar, SERVERPROPERTY('ProductLevel')) AS Level&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;Oracle&lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;select * From V$VERSION  ;&lt;br /&gt;Note : V$VERSION   is the catalog view which provides all the information in Oracle&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1146926327588070502-7239211954063682358?l=madhuottapalam.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://madhuottapalam.blogspot.com/feeds/7239211954063682358/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=1146926327588070502&amp;postID=7239211954063682358' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1146926327588070502/posts/default/7239211954063682358'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1146926327588070502/posts/default/7239211954063682358'/><link rel='alternate' type='text/html' href='http://madhuottapalam.blogspot.com/2009/09/faq-how-to-find-product-version-in-sql.html' title='FAQ :  How to find Product version in SQL Server and in Oracle'/><author><name>Madhu K Nair</name><uri>http://www.blogger.com/profile/08936146465563191414</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='30' height='32' src='http://1.bp.blogspot.com/_4wBIz276vTw/TKtTNRq6sZI/AAAAAAAAASA/DVQPmnwt50c/S220/Madhu.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1146926327588070502.post-3491536392621670034</id><published>2009-08-11T21:39:00.000-07:00</published><updated>2009-11-27T23:21:48.881-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='FAQ'/><title type='text'>FAQ : What is String summary statistics in SQL Server?</title><content type='html'>SQL Server 2005 introduces additional information collected by statistics created on char, varchar, varchar(max), nchar, nvarchar, nvarchar(max), text, and ntext columns. This information, called a string summary, helps the query optimizer estimate the selectivity of query predicates on string patterns .   This helps the optimizer better estimate the selectivity of conditions that use the LIKE operator. String summary information is not maintained if the summary for a column sample is larger than the Database Engine can maintain. For example, a string summary will not be maintained on statistics created by using WITH FULLSCAN on a unique varchar(80) column with 80 characters in each string, almost no similarity between strings, on a table with 85,000 rows. To determine whether a string summary is stored for a particular statistics object, use DBCC SHOW_STATISTICS (Transact-SQL) .&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1146926327588070502-3491536392621670034?l=madhuottapalam.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://madhuottapalam.blogspot.com/feeds/3491536392621670034/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=1146926327588070502&amp;postID=3491536392621670034' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1146926327588070502/posts/default/3491536392621670034'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1146926327588070502/posts/default/3491536392621670034'/><link rel='alternate' type='text/html' href='http://madhuottapalam.blogspot.com/2009/08/faq-what-is-string-summary-statistics.html' title='FAQ : What is String summary statistics in SQL Server?'/><author><name>Madhu K Nair</name><uri>http://www.blogger.com/profile/08936146465563191414</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='30' height='32' src='http://1.bp.blogspot.com/_4wBIz276vTw/TKtTNRq6sZI/AAAAAAAAASA/DVQPmnwt50c/S220/Madhu.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1146926327588070502.post-4473071399333067720</id><published>2009-08-03T10:46:00.000-07:00</published><updated>2009-11-27T23:22:01.166-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='FAQ'/><title type='text'>FAQ : What is Equi-JOIN and Non-Equi JOIN in SQL</title><content type='html'>&lt;strong&gt;What is Equi-Join?&lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;When a JOIN is made on Exact match between two columns it is called equi-Join. &lt;br /&gt;Eg.&lt;br /&gt;SELECT A.*&lt;br /&gt; FROM EMPLOYEES A, EMPLOYEE_SAL B&lt;br /&gt;WHERE A.EMP_ID=B.EMP_ID&lt;br /&gt;OR&lt;br /&gt;SELECT A.*&lt;br /&gt; FROM EMPLOYEES A&lt;br /&gt;INNER JOIN  EMPLOYEE_SAL B&lt;br /&gt;ON A.EMP_ID=B.EMP_ID&lt;br /&gt;Both the queries mentioned above can be considered as Equi-join. &lt;br /&gt; &lt;br /&gt;&lt;strong&gt;What is NON-Equi Join.&lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;If you use any other comparison operator other than =  in JOIN condition, it is called NON-Equi JOIN&lt;br /&gt;SELECT A.*&lt;br /&gt; FROM EMPLOYEES A, EMPLOYEE_SAL B&lt;br /&gt;WHERE A.EMP_ID &lt;&gt; B.EMP_ID&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1146926327588070502-4473071399333067720?l=madhuottapalam.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://madhuottapalam.blogspot.com/feeds/4473071399333067720/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=1146926327588070502&amp;postID=4473071399333067720' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1146926327588070502/posts/default/4473071399333067720'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1146926327588070502/posts/default/4473071399333067720'/><link rel='alternate' type='text/html' href='http://madhuottapalam.blogspot.com/2009/08/faq-what-is-equi-join-and-non-equi-join.html' title='FAQ : What is Equi-JOIN and Non-Equi JOIN in SQL'/><author><name>Madhu K Nair</name><uri>http://www.blogger.com/profile/08936146465563191414</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='30' height='32' src='http://1.bp.blogspot.com/_4wBIz276vTw/TKtTNRq6sZI/AAAAAAAAASA/DVQPmnwt50c/S220/Madhu.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1146926327588070502.post-181236873590146816</id><published>2009-06-27T20:27:00.000-07:00</published><updated>2009-11-27T23:22:16.602-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='WITH ROLLBACK IMMEDIATE'/><category scheme='http://www.blogger.com/atom/ns#' term='FAQ'/><category scheme='http://www.blogger.com/atom/ns#' term='ALTER Database'/><category scheme='http://www.blogger.com/atom/ns#' term='WITH NOWAIT'/><title type='text'>FAQ : What is WITH ROLLBACK  ROLLBACK IMMEDIATE |   AFTER integer [SECONDS] | NO_WAIT  in ALTER DATABASE in SQL Server</title><content type='html'>When you ALTER a database state what to do with the current transaction(s) (If any) on the database are defined by these statements. &lt;br /&gt;&lt;br /&gt;&lt;strong&gt;WITH ROLLBACK IMMEDIATE&lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;WITH ROLLBACK IMMEDIATE tell the DB engine to rollback all the transaction immediately and make the DB into the given state in the Alter Statement. Ie&lt;br /&gt;In my database, there is a transaction running for last one hour and it is not yet committed and now I want to make this database into SINGLE_USER. The following line of Alter statement will do that for me&lt;br /&gt;-- Set the database to single user&lt;br /&gt;&lt;strong&gt;Alter Database MyDatabase set SINGLE_USER WITH ROLLBACK IMMEDIATE &lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;The above statement will rollback the current transaction immediately and bring the DB to Single_USER&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;WITH ROLLBACK AFTER integer [SECONDS]&lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;This command tells DB engine to wait for the specified seconds before rolling back all the transaction. If the transaction still not committed in the given seconds then rollback.&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;ALTER DATABASE MyDatabase SET SINGLE_USER WITH ROLLBACK AFTER 30&lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;The above statement will bring the database to SINGLE_USER after 30 sec. If any transaction is there after 30 sec it will rollback.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;WITH NO_WAIT &lt;/strong&gt;&lt;br /&gt;This is bit different from the above two statements. This tells the DB engine to stop or terminate ALTER Statement rather than terminating or rollback the transaction. Ie. If any active transaction is there on the database, the ALTER Statement will fail.&lt;br /&gt;&lt;strong&gt;&lt;br /&gt; ALTER DATABASE MyDatabase SET SINGLE_USER WITH   NO_WAIT&lt;/strong&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1146926327588070502-181236873590146816?l=madhuottapalam.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://madhuottapalam.blogspot.com/feeds/181236873590146816/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=1146926327588070502&amp;postID=181236873590146816' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1146926327588070502/posts/default/181236873590146816'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1146926327588070502/posts/default/181236873590146816'/><link rel='alternate' type='text/html' href='http://madhuottapalam.blogspot.com/2009/06/faq-what-is-with-rollback-rollback.html' title='FAQ : What is WITH ROLLBACK  ROLLBACK IMMEDIATE |   AFTER integer [SECONDS] | NO_WAIT  in ALTER DATABASE in SQL Server'/><author><name>Madhu K Nair</name><uri>http://www.blogger.com/profile/08936146465563191414</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='30' height='32' src='http://1.bp.blogspot.com/_4wBIz276vTw/TKtTNRq6sZI/AAAAAAAAASA/DVQPmnwt50c/S220/Madhu.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1146926327588070502.post-6155620147953054531</id><published>2009-06-26T22:38:00.000-07:00</published><updated>2009-11-27T23:22:27.555-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='FAQ'/><title type='text'>FAQ : What is Database in SQL Server and Oracle?</title><content type='html'>&lt;strong&gt;Database in SQL Server.&lt;/strong&gt;&lt;br /&gt;A Microsoft SQL Server database is a collection of entities that stores and  manipulate data. There are two types of Databases in SQL Server, System Databases and User Databases. There are four system databases which is mandatory in any instance. An instance can have max 32767 user databases which is not practical in real time scenario. But instances with 100s of DBs may be common.    A database in SQL Server is made up of a collection of tables. These tables contain data and other objects, such as views, indexes, stored procedures, user-defined functions, and triggers that are defined to support activities performed with the data. The data stored in a database is typically related to a particular subject or process, such as inventory information for a manufacturing warehouse.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;Database in Oracle&lt;/strong&gt;&lt;br /&gt;In Oracle the database is physical structure that consists of files stored on disks . Oracle’s database structures include tablespaces, control files, redo log files, archived logs, block change tracking files, Flashback logs, and recovery backup (RMAN) files etc. &lt;br /&gt;&lt;br /&gt;One point to note here is, in general , the database definition may looks like  similar in both SQL Server and Oracle but the way it implemented is little different. Oracle generally, will have single database and different schema for each User (read department) .  And Oracle provides a feature to backup /restore only single schema /user. But in SQL Server though there is schema, but this backup/restore feature is not available by default (yes there is a tweaking but not recommended). So in SQL Server we may create separate database for each Department/user. In that case keeping FK relation across database  is not possible.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1146926327588070502-6155620147953054531?l=madhuottapalam.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://madhuottapalam.blogspot.com/feeds/6155620147953054531/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=1146926327588070502&amp;postID=6155620147953054531' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1146926327588070502/posts/default/6155620147953054531'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1146926327588070502/posts/default/6155620147953054531'/><link rel='alternate' type='text/html' href='http://madhuottapalam.blogspot.com/2009/09/faq-what-is-database-in-sql-server-and.html' title='FAQ : What is Database in SQL Server and Oracle?'/><author><name>Madhu K Nair</name><uri>http://www.blogger.com/profile/08936146465563191414</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='30' height='32' src='http://1.bp.blogspot.com/_4wBIz276vTw/TKtTNRq6sZI/AAAAAAAAASA/DVQPmnwt50c/S220/Madhu.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1146926327588070502.post-7627900029015951078</id><published>2009-06-26T22:02:00.000-07:00</published><updated>2009-11-27T23:22:59.624-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='FAQ'/><title type='text'>FAQ : What is an instance   in SQL Server and Oracle</title><content type='html'>&lt;strong&gt;SQL Server Instance : &lt;/strong&gt;&lt;br /&gt;In SQL Server you can have multiple instance running on same physical machine. It means, you will have multiple database engine (windows services) running on the same machine. Each instance of the SQL Server database engine has its own set of system and user databases that are not shared between instances. Each instance will have its own memory area and other resources.  There are two types on instances in SQL Server, Default instance and Named Instance. You will have only one Default instance on a machine but may have more than one (depends upon the edition of SQL Server what you have, it can be anything upto 50) Named Instance on a machine. &lt;br /&gt;&lt;br /&gt;&lt;strong&gt;Why we need multiple instance of SQL Server?&lt;/strong&gt;&lt;br /&gt;The reason can be technical or non-technical (political). Ie. If you want to have more resources allocated for a particular department(read database(s)) than other department(s) you may go for different instances per department (Exception : In SQL Server2008 onwards there is resource governor feature which can control resource allocation). Another technical reason would be if one of your applications is highly tempdb intensive then you may go for different instances because each instance will have its own tempdb. &lt;br /&gt;&lt;br /&gt;Political reason is, generally SA privilege may not be sharable between departments and each department would like to have its own SA, then you may go for different instances. &lt;br /&gt;&lt;br /&gt;&lt;strong&gt;Oracle Instance.&lt;/strong&gt;&lt;br /&gt;Instance in Oracle is not similar to Instance in SQL Server. Generally, people uses Instances and Databases in Oracle as synonyms which is incorrect. One need to understand the distinction to understand the Oracle Architecture. To explain Instance in Oracle you need to understand what is Database in oracle too. In short, Databases are PHYSICAL and Instances are LOGICAL. Instance consists of memory structures and process in the server.  Oracle has an area of shared memory called System Global Area (SGA) and each process have its own private memory area called Program Global Area (PGA). Instance to Database is ONE TO ONE. Ie An Instance can be part of only one Database but database can have multiple Instances (I never see some thing like this in my short stint as Oracle developer). &lt;br /&gt;&lt;br /&gt;&lt;strong&gt;Why you would go for multiple instance in Oracle? &lt;/strong&gt;&lt;br /&gt;I would like to have the answer for this question from viewer. I do have some idea, but not convinced as the way SQL Server reasoning for Multiple instance on same machine.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1146926327588070502-7627900029015951078?l=madhuottapalam.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://madhuottapalam.blogspot.com/feeds/7627900029015951078/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=1146926327588070502&amp;postID=7627900029015951078' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1146926327588070502/posts/default/7627900029015951078'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1146926327588070502/posts/default/7627900029015951078'/><link rel='alternate' type='text/html' href='http://madhuottapalam.blogspot.com/2009/09/faq-what-is-instance-in-sql-server-and.html' title='FAQ : What is an instance   in SQL Server and Oracle'/><author><name>Madhu K Nair</name><uri>http://www.blogger.com/profile/08936146465563191414</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='30' height='32' src='http://1.bp.blogspot.com/_4wBIz276vTw/TKtTNRq6sZI/AAAAAAAAASA/DVQPmnwt50c/S220/Madhu.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1146926327588070502.post-8657420441544732084</id><published>2009-05-17T10:01:00.000-07:00</published><updated>2009-11-27T23:23:15.049-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='FAQ'/><title type='text'>FAQ : SQL Server 2005 Error, OBJECT_SCHEMA_NAME is not a recognized built-in function name</title><content type='html'>OBJECT_SCHEMA_NAME function was newly introduced in SQL Server 2005 SP2. If you have not applied SP2 you will have "OBJECT_SCHEMA_NAME is not a recognized built-in function name" error.&lt;br /&gt;&lt;br /&gt;Download and Install SP2 to solve this problem.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1146926327588070502-8657420441544732084?l=madhuottapalam.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://madhuottapalam.blogspot.com/feeds/8657420441544732084/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=1146926327588070502&amp;postID=8657420441544732084' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1146926327588070502/posts/default/8657420441544732084'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1146926327588070502/posts/default/8657420441544732084'/><link rel='alternate' type='text/html' href='http://madhuottapalam.blogspot.com/2009/05/faq-sql-server-2005-error.html' title='FAQ : SQL Server 2005 Error, OBJECT_SCHEMA_NAME is not a recognized built-in function name'/><author><name>Madhu K Nair</name><uri>http://www.blogger.com/profile/08936146465563191414</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='30' height='32' src='http://1.bp.blogspot.com/_4wBIz276vTw/TKtTNRq6sZI/AAAAAAAAASA/DVQPmnwt50c/S220/Madhu.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1146926327588070502.post-5783393838664274917</id><published>2009-05-04T07:30:00.000-07:00</published><updated>2009-11-27T23:23:35.644-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='FAQ'/><category scheme='http://www.blogger.com/atom/ns#' term='openrowset'/><category scheme='http://www.blogger.com/atom/ns#' term='Excel 2007'/><category scheme='http://www.blogger.com/atom/ns#' term='Data import'/><title type='text'>FAQ : How to import MS Excel 2007 data to SQL Server</title><content type='html'>&lt;strong&gt;Import data from Office 2007 Excel to SQL Server&lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;SELECT * INTO YourTableName FROM OPENROWSET('Microsoft.ACE.OLEDB.12.0', &lt;br /&gt;'Excel 12.0;Database=C:\YourExcelfilename.xlsx', [Sheet1$])&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;Import data from Office 2003 Excel to SQL Server&lt;/strong&gt;&lt;br /&gt; &lt;br /&gt;SELECT * INTO YourTableName&lt;br /&gt;FROM OPENROWSET ('Microsoft.Jet.OLEDB.4.0','Excel 8.0; Database=c:\bb.xls',&lt;br /&gt; 'SELECT * FROM [Sheet1$]') AS XL&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1146926327588070502-5783393838664274917?l=madhuottapalam.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://madhuottapalam.blogspot.com/feeds/5783393838664274917/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=1146926327588070502&amp;postID=5783393838664274917' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1146926327588070502/posts/default/5783393838664274917'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1146926327588070502/posts/default/5783393838664274917'/><link rel='alternate' type='text/html' href='http://madhuottapalam.blogspot.com/2009/09/faq-how-to-import-ms-excel-2007-data-to.html' title='FAQ : How to import MS Excel 2007 data to SQL Server'/><author><name>Madhu K Nair</name><uri>http://www.blogger.com/profile/08936146465563191414</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='30' height='32' src='http://1.bp.blogspot.com/_4wBIz276vTw/TKtTNRq6sZI/AAAAAAAAASA/DVQPmnwt50c/S220/Madhu.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1146926327588070502.post-2045028570836397987</id><published>2009-04-22T23:02:00.000-07:00</published><updated>2009-05-03T23:03:07.893-07:00</updated><title type='text'>Tech Ed India 2009</title><content type='html'>Tech Ed India 2009 at Hyderabad brings to you the best of the IT Pro technologies in-depth coverage! Check  &lt;a href="http://blogs.technet.com/technetindia/"&gt;here&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1146926327588070502-2045028570836397987?l=madhuottapalam.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://madhuottapalam.blogspot.com/feeds/2045028570836397987/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=1146926327588070502&amp;postID=2045028570836397987' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1146926327588070502/posts/default/2045028570836397987'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1146926327588070502/posts/default/2045028570836397987'/><link rel='alternate' type='text/html' href='http://madhuottapalam.blogspot.com/2009/04/tech-ed-india-2009.html' title='Tech Ed India 2009'/><author><name>Madhu K Nair</name><uri>http://www.blogger.com/profile/08936146465563191414</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='30' height='32' src='http://1.bp.blogspot.com/_4wBIz276vTw/TKtTNRq6sZI/AAAAAAAAASA/DVQPmnwt50c/S220/Madhu.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1146926327588070502.post-8487589100624988061</id><published>2009-02-08T06:12:00.000-08:00</published><updated>2009-02-08T06:13:46.938-08:00</updated><title type='text'>Visual Representation of SQL Joins</title><content type='html'>&lt;a href="http://www.codeproject.com/KB/database/Visual_SQL_Joins.aspx"&gt;Excellent article on Joins  &lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1146926327588070502-8487589100624988061?l=madhuottapalam.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://madhuottapalam.blogspot.com/feeds/8487589100624988061/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=1146926327588070502&amp;postID=8487589100624988061' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1146926327588070502/posts/default/8487589100624988061'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1146926327588070502/posts/default/8487589100624988061'/><link rel='alternate' type='text/html' href='http://madhuottapalam.blogspot.com/2009/02/visual-representation-of-sql-joins.html' title='Visual Representation of SQL Joins'/><author><name>Madhu K Nair</name><uri>http://www.blogger.com/profile/08936146465563191414</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='30' height='32' src='http://1.bp.blogspot.com/_4wBIz276vTw/TKtTNRq6sZI/AAAAAAAAASA/DVQPmnwt50c/S220/Madhu.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1146926327588070502.post-967475356927439660</id><published>2008-12-18T02:08:00.000-08:00</published><updated>2008-12-30T02:10:02.349-08:00</updated><title type='text'>Service Pack 3 for Microsoft SQL Server 2005 released</title><content type='html'>&lt;a href="http://www.microsoft.com/downloads/details.aspx?FamilyID=ae7387c3-348c-4faa-8ae5-949fdfbe59c4&amp;displaylang=en"&gt;Service Pack 3 for Microsoft SQL Server 2005 is now available.&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1146926327588070502-967475356927439660?l=madhuottapalam.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://madhuottapalam.blogspot.com/feeds/967475356927439660/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=1146926327588070502&amp;postID=967475356927439660' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1146926327588070502/posts/default/967475356927439660'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1146926327588070502/posts/default/967475356927439660'/><link rel='alternate' type='text/html' href='http://madhuottapalam.blogspot.com/2008/12/service-pack-3-for-microsoft-sql-server.html' title='Service Pack 3 for Microsoft SQL Server 2005 released'/><author><name>Madhu K Nair</name><uri>http://www.blogger.com/profile/08936146465563191414</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='30' height='32' src='http://1.bp.blogspot.com/_4wBIz276vTw/TKtTNRq6sZI/AAAAAAAAASA/DVQPmnwt50c/S220/Madhu.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1146926327588070502.post-3145769916421733607</id><published>2008-09-10T21:42:00.000-07:00</published><updated>2009-11-28T00:32:38.607-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='FAQ'/><title type='text'>FAQ : How to Restore Suspect Database in SQL Server</title><content type='html'>Check &lt;a href="http://www.sqlskills.com/blogs/paul/post/TechEd-Demo-Creating-detaching-re-attaching-and-fixing-a-suspect-database.aspx"&gt;this post by Paul Randal&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1146926327588070502-3145769916421733607?l=madhuottapalam.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://madhuottapalam.blogspot.com/feeds/3145769916421733607/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=1146926327588070502&amp;postID=3145769916421733607' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1146926327588070502/posts/default/3145769916421733607'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1146926327588070502/posts/default/3145769916421733607'/><link rel='alternate' type='text/html' href='http://madhuottapalam.blogspot.com/2008/10/faq-how-to-restore-suspect-database-in.html' title='FAQ : How to Restore Suspect Database in SQL Server'/><author><name>Madhu K Nair</name><uri>http://www.blogger.com/profile/08936146465563191414</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='30' height='32' src='http://1.bp.blogspot.com/_4wBIz276vTw/TKtTNRq6sZI/AAAAAAAAASA/DVQPmnwt50c/S220/Madhu.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1146926327588070502.post-3759868577902636627</id><published>2008-09-10T06:43:00.000-07:00</published><updated>2008-09-10T06:45:57.699-07:00</updated><title type='text'>Wonderful resource in Concatenating row values in Transact-SQL</title><content type='html'>&lt;a href="http://www.projectdmx.com/tsql/rowconcatenate.aspx"&gt;Check out this article by Umachandar Jayachandran &amp; Team&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1146926327588070502-3759868577902636627?l=madhuottapalam.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://madhuottapalam.blogspot.com/feeds/3759868577902636627/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=1146926327588070502&amp;postID=3759868577902636627' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1146926327588070502/posts/default/3759868577902636627'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1146926327588070502/posts/default/3759868577902636627'/><link rel='alternate' type='text/html' href='http://madhuottapalam.blogspot.com/2008/09/wonderful-resource-in-concatenating-row.html' title='Wonderful resource in Concatenating row values in Transact-SQL'/><author><name>Madhu K Nair</name><uri>http://www.blogger.com/profile/08936146465563191414</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='30' height='32' src='http://1.bp.blogspot.com/_4wBIz276vTw/TKtTNRq6sZI/AAAAAAAAASA/DVQPmnwt50c/S220/Madhu.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1146926327588070502.post-9151562156119058676</id><published>2008-08-29T06:20:00.000-07:00</published><updated>2009-11-28T00:33:14.657-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='FAQ'/><title type='text'>Restoring  Master and MSDB database  in SQL Server</title><content type='html'>I don't need to mention the significance of Disaster Recovery (DR) plan for System  and User Databases in SQL Server. I do test DR plan for User Database very often, but System Database generally I skip.  In this post, I want to explain the DR plan and DR Plan testing for System databases. System database restoration is not as similar as User Database restoration. There are broadly three scenario  where system database (Master and MSDB ) needs to be restored&lt;br /&gt;&lt;br /&gt;(a) Master or MSDB to be restored from a earlier backup to undo the changes&lt;br /&gt;(b) The Server machine crashed and sql server have been reinstalled with fresh copy.&lt;br /&gt;(c) SQL Server is not starting because Master database corrupted&lt;br /&gt;    This scenario is well covered in this &lt;a href="http://www.sql-articles.com/index.php?page=articles/rebuildsysdb.html"&gt;article&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight:bold;"&gt;Proposed Backup Plan for System Databases&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;(a) Full Backup Daily &lt;br /&gt;(b) If any major changes done like replication configuration  or creation of Jobs take a  backup of system databases after the configuration &lt;br /&gt;&lt;br /&gt;You can either go for Hot Backup of Cold Backup of System databases. Hot backup is nothing but taking backup of system databases using BACKUP DATABASE T-SQL Command and you have to restore that backup using RESTORE DATABASE command. Hot backup is an online activity. Cold backup is stopping the SQL Server Engine , Copy MDF and LDF physical files to a backup location and Restart the service. Cold backup requires downtime and generally it is not the case in Production servers. &lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight:bold;"&gt;Scenario 1 : Restore Master &amp; MSDB databases form the Backup file&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;I have full backup of Master and MSDB. My Master and MSDN databases got corrupted or i did some major changes and i want to rollback. Since i have backup i can restore the system database from the backup.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight:bold;"&gt;High level Steps&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;(a) Stop and Start the SQL Server Database Engine in Singe User Mode&lt;br /&gt;(b) Restore the Master Database from SQLCMD prompt&lt;br /&gt;(c) Start the SQL Server Database Engine&lt;br /&gt;(d) Restore MSDB Database&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Windows Start --  Run – Services.MSC  --- Enter&lt;br /&gt;&lt;br /&gt;You will get this window&lt;br /&gt;&lt;br /&gt;&lt;a href="http://2.bp.blogspot.com/_4wBIz276vTw/SLf3_nLSkBI/AAAAAAAAAIo/6sDS03nZ2Z4/s1600-h/Sysdb1.JPG"&gt;&lt;img style="float:left; margin:0 10px 10px 0;cursor:pointer; cursor:hand;" src="http://2.bp.blogspot.com/_4wBIz276vTw/SLf3_nLSkBI/AAAAAAAAAIo/6sDS03nZ2Z4/s320/Sysdb1.JPG" border="0" alt=""id="BLOGGER_PHOTO_ID_5239929363689017362" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;a href="http://1.bp.blogspot.com/_4wBIz276vTw/SLf4K55YJkI/AAAAAAAAAIw/Wri5Oki7c-U/s1600-h/Sysdb2.JPG"&gt;&lt;img style="float:left; margin:0 10px 10px 0;cursor:pointer; cursor:hand;" src="http://1.bp.blogspot.com/_4wBIz276vTw/SLf4K55YJkI/AAAAAAAAAIw/Wri5Oki7c-U/s320/Sysdb2.JPG" border="0" alt=""id="BLOGGER_PHOTO_ID_5239929557692720706" /&gt;&lt;/a&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;&lt;br /&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;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Restore the Master Database from Command Prompt&lt;br /&gt;&lt;br /&gt;Windows --- Start --- Run --- CMD --- Enter&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;a href="http://1.bp.blogspot.com/_4wBIz276vTw/SLf4Qv2RNSI/AAAAAAAAAI4/OObTtU4n7XU/s1600-h/Sysdb3.JPG"&gt;&lt;img style="float:left; margin:0 10px 10px 0;cursor:pointer; cursor:hand;" src="http://1.bp.blogspot.com/_4wBIz276vTw/SLf4Qv2RNSI/AAAAAAAAAI4/OObTtU4n7XU/s320/Sysdb3.JPG" border="0" alt=""id="BLOGGER_PHOTO_ID_5239929658074543394" /&gt;&lt;/a&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;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;-- If the Screen is not readable this is the command and the result&lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;C:\&gt;SQLCMD&lt;br /&gt;1&gt; RESTORE DATABASE MASTER FROM DISK='D:\MASTER_FULL.BAK' WITH REPLACE&lt;br /&gt;2&gt; GO&lt;br /&gt;Processed 352 pages for database 'MASTER', file 'master' on file 1.&lt;br /&gt;Processed 2 pages for database 'MASTER', file 'mastlog' on file 1.&lt;br /&gt;The master database has been successfully restored. Shutting down SQL Server.&lt;br /&gt;SQL Server is terminating this process.&lt;br /&gt;&lt;br /&gt;C:\&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;The message says that you have successfully restored Master database.&lt;br /&gt;&lt;br /&gt;Note : You have to restart the Database Engine Now&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;a href="http://1.bp.blogspot.com/_4wBIz276vTw/SLf4lOGjXYI/AAAAAAAAAJA/s3DoS9r9e6k/s1600-h/Sysdb4.JPG"&gt;&lt;img style="float:left; margin:0 10px 10px 0;cursor:pointer; cursor:hand;" src="http://1.bp.blogspot.com/_4wBIz276vTw/SLf4lOGjXYI/AAAAAAAAAJA/s3DoS9r9e6k/s320/Sysdb4.JPG" border="0" alt=""id="BLOGGER_PHOTO_ID_5239930009793289602" /&gt;&lt;/a&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;&lt;br /&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;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight:bold;"&gt;Restore MSDB Database from Management Studio&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;RESTORE DATABASE MSDB FROM DISK='D:\MSDB_FULL.BAK' WITH REPLACE&lt;br /&gt;&lt;br /&gt; &lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight:bold;"&gt;Scenario 2 : Server Crashes – Reinstalled SQL Server Instance &lt;/span&gt;&lt;br /&gt;&lt;br /&gt;In this scenario, the important point is , you must build the new installation to the same build from where the backup was taken. You have to have same OS Version Edition, Service pack ,Patches and You  also must have SQL Server Version , Edition , Service Pack and Patches as the Earlier server from where the backup was taken.  Once you build your server to the same configuration the process is same as mentioned in Scenario 1&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1146926327588070502-9151562156119058676?l=madhuottapalam.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://madhuottapalam.blogspot.com/feeds/9151562156119058676/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=1146926327588070502&amp;postID=9151562156119058676' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1146926327588070502/posts/default/9151562156119058676'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1146926327588070502/posts/default/9151562156119058676'/><link rel='alternate' type='text/html' href='http://madhuottapalam.blogspot.com/2008/08/restoring-master-and-msdb-database-in.html' title='Restoring  Master and MSDB database  in SQL Server'/><author><name>Madhu K Nair</name><uri>http://www.blogger.com/profile/08936146465563191414</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='30' height='32' src='http://1.bp.blogspot.com/_4wBIz276vTw/TKtTNRq6sZI/AAAAAAAAASA/DVQPmnwt50c/S220/Madhu.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://2.bp.blogspot.com/_4wBIz276vTw/SLf3_nLSkBI/AAAAAAAAAIo/6sDS03nZ2Z4/s72-c/Sysdb1.JPG' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1146926327588070502.post-6397350247919477188</id><published>2008-08-28T04:24:00.000-07:00</published><updated>2009-11-28T00:33:34.745-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='FAQ'/><title type='text'>Configuring Linked Server from SQL Server to MySQL</title><content type='html'>Recently I got a project in which there was a Migration Task to be done from MYSql to SQL Server.  Prior to this I never worked in MySQL and I thought it would be just simple as creating LinkedServer to mySQL and pull the data to SQL Server from SQL Server itself. So I decided to create linked server from SQL Server to My SQL and pull the data using OPENQuery Function. I tried to configure linked server in SQL Server  and then realized that it is not simple as that. I had to lot of  steps like download driver, install it , configure the provider etc.  As usual I searched in net and found a thread which neatly mentioned the steps ( &lt;a href="http://www.sqlservercentral.com/Forums/Topic340912-146-1.aspx"&gt;SQLServerCentral.com&lt;/a&gt;). This thread really solved my problem in hours. Of course the thread was good enough for an expert (indirect way of saying that am an expert ), but for a newbie it may  be bit confusing. So I thought to make a comprehensive document which has all the step by step screen shots so that the process will be easier.  Having said that,  I am not taking any credit  for this document, the whole credit goes to Jim Dillon who posted his solution in the above mentioned site. &lt;br /&gt;&lt;br /&gt;&lt;strong&gt;Tested Environment :&lt;/strong&gt;&lt;br /&gt;&lt;strong&gt;Operating System :&lt;/strong&gt; Windows XP, Windows 2000, Windows 2003&lt;br /&gt;&lt;strong&gt;SQL Server   :&lt;/strong&gt;  SQL Server 2005, (Note : I have not tested SQL Server 2000 but I feel it should work)&lt;br /&gt;&lt;strong&gt;MySQL   :&lt;/strong&gt;  MySQL Server 5.0&lt;br /&gt;&lt;strong&gt;MySQL ODBC  :&lt;/strong&gt;  ODBC 3.51&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;High level Steps&lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;• Download and Install ODBC Driver from  MYSQL Site&lt;br /&gt;• Create ODBC DSN&lt;br /&gt;• Create Linked Server in SQL Server&lt;br /&gt;• Configure Provider&lt;br /&gt;• Create linked server&lt;br /&gt;• Enable OpenQuery in SQL Server instance &lt;br /&gt;• Create Openquery  script&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;Step 1 : Download MySQL  ODBC Connector&lt;/strong&gt;&lt;br /&gt;Download   MySQL Connector/ODBC 3.51  from : &lt;a href="http://dev.mysql.com/downloads/connector/odbc/3.51.html"&gt;http://dev.mysql.com/downloads/connector/odbc/3.51.html&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Download the ODBC connector for your Operating System. I have windows xp , so I will download Windows MSI installer (x86)&lt;br /&gt;&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://2.bp.blogspot.com/_4wBIz276vTw/SLaasr8_daI/AAAAAAAAAGQ/KyzBZTjEC0E/s1600-h/MySQL1.JPG"&gt;&lt;img style="float:left; margin:0 10px 10px 0;cursor:pointer; cursor:hand;" src="http://2.bp.blogspot.com/_4wBIz276vTw/SLaasr8_daI/AAAAAAAAAGQ/KyzBZTjEC0E/s320/MySQL1.JPG" border="0" alt=""id="BLOGGER_PHOTO_ID_5239545308995614114" /&gt;&lt;/a&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;&lt;br /&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;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight:bold;"&gt;Step 2 : Install ODBC connector &lt;/span&gt;&lt;br /&gt;&lt;br /&gt;Double click the downloaded file  &lt;br /&gt;&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://2.bp.blogspot.com/_4wBIz276vTw/SLabDRNUkxI/AAAAAAAAAGY/OGC1I8e3QwQ/s1600-h/MySQL2.JPG"&gt;&lt;img style="float:left; margin:0 10px 10px 0;cursor:pointer; cursor:hand;" src="http://2.bp.blogspot.com/_4wBIz276vTw/SLabDRNUkxI/AAAAAAAAAGY/OGC1I8e3QwQ/s320/MySQL2.JPG" border="0" alt=""id="BLOGGER_PHOTO_ID_5239545696953340690" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://3.bp.blogspot.com/_4wBIz276vTw/SLabSkMIxUI/AAAAAAAAAGg/eDqLpuZeiI8/s1600-h/MySQL3.JPG"&gt;&lt;img style="float:left; margin:0 10px 10px 0;cursor:pointer; cursor:hand;" src="http://3.bp.blogspot.com/_4wBIz276vTw/SLabSkMIxUI/AAAAAAAAAGg/eDqLpuZeiI8/s320/MySQL3.JPG" border="0" alt=""id="BLOGGER_PHOTO_ID_5239545959746684226" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://3.bp.blogspot.com/_4wBIz276vTw/SLabZdpNKOI/AAAAAAAAAGo/1zPL_6ybCHE/s1600-h/MySQL4.JPG"&gt;&lt;img style="float:left; margin:0 10px 10px 0;cursor:pointer; cursor:hand;" src="http://3.bp.blogspot.com/_4wBIz276vTw/SLabZdpNKOI/AAAAAAAAAGo/1zPL_6ybCHE/s320/MySQL4.JPG" border="0" alt=""id="BLOGGER_PHOTO_ID_5239546078248642786" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://4.bp.blogspot.com/_4wBIz276vTw/SLabhas-P9I/AAAAAAAAAGw/0zLQ-LxFttg/s1600-h/MySQL5.JPG"&gt;&lt;img style="float:left; margin:0 10px 10px 0;cursor:pointer; cursor:hand;" src="http://4.bp.blogspot.com/_4wBIz276vTw/SLabhas-P9I/AAAAAAAAAGw/0zLQ-LxFttg/s320/MySQL5.JPG" border="0" alt=""id="BLOGGER_PHOTO_ID_5239546214898089938" /&gt;&lt;/a&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;&lt;br /&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;&lt;br /&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;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight:bold;"&gt;At last screen you will get a Finish button and click that. Now You have installed ODBC connector for MySQL.&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight:bold;"&gt;Step 3 : Create System DSN for MYSql ODBC Driver&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;Windows Start --- &gt;&gt; Run --- &gt;&gt; odbcad32 &lt;br /&gt;&lt;br /&gt;Or&lt;br /&gt;&lt;br /&gt;Windows Start --- &gt;&gt;   Control Panel -&gt;Performance and Maintenance (in XP) --- &gt;&gt; Administrative Tools -&gt; Data Sources (ODBC)&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://3.bp.blogspot.com/_4wBIz276vTw/SLac4xDbGQI/AAAAAAAAAG4/P8ROntOiYhk/s1600-h/MySQL6.JPG"&gt;&lt;img style="float:left; margin:0 10px 10px 0;cursor:pointer; cursor:hand;" src="http://3.bp.blogspot.com/_4wBIz276vTw/SLac4xDbGQI/AAAAAAAAAG4/P8ROntOiYhk/s320/MySQL6.JPG" border="0" alt=""id="BLOGGER_PHOTO_ID_5239547715546454274" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://2.bp.blogspot.com/_4wBIz276vTw/SLadIBoBhZI/AAAAAAAAAHA/9NxaDxaO8XQ/s1600-h/MySQL7.JPG"&gt;&lt;img style="float:left; margin:0 10px 10px 0;cursor:pointer; cursor:hand;" src="http://2.bp.blogspot.com/_4wBIz276vTw/SLadIBoBhZI/AAAAAAAAAHA/9NxaDxaO8XQ/s320/MySQL7.JPG" border="0" alt=""id="BLOGGER_PHOTO_ID_5239547977692972434" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://1.bp.blogspot.com/_4wBIz276vTw/SLadOzytP7I/AAAAAAAAAHI/ks4LEbnCv6k/s1600-h/MySQL8.JPG"&gt;&lt;img style="float:left; margin:0 10px 10px 0;cursor:pointer; cursor:hand;" src="http://1.bp.blogspot.com/_4wBIz276vTw/SLadOzytP7I/AAAAAAAAAHI/ks4LEbnCv6k/s320/MySQL8.JPG" border="0" alt=""id="BLOGGER_PHOTO_ID_5239548094238769074" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://2.bp.blogspot.com/_4wBIz276vTw/SLadb9-OZiI/AAAAAAAAAHQ/hCpf00Bt4bY/s1600-h/MySQL9.JPG"&gt;&lt;img style="float:left; margin:0 10px 10px 0;cursor:pointer; cursor:hand;" src="http://2.bp.blogspot.com/_4wBIz276vTw/SLadb9-OZiI/AAAAAAAAAHQ/hCpf00Bt4bY/s320/MySQL9.JPG" border="0" alt=""id="BLOGGER_PHOTO_ID_5239548320309732898" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://1.bp.blogspot.com/_4wBIz276vTw/SLadh0ZJRtI/AAAAAAAAAHY/up68iax68Kc/s1600-h/MySQL10.JPG"&gt;&lt;img style="float:left; margin:0 10px 10px 0;cursor:pointer; cursor:hand;" src="http://1.bp.blogspot.com/_4wBIz276vTw/SLadh0ZJRtI/AAAAAAAAAHY/up68iax68Kc/s320/MySQL10.JPG" border="0" alt=""id="BLOGGER_PHOTO_ID_5239548420817503954" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://1.bp.blogspot.com/_4wBIz276vTw/SLadl6MBL1I/AAAAAAAAAHg/vEXajqWA6ZQ/s1600-h/MySQL11.JPG"&gt;&lt;img style="float:left; margin:0 10px 10px 0;cursor:pointer; cursor:hand;" src="http://1.bp.blogspot.com/_4wBIz276vTw/SLadl6MBL1I/AAAAAAAAAHg/vEXajqWA6ZQ/s320/MySQL11.JPG" border="0" alt=""id="BLOGGER_PHOTO_ID_5239548491092537170" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://2.bp.blogspot.com/_4wBIz276vTw/SLaev69OGyI/AAAAAAAAAHo/v-pQQyzjzrU/s1600-h/MySQL12.JPG"&gt;&lt;img style="float:left; margin:0 10px 10px 0;cursor:pointer; cursor:hand;" src="http://2.bp.blogspot.com/_4wBIz276vTw/SLaev69OGyI/AAAAAAAAAHo/v-pQQyzjzrU/s320/MySQL12.JPG" border="0" alt=""id="BLOGGER_PHOTO_ID_5239549762609224482" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://1.bp.blogspot.com/_4wBIz276vTw/SLafIaSj5xI/AAAAAAAAAHw/5rIY2bdbmL8/s1600-h/MySQL13.JPG"&gt;&lt;img style="float:left; margin:0 10px 10px 0;cursor:pointer; cursor:hand;" src="http://1.bp.blogspot.com/_4wBIz276vTw/SLafIaSj5xI/AAAAAAAAAHw/5rIY2bdbmL8/s320/MySQL13.JPG" border="0" alt=""id="BLOGGER_PHOTO_ID_5239550183337092882" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://1.bp.blogspot.com/_4wBIz276vTw/SLafQu8ihOI/AAAAAAAAAH4/Iod4cd1x3jE/s1600-h/MySQL14.JPG"&gt;&lt;img style="float:left; margin:0 10px 10px 0;cursor:pointer; cursor:hand;" src="http://1.bp.blogspot.com/_4wBIz276vTw/SLafQu8ihOI/AAAAAAAAAH4/Iod4cd1x3jE/s320/MySQL14.JPG" border="0" alt=""id="BLOGGER_PHOTO_ID_5239550326320825570" /&gt;&lt;/a&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;&lt;br /&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;&lt;br /&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;&lt;br /&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;&lt;br /&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;&lt;br /&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;&lt;br /&gt;&lt;span style="font-weight:bold;"&gt;Step 3 : Create Linked Server in SQL Server 2005.&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight:bold;"&gt;Change the properties of the Provider&lt;/span&gt;&lt;br /&gt;Select the properties as shown in the screens&lt;br /&gt;&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://1.bp.blogspot.com/_4wBIz276vTw/SLahHaLvqXI/AAAAAAAAAIA/ReCfN5c0ZzM/s1600-h/MySQL15.JPG"&gt;&lt;img style="float:left; margin:0 10px 10px 0;cursor:pointer; cursor:hand;" src="http://1.bp.blogspot.com/_4wBIz276vTw/SLahHaLvqXI/AAAAAAAAAIA/ReCfN5c0ZzM/s320/MySQL15.JPG" border="0" alt=""id="BLOGGER_PHOTO_ID_5239552365151889778" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://3.bp.blogspot.com/_4wBIz276vTw/SLah3lb0dFI/AAAAAAAAAII/DqTmqn-1h2c/s1600-h/MySQL16.JPG"&gt;&lt;img style="float:left; margin:0 10px 10px 0;cursor:pointer; cursor:hand;" src="http://3.bp.blogspot.com/_4wBIz276vTw/SLah3lb0dFI/AAAAAAAAAII/DqTmqn-1h2c/s320/MySQL16.JPG" border="0" alt=""id="BLOGGER_PHOTO_ID_5239553192805823570" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://1.bp.blogspot.com/_4wBIz276vTw/SLah9J5k58I/AAAAAAAAAIQ/JJMmfikzdA4/s1600-h/MySQL17.JPG"&gt;&lt;img style="float:left; margin:0 10px 10px 0;cursor:pointer; cursor:hand;" src="http://1.bp.blogspot.com/_4wBIz276vTw/SLah9J5k58I/AAAAAAAAAIQ/JJMmfikzdA4/s320/MySQL17.JPG" border="0" alt=""id="BLOGGER_PHOTO_ID_5239553288493656002" /&gt;&lt;/a&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;&lt;br /&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;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;--======================================================================================================&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight:bold;"&gt;Script to Create Linked Server&lt;br /&gt;It is always better to create linked server using Script than GUI. You have more control and script of course is more readable.  I am not  giving the screen shot for this steps.  Copy paste the script to a query analyzer change DSN Name, Username, Password and run.&lt;/span&gt;&lt;br /&gt;--======================================================================================================&lt;br /&gt;/****** Object:  LinkedServer [LinkedServerTOMySQL]    Script Date: 08/28/2008 11:40:28 ******/&lt;br /&gt;EXEC master.dbo.sp_addlinkedserver &lt;br /&gt;  @server = N'LinkedServerTOMySQL',  &lt;br /&gt;  @srvproduct=N'MySQLDatabase',  &lt;br /&gt;  @provider=N'MSDASQL',     &lt;br /&gt;  @datasrc=N'MYSQLODBCConnection'  &lt;br /&gt;&lt;br /&gt;Parameter Explanation&lt;br /&gt;&lt;br /&gt;@server = N'LinkedServerTOMySQL', --  Linked server name (it can be anything)&lt;br /&gt;@srvproduct=N'MySQLDatabase', -- Keep as it is&lt;br /&gt;@provider=N'MSDASQL',    -- Keep as it is&lt;br /&gt;@datasrc=N'MYSQLODBCConnection' --DSN Name Created in Step 3 (very important)&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt; /* For security reasons the linked server remote logins password is changed with ######## */&lt;br /&gt;EXEC master.dbo.sp_addlinkedsrvlogin &lt;br /&gt;      @rmtsrvname=N'LinkedServerTOMySQL',&lt;br /&gt;      @useself=N'False',&lt;br /&gt;      @locallogin=NULL,&lt;br /&gt;      @rmtuser=N'root',&lt;br /&gt;      @rmtpassword='change thepasswordhere'&lt;br /&gt;&lt;br /&gt;GO&lt;br /&gt;EXEC master.dbo.sp_serveroption @server=N'LinkedServerTOMySQL', @optname=N'collation compatible', @optvalue=N'false'&lt;br /&gt;GO&lt;br /&gt;EXEC master.dbo.sp_serveroption @server=N'LinkedServerTOMySQL', @optname=N'data access', @optvalue=N'true'&lt;br /&gt;GO&lt;br /&gt;EXEC master.dbo.sp_serveroption @server=N'LinkedServerTOMySQL', @optname=N'dist', @optvalue=N'false'&lt;br /&gt;GO&lt;br /&gt;EXEC master.dbo.sp_serveroption @server=N'LinkedServerTOMySQL', @optname=N'pub', @optvalue=N'false'&lt;br /&gt;GO&lt;br /&gt;EXEC master.dbo.sp_serveroption @server=N'LinkedServerTOMySQL', @optname=N'rpc', @optvalue=N'false'&lt;br /&gt;GO&lt;br /&gt;EXEC master.dbo.sp_serveroption @server=N'LinkedServerTOMySQL', @optname=N'rpc out', @optvalue=N'false'&lt;br /&gt;GO&lt;br /&gt;EXEC master.dbo.sp_serveroption @server=N'LinkedServerTOMySQL', @optname=N'sub', @optvalue=N'false'&lt;br /&gt;GO&lt;br /&gt;EXEC master.dbo.sp_serveroption @server=N'LinkedServerTOMySQL', @optname=N'connect timeout', @optvalue=N'0'&lt;br /&gt;GO&lt;br /&gt;EXEC master.dbo.sp_serveroption @server=N'LinkedServerTOMySQL', @optname=N'collation name', @optvalue=null&lt;br /&gt;GO&lt;br /&gt;EXEC master.dbo.sp_serveroption @server=N'LinkedServerTOMySQL', @optname=N'lazy schema validation', @optvalue=N'false'&lt;br /&gt;GO&lt;br /&gt;EXEC master.dbo.sp_serveroption @server=N'LinkedServerTOMySQL', @optname=N'query timeout', @optvalue=N'0'&lt;br /&gt;GO&lt;br /&gt;EXEC master.dbo.sp_serveroption @server=N'LinkedServerTOMySQL', @optname=N'use remote collation', @optvalue=N'true'&lt;br /&gt;&lt;br /&gt;--======================================================================================================&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight:bold;"&gt;Enable  Distributed Queries (OpenQuery) in SQL Instance &lt;/span&gt;&lt;br /&gt;By default in SQL Server 2005  Distributed Queries are disabled. You have to enable it using the following script. (&lt;span style="font-weight:bold;"&gt;Note :&lt;/span&gt; In SQL Server 2000 no need to run this script)&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight:bold;"&gt;Copy this script to a query analyzer and run &lt;/span&gt;&lt;br /&gt;EXEC sys.sp_configure N'show advanced options', N'1'  RECONFIGURE WITH OVERRIDE&lt;br /&gt;EXEC sys.sp_configure N'Ad Hoc Distributed Queries', N'1'&lt;br /&gt;RECONFIGURE WITH OVERRIDE&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight:bold;"&gt;&lt;br /&gt;Finally, Test the Linked Server and Run a OpenQuer against the LinkedServer Configured&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;Check the following Screen&lt;br /&gt; &lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://3.bp.blogspot.com/_4wBIz276vTw/SLaji917gjI/AAAAAAAAAIY/VkQ--9xyrJY/s1600-h/MySQL18.JPG"&gt;&lt;img style="float:left; margin:0 10px 10px 0;cursor:pointer; cursor:hand;" src="http://3.bp.blogspot.com/_4wBIz276vTw/SLaji917gjI/AAAAAAAAAIY/VkQ--9xyrJY/s320/MySQL18.JPG" border="0" alt=""id="BLOGGER_PHOTO_ID_5239555037603791410" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://1.bp.blogspot.com/_4wBIz276vTw/SLajoASsCqI/AAAAAAAAAIg/2YVInXlPLSk/s1600-h/MySQL19.JPG"&gt;&lt;img style="float:left; margin:0 10px 10px 0;cursor:pointer; cursor:hand;" src="http://1.bp.blogspot.com/_4wBIz276vTw/SLajoASsCqI/AAAAAAAAAIg/2YVInXlPLSk/s320/MySQL19.JPG" border="0" alt=""id="BLOGGER_PHOTO_ID_5239555124160629410" /&gt;&lt;/a&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;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight:bold;"&gt;Restart Database Engine and SQL Server Agent&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;Once you have completed all the steps you may restart the services. I have not tested this whether you need to restart it or not&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight:bold;"&gt;Summary :  &lt;/span&gt;&lt;br /&gt;If anyone feels some screen shots are missing please drop a comment.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1146926327588070502-6397350247919477188?l=madhuottapalam.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://madhuottapalam.blogspot.com/feeds/6397350247919477188/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=1146926327588070502&amp;postID=6397350247919477188' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1146926327588070502/posts/default/6397350247919477188'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1146926327588070502/posts/default/6397350247919477188'/><link rel='alternate' type='text/html' href='http://madhuottapalam.blogspot.com/2008/08/configuring-linked-server-from-sql.html' title='Configuring Linked Server from SQL Server to MySQL'/><author><name>Madhu K Nair</name><uri>http://www.blogger.com/profile/08936146465563191414</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='30' height='32' src='http://1.bp.blogspot.com/_4wBIz276vTw/TKtTNRq6sZI/AAAAAAAAASA/DVQPmnwt50c/S220/Madhu.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://2.bp.blogspot.com/_4wBIz276vTw/SLaasr8_daI/AAAAAAAAAGQ/KyzBZTjEC0E/s72-c/MySQL1.JPG' height='72' width='72'/><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1146926327588070502.post-1097739667374709754</id><published>2008-08-09T23:23:00.000-07:00</published><updated>2009-11-28T00:34:19.493-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='FAQ'/><category scheme='http://www.blogger.com/atom/ns#' term='How to create files from images stored in database'/><title type='text'>Creating Files from the images stored in Binary format in the database table.</title><content type='html'>&lt;strong&gt;Problem  :-&lt;/strong&gt;&lt;br /&gt;Images are stored in a database  table-Varbinary (SQL Server 2005) column. Form the stored images we need to create individual image files.&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;Solution :&lt;/strong&gt;&lt;br /&gt;BCP QUERYOUT with little format file tweaking can be a wonderful solution for this. You can include this BCP queryout in a XP_CMDShell dynamic sql from SQL Env and it will provide a simple solution to this complex requirement.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;Demo environment details&lt;/strong&gt;&lt;br /&gt;Database  : AdventureWorks&lt;br /&gt;Table   : ProductionPhoto&lt;br /&gt;Image Column  : LargePhoto&lt;br /&gt;There are 101 rows in this table, each one having a LargePhoto column with some image. We need to create 101 JPG files from this table. Here we go…&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;Step 1 :  Creation of Format File&lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;C:\&gt;bcp AdventureWorks.Production.ProductPhoto format nul -T -n -f c:\PP.fmt&lt;br /&gt;&lt;br /&gt;&lt;a href="http://2.bp.blogspot.com/_4wBIz276vTw/SJ69fpJ7UvI/AAAAAAAAAFo/uaxd3HQda2I/s1600-h/StoreBinaryasImage1.JPG"&gt;&lt;img style="float:left; margin:0 10px 10px 0;cursor:pointer; cursor:hand;" src="http://2.bp.blogspot.com/_4wBIz276vTw/SJ69fpJ7UvI/AAAAAAAAAFo/uaxd3HQda2I/s320/StoreBinaryasImage1.JPG" border="0" alt=""id="BLOGGER_PHOTO_ID_5232828168372179698" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;Step 2 : Format file will looks something like this&lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;a href="http://2.bp.blogspot.com/_4wBIz276vTw/SJ69pDaBE-I/AAAAAAAAAFw/DMrhait8F9Y/s1600-h/StoreBinaryasImage2.JPG"&gt;&lt;img style="float:left; margin:0 10px 10px 0;cursor:pointer; cursor:hand;" src="http://2.bp.blogspot.com/_4wBIz276vTw/SJ69pDaBE-I/AAAAAAAAAFw/DMrhait8F9Y/s320/StoreBinaryasImage2.JPG" border="0" alt=""id="BLOGGER_PHOTO_ID_5232828330037810146" /&gt;&lt;/a&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;&lt;strong&gt;Step 3 : Tweak Format file : We need to get the LargePhoto column binary data. &lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;• Remove all column except LargePhoto&lt;br /&gt;• Change Prefix of LargePhoto column from 8 to 0 (zero)&lt;br /&gt;• Change Number of column from 6 to 1&lt;br /&gt;• Change column sequence from 4 to 1&lt;br /&gt;• After the ncessary modification the format file should look like next sceen &lt;br /&gt;&lt;br /&gt;&lt;a href="http://2.bp.blogspot.com/_4wBIz276vTw/SJ69y5aiHKI/AAAAAAAAAF4/BhYxloXykPs/s1600-h/StoreBinaryasImage3.JPG"&gt;&lt;img style="float:left; margin:0 10px 10px 0;cursor:pointer; cursor:hand;" src="http://2.bp.blogspot.com/_4wBIz276vTw/SJ69y5aiHKI/AAAAAAAAAF4/BhYxloXykPs/s320/StoreBinaryasImage3.JPG" border="0" alt=""id="BLOGGER_PHOTO_ID_5232828499154312354" /&gt;&lt;/a&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;&lt;strong&gt;Step 4 : Use BCP QUERYOUT to create Image files&lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;My BCP QUERYOUT query is this&lt;/strong&gt;&lt;br /&gt;--=====================================================================================&lt;br /&gt;C:\&gt;bcp "SELECT top 1 LargePhoto  FROM AdventureWorks.Production.ProductPhoto wh&lt;br /&gt;ere ProductPhotoID=69" queryout c:\ProductPhotoID_69.jpg  -T -fC:\PP.fmt&lt;br /&gt;&lt;br /&gt;Starting copy...&lt;br /&gt;&lt;br /&gt;1 rows copied.&lt;br /&gt;Network packet size (bytes): 4096&lt;br /&gt;Clock Time (ms.) Total     : 1      Average : (1000.00 rows per sec.)&lt;br /&gt;&lt;br /&gt;C:\&gt;&lt;br /&gt;=====================================================================================&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;a href="http://1.bp.blogspot.com/_4wBIz276vTw/SJ69547NJHI/AAAAAAAAAGA/tLK1P8hP6XY/s1600-h/StoreBinaryasImage4.JPG"&gt;&lt;img style="float:left; margin:0 10px 10px 0;cursor:pointer; cursor:hand;" src="http://1.bp.blogspot.com/_4wBIz276vTw/SJ69547NJHI/AAAAAAAAAGA/tLK1P8hP6XY/s320/StoreBinaryasImage4.JPG" border="0" alt=""id="BLOGGER_PHOTO_ID_5232828619281998962" /&gt;&lt;/a&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;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;The above BCP Queryout statement is created a file ProductPhotoID_69.jpg . Now let us go and open that form windows&lt;/strong&gt; &lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;a href="http://3.bp.blogspot.com/_4wBIz276vTw/SJ6TEJ-eJcI/AAAAAAAAAFQ/2J-kMrfK8-Q/s1600-h/StoreBinaryasImage5.JPG"&gt;&lt;img style="float:left; margin:0 10px 10px 0;cursor:pointer; cursor:hand;" src="http://3.bp.blogspot.com/_4wBIz276vTw/SJ6TEJ-eJcI/AAAAAAAAAFQ/2J-kMrfK8-Q/s320/StoreBinaryasImage5.JPG" border="0" alt=""id="BLOGGER_PHOTO_ID_5232781516657796546" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;Double click the file and the file opened&lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;a href="http://3.bp.blogspot.com/_4wBIz276vTw/SJ6TTSch5_I/AAAAAAAAAFY/eD8136CZT70/s1600-h/StoreBinaryasImage6.JPG"&gt;&lt;img style="float:left; margin:0 10px 10px 0;cursor:pointer; cursor:hand;" src="http://3.bp.blogspot.com/_4wBIz276vTw/SJ6TTSch5_I/AAAAAAAAAFY/eD8136CZT70/s320/StoreBinaryasImage6.JPG" border="0" alt=""id="BLOGGER_PHOTO_ID_5232781776629393394" /&gt;&lt;/a&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;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;Step 5 : Loop through all the records in this table and create respective files of each row in C:\Photo folder&lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;--==============================================================================&lt;br /&gt;SET NOCOUNT ON&lt;br /&gt;&lt;br /&gt;DECLARE    @ProductPhotoID int, @Sqlstmt varchar(4000),@LargePhotoFileName varchar(200)  &lt;br /&gt;&lt;br /&gt; &lt;br /&gt;DECLARE Cursor_ProductPhoto CURSOR FOR &lt;br /&gt;SELECT ProductPhotoID, LargePhotoFileName&lt;br /&gt;from AdventureWorks.Production.ProductPhoto&lt;br /&gt;ORDER BY ProductPhotoID&lt;br /&gt;&lt;br /&gt;OPEN Cursor_ProductPhoto&lt;br /&gt;&lt;br /&gt;FETCH NEXT FROM Cursor_ProductPhoto &lt;br /&gt;INTO @ProductPhotoID, @LargePhotoFileName&lt;br /&gt;&lt;br /&gt;WHILE @@FETCH_STATUS = 0&lt;br /&gt;BEGIN&lt;br /&gt;    PRINT @LargePhotoFileName&lt;br /&gt;     &lt;br /&gt;&lt;br /&gt;    -- Framing DynamicSQL for XP_CMDshell  &lt;br /&gt;&lt;br /&gt;    &lt;br /&gt;Set @Sqlstmt='bcp "SELECT top 1 LargePhoto  FROM AdventureWorks.Production.ProductPhoto where ProductPhotoID='+str(@ProductPhotoID)+'" queryout c:\Photo\'+ltrim(@LargePhotoFileName)+'   -T -fC:\PP.fmt'&lt;br /&gt; print @sqlstmt &lt;br /&gt; exec xp_cmdshell @sqlstmt&lt;br /&gt;    FETCH NEXT FROM Cursor_ProductPhoto &lt;br /&gt;    INTO @ProductPhotoID, @LargePhotoFileName&lt;br /&gt;END &lt;br /&gt;CLOSE Cursor_ProductPhoto&lt;br /&gt;DEALLOCATE Cursor_ProductPhoto&lt;br /&gt;&lt;br /&gt;--==============================================================================&lt;br /&gt;&lt;br /&gt;Check this Screen. The above script has created individual files in this folder&lt;br /&gt;&lt;br /&gt;&lt;a href="http://1.bp.blogspot.com/_4wBIz276vTw/SJ6ZAJeMyfI/AAAAAAAAAFg/9uvSZXCDLjY/s1600-h/StoreBinaryasImage7.JPG"&gt;&lt;img style="float:left; margin:0 10px 10px 0;cursor:pointer; cursor:hand;" src="http://1.bp.blogspot.com/_4wBIz276vTw/SJ6ZAJeMyfI/AAAAAAAAAFg/9uvSZXCDLjY/s320/StoreBinaryasImage7.JPG" border="0" alt=""id="BLOGGER_PHOTO_ID_5232788044872731122" /&gt;&lt;/a&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;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;Summary :-&lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;This solution provides very simple method to create files from the binary stored in Database by little tweaking in Format file. If you want to keep a backup of Images in file system format then this method can really help.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1146926327588070502-1097739667374709754?l=madhuottapalam.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://madhuottapalam.blogspot.com/feeds/1097739667374709754/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=1146926327588070502&amp;postID=1097739667374709754' title='3 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1146926327588070502/posts/default/1097739667374709754'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1146926327588070502/posts/default/1097739667374709754'/><link rel='alternate' type='text/html' href='http://madhuottapalam.blogspot.com/2008/08/creating-files-from-images-stored-in.html' title='Creating Files from the images stored in Binary format in the database table.'/><author><name>Madhu K Nair</name><uri>http://www.blogger.com/profile/08936146465563191414</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='30' height='32' src='http://1.bp.blogspot.com/_4wBIz276vTw/TKtTNRq6sZI/AAAAAAAAASA/DVQPmnwt50c/S220/Madhu.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://2.bp.blogspot.com/_4wBIz276vTw/SJ69fpJ7UvI/AAAAAAAAAFo/uaxd3HQda2I/s72-c/StoreBinaryasImage1.JPG' height='72' width='72'/><thr:total>3</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1146926327588070502.post-7457876760035980660</id><published>2008-08-06T21:56:00.000-07:00</published><updated>2008-08-06T23:00:00.656-07:00</updated><title type='text'>Microsoft SQL Server 2008 Released</title><content type='html'>Finally &lt;a href="http://www.microsoft.com/sqlserver/2008/en/us/default.aspx"&gt;Microsoft SQL Server 2008&lt;/a&gt; RTM version is released today. It was suppose to release almost one year back but somehow did not. There are seven editions in SQL Server 2008.&lt;br /&gt;&lt;br /&gt;In a press release, Microsoft cited several large enterprise customers who are testing SQL Server 2008, including Xerox, Siemens, Clear Channel Communications and Fidelity Investments.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1146926327588070502-7457876760035980660?l=madhuottapalam.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://madhuottapalam.blogspot.com/feeds/7457876760035980660/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=1146926327588070502&amp;postID=7457876760035980660' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1146926327588070502/posts/default/7457876760035980660'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1146926327588070502/posts/default/7457876760035980660'/><link rel='alternate' type='text/html' href='http://madhuottapalam.blogspot.com/2008/08/microsoft-sql-server-2008-released.html' title='Microsoft SQL Server 2008 Released'/><author><name>Madhu K Nair</name><uri>http://www.blogger.com/profile/08936146465563191414</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='30' height='32' src='http://1.bp.blogspot.com/_4wBIz276vTw/TKtTNRq6sZI/AAAAAAAAASA/DVQPmnwt50c/S220/Madhu.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1146926327588070502.post-8658180664384569822</id><published>2008-07-24T01:05:00.000-07:00</published><updated>2008-08-01T00:41:34.007-07:00</updated><title type='text'>Best Practices, Design and Development Guidelines for SQL Server</title><content type='html'>There are many resources available in the net but here I have a list of Best Practices,Design Guidelines and General Guidelines in Database Development and Designing specifically for SQL Server. &lt;br /&gt;&lt;br /&gt;&lt;strong&gt;Best Practices&lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;1. Use Stored Procedure: Benefits are as follows :-&lt;br /&gt;(a) Code reusability&lt;br /&gt;(b) Security : You can control permission on sp&lt;br /&gt;(c) Execution plan reusability : Though adhoc query also create and reuse plan, the plan is reused only when the query is textual match and the datatypes are matching with the previous call. Any datatype or you have an extra space in the query then new plan is created&lt;br /&gt;Eg. &lt;br /&gt;-------------------------------------------------------------------------------------&lt;br /&gt;Select  Sal from Employee where sal=$10  --Money&lt;br /&gt;--And&lt;br /&gt;Select  Sal from Employee where sal=10  -- Int &lt;br /&gt;-------------------------------------------------------------------------------------&lt;br /&gt;Above statements will create different execution plan because the datatype of value is different.&lt;br /&gt;(d) Procedure gives more Readability and Manageability.&lt;br /&gt;&lt;br /&gt;2. Use Fully Qualified Name for objects : This is very significant. You must use fully qualified name when you refer any object in SQL Server. Ie. SchemaName.ObjectName. Because, when the execution plan is prepared by the query engine , in the binding process, Query engine has to resolve the Object existence. If you specify the fully qualified name the object resolution become easy for the engine and also it will be more readable. &lt;br /&gt;&lt;br /&gt;3. Avoid using Scalar Function in SELECT statement: Recently I faced this issue and I emphasis this point. Never use Scalar function inside a query which returns a large number of rows. Scalar function behave like a cursor when you use Scalar function inside a query which returns large number of rows . Change the scalar function to Inline or Multiline table function or a view.&lt;br /&gt;&lt;br /&gt;4. Avoid Mixing-up DML and DDL statement on a temp table inside sp : This is very important. When you Create a temptable (#table) and ALTER the same temptable in the same storedprocedure later, this DDL and DML mix-up causes the stored procedure to get recompiled. So, if a stored procedure is getting recompiled in each call check this point.&lt;br /&gt;&lt;br /&gt;5. Select only the required columns: Select only the required column in select statement. Usage of SELECT * can be the cause of NOT using the indexes available on the table . Also if you are selecting more data then you are doing more IO. In short we should limit the IO.&lt;br /&gt;&lt;br /&gt;6. Avoid Usage of HINTS : HINTS prevent Query engine automated optimization capability. You may find a hint gives you better performance on a particular scenario. But it may behave differently as the data grows or when scenario changes. Check this KB on HINTS http://msdn.microsoft.com/en-us/library/ms187713.aspx&lt;br /&gt;&lt;br /&gt;7. Use Table variable and Temp table as far as possible: You must use Table variable (@TableName) or Temp table (#TableName) for intermediate storage of records in an procedure. Avoid using Table variable for large record set. There are pros and cons between Table variable and Temp table, but in general, if the record set is small you should go for Table variable. &lt;br /&gt;&lt;br /&gt;8. Use SET NOCOUNT ON : Basically, you must reduce the data transferred on the network. Database Engine, return the number of rows effected by the statements to the client which is unnecessary and you can avoid that using this statement. It is a must in all Stored procedure.&lt;br /&gt;&lt;br /&gt;9. Do not change SET OPTION In connection: Changing SET Option during connection or anywhere else will cause the stored procedure to recompile. Refer this KB for more info http://www.microsoft.com/technet/prodtechnol/sql/2005/recomp.mspx&lt;br /&gt;&lt;br /&gt;10. EXISTS vs IN : IN Operator can easily be replaced by EXISTS which is more optimized for correlated queries. But you may find IN better for small tables.&lt;br /&gt;&lt;br /&gt;11. Keep the transaction as short as possible: Deadlock is a outcome of ill-formed query. You must keep the transaction as short as possible to avoid dead lock. And also refer the object in the same order inside transaction.&lt;br /&gt;&lt;br /&gt;12. Avoid user input inside a transaction: Do not accept a user input inside a transaction. &lt;br /&gt;&lt;br /&gt;13. Avoid doing Front-End work in Databases : String processing , Ordering , Conversion etc can easily be done at the client side and you should avoid doing these kind of work in Database. The point here is, you should have a clear segregation of tasks between Data Layer, Data Access Layer (DAL) and Business Layer. For example, you can easily number your rows in client side where as if you do that in Database you have to use a Function or extra join which can be avoided.&lt;br /&gt;&lt;br /&gt;14. Avoid Function in select statement: Any functions like CONVERT(),CAST,ISNULL usage in query may ignore the indexes available on the table. &lt;br /&gt;&lt;br /&gt;15. Do not use EXEC (‘String’) , use sp_executeSql : As far as possible you try to avoid Dynamic SQL. If there is no other option use sp_ExecuteSQL DO NOT USE EXEC(‘string’). Because EXEC statement is prone to SQL Injection and it is not parametrized query which can re-use execution plan.&lt;br /&gt;&lt;br /&gt;16. Use proper size for the input parameter: This is one of the step to avoid SQL Injection and also the reduce the memory usage.&lt;br /&gt;&lt;br /&gt;17. Do not keep the name of sp with sp_ prefix: Naming convention is very important. Do not name the storedprocedures with SP_ as prefix (eg sp_ somespname ) because this naming convention is used for system stored procedure in MS SQL Server.&lt;br /&gt;&lt;br /&gt;18. USE WHERE Condition as far as possible: Basically, you should limit the rows fetched by the query. &lt;br /&gt;&lt;br /&gt;19. Avoid Negative operator : Avoid using &lt;&gt; , NOT IN, NOT EXISTS kind of operator because it causes a table scan. Query engine has to ensure there is not data till the last row is read.&lt;br /&gt;&lt;br /&gt;20. Avoid Cursor /loops: In SET Based operation, in general looping can be avoided. &lt;br /&gt;&lt;br /&gt;21. Avoid using Like ‘% %’ : If you use % in both side of the searching value, the query will go for table scan which should be avoided. If the application is more text searching kind go for Full Text Index.&lt;br /&gt;&lt;br /&gt;22. Do not use WITH Recompile : Usage of WITH Recompile causes the procedure to recompile each time it call. You must avoid this command.&lt;br /&gt;&lt;br /&gt;23. JOIN Consideration : When you JOIN two table consider these points&lt;br /&gt;(a) Avoid using negative operator (&lt;&gt; ,NOT IN) in JOIN&lt;br /&gt;(b) Avoid Like operator in Join&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;Design Guidelines&lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;1. Create Covering indexes: Create covering indexes. Covering index will have all the data required by the query at the leaf level itself. Covering contains all the columns used in SELECT, WHERE, ORDERBY, JOIN etc. &lt;br /&gt;Eg.&lt;br /&gt;Select Col1,Col2 From YourTableName Where Col3=1 Order by Col4.&lt;br /&gt;The coveing index for the above mentioned query will be&lt;br /&gt;Col1+ col2+ col3+ col4. (Note : Most selective column should come first in the index creation statement)&lt;br /&gt;&lt;br /&gt;2. Remove Unwanted indexes : In SQL Server 2005 it is very easy to find unused indexes. Too many or too less indexes on a table are equally bad. If you have unwanted/unused indexes on a table Insert/Update statement will have performance hit and also we all know indexes consume space.&lt;br /&gt;&lt;br /&gt;3. Create the indexes most selective column as first column in Index : Index creation has to be done after proper analysis. You must create the index with Most Selective column at first and so on.&lt;br /&gt;&lt;br /&gt;4. Formatting the stored procedure and queries : You must have a format / template for each object (sp/function/views) and everyone (the dev team) should stick to the format defined. And also the query has to be formatted well so that it is more readable. &lt;br /&gt;&lt;br /&gt;5. Use Identity column if the table is INSERT oriented table as Clustered Index to avoid page split : This is a design and data modeling issue. If you have more insert kind of table (some kind of logging table) then you must go for Identity Column (ever increasing) as Clustered Index. This helps to resolve page split. There may be Hotspot issue (all transaction contending for same page of a table), but I have never faced. &lt;br /&gt;&lt;br /&gt;6. Use proper fillfactor for Indexes: Very important to avoid Page Split. In general transactional table can be kept at 80-90 fillfactor. &lt;br /&gt;&lt;br /&gt;7. Balanced Normalization / De-normalization: You must have a trade off between Normalization and de-normalization. At time De-normalization can give you better performance at the cost of Data redundancy.&lt;br /&gt;&lt;br /&gt;8. Primary Key size and Composite primary key : You must limit the size of the PK because, in a relational database, you may be creating foreign key which refers this primary key. If you have multiple Column in PK (composite PK) or big size , you are knowingly or unknowingly increasing the space usage. If the composite PK contains more than 3 columns then you may go for surrogate key like Identity column as PK. &lt;br /&gt;&lt;br /&gt;9. Do not alter system Objects: If your application requires some tweaking of system objects then you are in trouble. The structure of system object can be changed by Microsoft in any release or patches. So avoid such modeling.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;Guidelines for Datatype Selection&lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;As a Database architect I believe in the significance of proper datatype selection while designing the tables. if you do a proper analysis of the data and then select the datatype, then you can control the row, page, table size and hence increase the overall performance of the database. Following points you may consider when you design a table :-&lt;br /&gt;&lt;br /&gt;1. If your database is to support web-based application better to go for UNICODE for the scalability of the application. (Unicode (nchar, nvarchar) takes 2 bytes per char where as ASCII (char,varchar) datatypes takes 1 bytes per char) &lt;br /&gt;&lt;br /&gt;2. If your application is multi-lingual go for UNICODE.&lt;br /&gt;&lt;br /&gt;3. If you are planning to include CLRDatatype (SQL Server 2005) in the database go for UNICODE Datatypes , because, if CLRDatatype is going to consume the data then it must be in UNICODE.&lt;br /&gt;&lt;br /&gt;4. For numeric column, find the range that column is going to have and then choose the datatype. For eg. You have a table called Department and DepartmentID is the Primarykey Column. You know that the maximum rows in this table is 20-30. In such cases it is recommended to choose TinyINT datatype for this column. Generally keeping all numeric columns type of INT without analyzing the range that column going to support is not at all recommended from storage perspective. &lt;br /&gt;&lt;br /&gt;5. Description /Comments /Remarks sort of columns may or may not have data for all the rows. So it is better to go for Variable datatypes like Varchar ,Nvarchar.&lt;br /&gt;&lt;br /&gt;6. If you know the column is not nullable and it may contain more or less the same size of the data then for sure go for Fixed datatype like CHAR or NCHAR. Having said that it is important to know that, if you select fixed datatypes and if the column is nullable then, if you do not have any data (null) then also the column will consume the space. &lt;br /&gt;&lt;br /&gt;7. If the size of the column is less than 20 char , use fixed width datatypes like NCHAR or CHAR. &lt;br /&gt;&lt;br /&gt;8. I have seen in many applications use Decimal to store currency kind of data though the application needs the precision which can be supported by money. So, my point here is, use Money datatype if you need only 4 precision.&lt;br /&gt;&lt;br /&gt;9. Use UniqueIdentitifier column as PK and ClusteredIndex or so only when it is unavoidable because UniqueIdentitifier takes 16 Bytes of the space.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;General Guidelines&lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;1. Write ANSI standard Code : You must write standard code which will scale your application. ie migration to next version will not be an issue. Do not use Deprecated features. For eg. There are DBCC Command to rebuild index but in SQL Server 2005 in order to standardize things, you have ALTER INDEX command which does the same thing.&lt;br /&gt;&lt;br /&gt;2. Do not give Error message which expose your architecture to the frontend: I have seen folks giving very detailed error message which tells you “ blah blah table do not have this rows in blah blah database” kind which can be a invitation to the hacker&lt;br /&gt;&lt;br /&gt;3. Use proper Isolation level required for the application: This is very significant. Before going for any isolation level, you must know the implication. All application cannot afford READUNCOMMITTED Isolation level since it can cause data inconsistency issues like Dirty Read, Phantom read, Lost Update etc. WITH NOLOCK Hint is nothing but READ UNCOMMITTED isolation level. &lt;br /&gt;&lt;br /&gt;4. Keep the Database Object Scripts in Source Control: We all are aware of this point but generally ignore. This is important for fault tolerance and management when multiple developers are working on same project.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1146926327588070502-8658180664384569822?l=madhuottapalam.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://madhuottapalam.blogspot.com/feeds/8658180664384569822/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=1146926327588070502&amp;postID=8658180664384569822' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1146926327588070502/posts/default/8658180664384569822'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1146926327588070502/posts/default/8658180664384569822'/><link rel='alternate' type='text/html' href='http://madhuottapalam.blogspot.com/2008/07/there-are-many-lists-available-in-net.html' title='Best Practices, Design and Development Guidelines for SQL Server'/><author><name>Madhu K Nair</name><uri>http://www.blogger.com/profile/08936146465563191414</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='30' height='32' src='http://1.bp.blogspot.com/_4wBIz276vTw/TKtTNRq6sZI/AAAAAAAAASA/DVQPmnwt50c/S220/Madhu.jpg'/></author><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1146926327588070502.post-6428113610469032521</id><published>2008-07-21T23:38:00.000-07:00</published><updated>2008-07-21T23:50:43.752-07:00</updated><title type='text'>Visio - ERROR – Failed  to Initialize the Modeling Engine.</title><content type='html'>Recently I reinstalled Visio 2003 Enterprise Architecture edition and it started popping up the above mentioned error. I was not able to do any Database modeling kind of tasks since the options were not available. I goggled as usual and I found the same issue is being reported by many. The solution for this issue is uninstalling Visio Update patch KB947650. I did the same and it fixed my error &lt;br /&gt;&lt;br /&gt;&lt;strong&gt;follow these steps :-&lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;Control Panel – &lt;br /&gt;Add or  Remove Programs&lt;br /&gt;Check “ Show Updates” check box in Add or Remove programs window&lt;br /&gt;– MS Visio Enterprise Architect &lt;br /&gt;   Select KB947650 update and remove it.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1146926327588070502-6428113610469032521?l=madhuottapalam.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://madhuottapalam.blogspot.com/feeds/6428113610469032521/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=1146926327588070502&amp;postID=6428113610469032521' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1146926327588070502/posts/default/6428113610469032521'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1146926327588070502/posts/default/6428113610469032521'/><link rel='alternate' type='text/html' href='http://madhuottapalam.blogspot.com/2008/07/visio-error-failed-to-initialize.html' title='Visio - ERROR – Failed  to Initialize the Modeling Engine.'/><author><name>Madhu K Nair</name><uri>http://www.blogger.com/profile/08936146465563191414</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='30' height='32' src='http://1.bp.blogspot.com/_4wBIz276vTw/TKtTNRq6sZI/AAAAAAAAASA/DVQPmnwt50c/S220/Madhu.jpg'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1146926327588070502.post-1261078606942614497</id><published>2008-07-15T04:15:00.000-07:00</published><updated>2008-07-23T22:55:23.181-07:00</updated><title type='text'>Scalar Function and Performance Issue</title><content type='html'>Performance tuning is one of the main tasks I do and there is always scope to learn new things in this area. Recently, I got a query which was using a Scalar function takes almost 4 min. When the scalar function is removed it came within one sec. I know scalar function inside a query is not optimized and may be because of that I very rarely use scalar function. But in this particular project, scalar function is very common and tuning query with scalar function is little tricky. Following are the suggestions I got from my MVP friends  :-&lt;br /&gt;(a) If possible create a view and join with the view: This was not possible for me since I had to pass the parameter.&lt;br /&gt;(b) You may also create a Inline or multiline table function: I went with this route. I created a multiline function and I tell you the performance was improved manifold. &lt;br /&gt;&lt;br /&gt;&lt;strong&gt;Sample code&lt;/strong&gt;&lt;br /&gt;The scalar function was something like returning appointments concatenated string for a given EmployeeID&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;Same logic in Multiline function which uses  FOR XML PATH query&lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;Create function fnConcatMultipleRowValuesToColumn ()&lt;br /&gt;Returns @tab Table (EmpID int,con varchar(200))&lt;br /&gt;As&lt;br /&gt;Begin&lt;br /&gt;&lt;br /&gt;DECLARE @Designation TABLE (EmpID INT, Code VARCHAR(50))&lt;br /&gt;&lt;br /&gt;INSERT @Designation&lt;br /&gt;SELECT 100, 'SR. Engr.' UNION ALL&lt;br /&gt;SELECT 100, 'TL' UNION ALL&lt;br /&gt;SELECT 100, 'PM' UNION ALL&lt;br /&gt;SELECT 200, 'QA' UNION ALL&lt;br /&gt;SELECT 200, 'SR QA' UNION ALL&lt;br /&gt;SELECT 200, 'TL QA'UNION ALL&lt;br /&gt;SELECT 300, 'DBA'UNION ALL&lt;br /&gt;SELECT 300, 'SR. DBA'UNION ALL&lt;br /&gt;SELECT 300, 'TL DBA'&lt;br /&gt;&lt;br /&gt;-- Show the expected output&lt;br /&gt;Insert @tab&lt;br /&gt;SELECT DISTINCT s1.EmpID,&lt;br /&gt;  STUFF((SELECT DISTINCT TOP 100 PERCENT ',' + s2.CODE FROM @Designation AS s2&lt;br /&gt;   WHERE s2.EmpID = s1.EmpID ORDER BY ',' + s2.CODE FOR XML PATH('')), 1, 1, '') AS CODES&lt;br /&gt;FROM  @Designation AS s1&lt;br /&gt;ORDER BY s1.EmpID&lt;br /&gt;&lt;br /&gt;Return&lt;br /&gt;End&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;Function Call&lt;/strong&gt;&lt;br /&gt;Select *From fnConcatMultipleRowValuesToColumn ()&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;Summary :&lt;/strong&gt;&lt;br /&gt;Avoid Scalar functions as far as possible. This was introduced in SQL Server 2000 and there may be certain scenario where it may be useful like encapsulation. But when you use scalar function within a select statement which returns many rows may trouble you. &lt;br /&gt;&lt;br /&gt;&lt;strong&gt;Few good resources to refer  &lt;/strong&gt;&lt;br /&gt;http://sqlblog.com/blogs/adam_machanic/archive/2006/08/04/scalar-functions-inlining-and-performance-an-entertaining-title-for-a-boring-post.aspx&lt;br /&gt;http://www.sqlservercentral.com/Forums/Topic446308-360-1.aspx&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1146926327588070502-1261078606942614497?l=madhuottapalam.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://madhuottapalam.blogspot.com/feeds/1261078606942614497/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=1146926327588070502&amp;postID=1261078606942614497' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1146926327588070502/posts/default/1261078606942614497'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1146926327588070502/posts/default/1261078606942614497'/><link rel='alternate' type='text/html' href='http://madhuottapalam.blogspot.com/2008/07/performance-tuning-is-one-of-main-tasks.html' title='Scalar Function and Performance Issue'/><author><name>Madhu K Nair</name><uri>http://www.blogger.com/profile/08936146465563191414</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='30' height='32' src='http://1.bp.blogspot.com/_4wBIz276vTw/TKtTNRq6sZI/AAAAAAAAASA/DVQPmnwt50c/S220/Madhu.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1146926327588070502.post-7381340934137777599</id><published>2008-07-13T09:27:00.000-07:00</published><updated>2008-07-30T00:30:43.917-07:00</updated><title type='text'>Challenges of being a Database Architect</title><content type='html'>I have been working as a database architect for quite sometimes.  Working as a database architect in small organization (for that matter any organization) is very challenging because at times you may be  find yourself into the  projects which do not have any SLA (Service Level Agreement) or even SRS (Software Requirement Specification). There are many Non-Functional Requirement (NFR), you need to be concerned while conceiving the architecture. If you ignore those, then you are in trouble sooner than later. If you have not judged NFR which is not mentioned anywhere in any documents then it will certainly backfire when you implement the project.  I have seen in many projects requires last minutes architectural patch-up because of ignorance or slackness in the Database Architecture’s side. To be in safer side, though there is no SRS or SLA, you should have a list of assumptions in which, whatever concerns you have are mentioned and the assumptions are either agreed or disagreed by the client. If disagree, then client has to mention what are they looking for. By doing this what you achieve is, you are preparing a SRS and SLA by yourself and client is aware of it and approved it knowingly or unknowingly. No need to say, everything has to be properly documented and tracked through mails.    In general, following are few NFRs we as a database architect should be aware of :-&lt;br /&gt;&lt;br /&gt;(a) &lt;strong&gt;Performance is of course the main issue in any project:&lt;/strong&gt; - Generally, when you conceive the data architecture you should be well aware of the current application(s) performance and its issues. Of course the client must  be expecting performance than the existing application (if any) since he/she  is spending lot of money on the new one.  So when you design the model you should be well aware till what level you must normalize and where you want to de-normalize the data to increase the performance. &lt;br /&gt;(b) &lt;strong&gt;Maintainability &amp;supportability: &lt;/strong&gt; This point is very important. The client should be able to maintain the application and the database without any unreasonable increase in cost . For eg. If you are designing architecture where there is a need of proper fulltime DBA and the client is not aware of it or not ready for it.   &lt;br /&gt;(c) &lt;strong&gt;Data migration and synchronization issues:&lt;/strong&gt; - I have seen in many application the client is not aware of the data migration issues and the requirement. The new data model of course has to different from the existing one . If the data structure is changed then the data has to be migrated with lot of transformations. So you as a database architect you should be aware of this task and the risk involved in it.  &lt;br /&gt;(d) &lt;strong&gt;Authentication method :&lt;/strong&gt; - A database architect should be well aware of the authentication method you are going to use and the formalities involved in the process .&lt;br /&gt;(e) &lt;strong&gt;Security :- &lt;/strong&gt;This is another important point which may cause major change if you have not analyzed it properly.  You should be well aware of the encryption method if the application demands.  Also Database architect should be aware of what access method you want to use or whether you are want firewall exception kind. &lt;br /&gt;(f) &lt;strong&gt;SQL Injection &lt;/strong&gt;: Any application which developed on these days should be SQL Injection proof. As a database architect you should not wait for any SRS or SLA for these kind of standard. &lt;br /&gt;(g) &lt;strong&gt;Isolation level the application demands&lt;/strong&gt;: - Very important from the performance point of view. If you are aware of the isolation level requirement for the application, then you can use decide the isolation level accordingly. &lt;br /&gt;(h) &lt;strong&gt;Disaster recovery or Fault tolerance required&lt;/strong&gt; :-  This may not be mentioned in any SLA or SRS. But it is understood (or client may think so) that any application should address these requirement by default. &lt;br /&gt;(i) &lt;strong&gt;Capacity Planning &lt;/strong&gt;:-  You should be well aware of approximate size of your database. If you are committed to store the images in database for some reasons like security and management, you should do capacity plan accordingly. &lt;br /&gt;(j) &lt;strong&gt;Excessive Usage of features&lt;/strong&gt;: - I want to emphasis this point. If a product offers few advanced features, it does not mean that you must use that in your architecture for the sake of updated technology. You must be aware of the feature inside out and you should use only if it suits you. I have faced such excessive usage of features in couple of projects.&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;Summary :-&lt;/strong&gt;&lt;br /&gt;My list may not be the comprehensive one and please feel free to correct my list. My point here is, Database Architect or Architecture is crucial to any project. Basically, if you see, 95% of the applications in this world will be dealing with  data in some way or other.  So any erroneous decision in database architecture will kill the whole application.  To become a successful database architect in  you should be aware of the risk involved in this job.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1146926327588070502-7381340934137777599?l=madhuottapalam.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://madhuottapalam.blogspot.com/feeds/7381340934137777599/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=1146926327588070502&amp;postID=7381340934137777599' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1146926327588070502/posts/default/7381340934137777599'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1146926327588070502/posts/default/7381340934137777599'/><link rel='alternate' type='text/html' href='http://madhuottapalam.blogspot.com/2008/07/challenges-of-being-database-database.html' title='Challenges of being a Database Architect'/><author><name>Madhu K Nair</name><uri>http://www.blogger.com/profile/08936146465563191414</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='30' height='32' src='http://1.bp.blogspot.com/_4wBIz276vTw/TKtTNRq6sZI/AAAAAAAAASA/DVQPmnwt50c/S220/Madhu.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1146926327588070502.post-3149706494700679510</id><published>2008-07-09T06:44:00.000-07:00</published><updated>2008-07-09T06:53:25.253-07:00</updated><title type='text'>DDL Trigger to prevent creation of SQL Login with Blank Password</title><content type='html'>There was a query in MSDN forum regarding preventing creation of login with Blank password using T-SQL script. I was clueless  about this. Then Rich was referred to Laurentiu Cristofor's  blog.  There was no direct answer but it give me a wonderful solution which  I was not aware. I would like to thank both of them here. Please check the blog entry   &lt;a href="http://blogs.msdn.com/lcris/archive/2007/10/31/sql-server-undocumented-password-hashing-builtins-pwdcompare-and-pwdencrypt.aspx"&gt;Here&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;So I thought to tweak  pwdcompare() function  and make a DDL Trigger. Here we go…&lt;br /&gt;&lt;br /&gt;Create  TRIGGER Svr_DDLtrg_Audit_BLANK_PASSWORD &lt;br /&gt;ON All Server&lt;br /&gt;FOR &lt;br /&gt;Create_Login,Alter_Login&lt;br /&gt;AS&lt;br /&gt;SET NOCOUNT ON&lt;br /&gt; &lt;br /&gt; BEGIN&lt;br /&gt; DECLARE @Eventdata XML&lt;br /&gt; SET @Eventdata = EVENTDATA()&lt;br /&gt;   &lt;br /&gt; declare @loginname varchar(100)&lt;br /&gt; select  @loginname=@Eventdata.value('(/EVENT_INSTANCE/ObjectName)[1]', 'nvarchar(2000)')&lt;br /&gt; print @loginname&lt;br /&gt;&lt;br /&gt; if exists (select 1 from sys.sql_logins where pwdcompare('', password_hash) = 1 and name=@loginname)&lt;br /&gt; begin&lt;br /&gt;  Rollback&lt;br /&gt; end&lt;br /&gt; else Print 'good password'&lt;br /&gt; &lt;br /&gt;End &lt;br /&gt;&lt;br /&gt;&lt;strong&gt;Note :&lt;/strong&gt; I rollback the statement if the password is blank. IF you want to audit or log then you may modify the script accordingly&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1146926327588070502-3149706494700679510?l=madhuottapalam.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://madhuottapalam.blogspot.com/feeds/3149706494700679510/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=1146926327588070502&amp;postID=3149706494700679510' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1146926327588070502/posts/default/3149706494700679510'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1146926327588070502/posts/default/3149706494700679510'/><link rel='alternate' type='text/html' href='http://madhuottapalam.blogspot.com/2008/07/ddl-trigger-to-prevent-creation-of-sql.html' title='DDL Trigger to prevent creation of SQL Login with Blank Password'/><author><name>Madhu K Nair</name><uri>http://www.blogger.com/profile/08936146465563191414</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='30' height='32' src='http://1.bp.blogspot.com/_4wBIz276vTw/TKtTNRq6sZI/AAAAAAAAASA/DVQPmnwt50c/S220/Madhu.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1146926327588070502.post-9216426864011069360</id><published>2008-07-01T02:02:00.000-07:00</published><updated>2008-07-01T02:03:04.735-07:00</updated><title type='text'>Best Practices -  Datatype  Selection  while designing tables</title><content type='html'>• If your database is to support web-based application better to go for UNICODE (Unicode like nchar, nvarchar 2 bytes per char where as ASCII datatypes takes 1 bytes per char) datatypes because you may be going to support different types of clients.&lt;br /&gt;• If your application is multi-lingual go for UNICODE.&lt;br /&gt;• If you are planning to include CLRDatatype (SQL Server 2005) in the database  go for UNICODE Datatypes instead of ASCII Datatypes, because,  if CLRDatatype is going to consume the data then it must be in UNICODE.&lt;br /&gt;• For numeric column, find the range that column is going to have and then choose the datatype.  For eg. If you are sure that the column cannot have more than 255 like DepartmentID in a small organization may not go probably beyond 10 or 20. In such cases  it is recommended to choose TinyINT datatype.  Generally keeping all integer columns type INT without analyzing the range that going to support  is not at all recommended from storage perspective. &lt;br /&gt;• Description /Comments /Remarks sort of columns may or may not have data for all the rows. So it is better to go for Variable datatypes like Varchar ,Nvarchar.&lt;br /&gt;• If you know the column is not nullable and it may contain more or less the same size of the data then for sure go for Fixed datatype like CHAR or NCHAR. Having said that it is important to know that, if you select fixed datatypes and if the column is nullable then if you donot have any data (null) then also the column will consume the space. &lt;br /&gt;• If the size of the column is less than 10 char , use  fixed width datatypes like NCHAR or CHAR. &lt;br /&gt;• I have seen in many applications use   Decimal to store currency kind of data though the application need less precision which can be supported by money.  So, my point is, use Money datatype if you need only 4 precision.&lt;br /&gt;• Use UniqueIdentitifier column as PK and CI or so only when it is unavoidable because UniqueIdentitifier takes 16 Bytes of the space.&lt;br /&gt;Note : The point I want to make here is, if you do a proper analysis of the data and then select the datatype then you can control the row, page, table size and hence increase the performance.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1146926327588070502-9216426864011069360?l=madhuottapalam.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://madhuottapalam.blogspot.com/feeds/9216426864011069360/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=1146926327588070502&amp;postID=9216426864011069360' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1146926327588070502/posts/default/9216426864011069360'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1146926327588070502/posts/default/9216426864011069360'/><link rel='alternate' type='text/html' href='http://madhuottapalam.blogspot.com/2008/07/best-practices-datatype-selection-while.html' title='Best Practices -  Datatype  Selection  while designing tables'/><author><name>Madhu K Nair</name><uri>http://www.blogger.com/profile/08936146465563191414</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='30' height='32' src='http://1.bp.blogspot.com/_4wBIz276vTw/TKtTNRq6sZI/AAAAAAAAASA/DVQPmnwt50c/S220/Madhu.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1146926327588070502.post-6917990039144695255</id><published>2008-06-30T01:28:00.000-07:00</published><updated>2009-11-28T00:35:59.790-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='FAQ'/><title type='text'>FAQ : Explain a scenario which supports  vertical partitioning of a table in SQL Server.</title><content type='html'>The scenario may be different according to the SQL Server Version you have (SQL 7.0, SQL 2000, SQL 2005).  I will be covering SQL Server 2000 and 2005&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;SQL Server 2000.&lt;/strong&gt;&lt;br /&gt;In SQL Server (in 2000 and 2005) the IN_ROW_DATA or the row size of a table can have only max 8060 bytes. If you have a table which contains 4 columns of varchar (3000) then though you can create the table but if the data being inserted is more than 8060 bytes then the insert will fail. So what we generally do is, we vertically partition the table to two or more table as per the requirement and keep ONE to ONE relation between all the tables.  So this is a valid reason to partition your table vertically.  When you do vertical partitioning, try to keep most commonly used small size column in single table. &lt;br /&gt;&lt;br /&gt;&lt;strong&gt;SQL Server 2005&lt;/strong&gt;&lt;br /&gt;In SQL Server 2005, the above mentioned problem of SQL Server 2000  is not there because of the storage architecture change  called ROW_OVERFLOW_DATA. Ie. In SQL Server 2005 you can have a row which exceed 8060 bytes provided the columns are variable types(Varchar,nvarchar). What Database engine internally does is, it keep all the variable datatypes (varchar, nvarchar )columns data in ROW_OVERFLOW_DATA page. Precisely, the Row size limitation is only applicable to fixed size columns like CHAR, NCHAR. So SQL Server 2000 scenario of partitioning table because of the row size exceeds 8060 bytes is not valid in SQL Server 2005. &lt;br /&gt;But there is a valid reason to do vertical partition of the table in SQL Server 2005. If you are using ONLINE INDEX feature of SQL Server 2005 then you cannot use LOB data as a part of index at the leaf level.  And you want to use the LOB column in Index because of the performance benefit it provides.  In that case best method is to partition the table vertically in such a way that, keep the small ,mostly used columns in  single table (like product detailed description may not be asked frequently by the user) and the columns those are  referred in less frequency in another table.  Since you do not have LOB data in the table you can use ONLINE INDEX feature in the table.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1146926327588070502-6917990039144695255?l=madhuottapalam.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://madhuottapalam.blogspot.com/feeds/6917990039144695255/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=1146926327588070502&amp;postID=6917990039144695255' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1146926327588070502/posts/default/6917990039144695255'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1146926327588070502/posts/default/6917990039144695255'/><link rel='alternate' type='text/html' href='http://madhuottapalam.blogspot.com/2008/06/faq-explain-scenario-which-supports.html' title='FAQ : Explain a scenario which supports  vertical partitioning of a table in SQL Server.'/><author><name>Madhu K Nair</name><uri>http://www.blogger.com/profile/08936146465563191414</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='30' height='32' src='http://1.bp.blogspot.com/_4wBIz276vTw/TKtTNRq6sZI/AAAAAAAAASA/DVQPmnwt50c/S220/Madhu.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1146926327588070502.post-6318010157905153731</id><published>2008-06-19T04:14:00.000-07:00</published><updated>2009-11-28T00:36:15.636-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='FAQ'/><title type='text'>FAQ: How to find the authentication mode of a SQL Server Instance ?</title><content type='html'>&lt;strong&gt;Using System Stored procedure xp_loginconfig&lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;xp_loginconfig system strored procedure will give you the authentication information in SQL Server.  You can call the sp without parameter to get detailed information or with “Loging Mode” parameter to get only the  Authentication mode.&lt;br /&gt;EG. &lt;br /&gt;EXEC xp_loginconfig 'login mode'&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;Result&lt;/strong&gt;&lt;br /&gt;&lt;strong&gt;Name  Config_Value&lt;/strong&gt;&lt;br /&gt;login mode Mixed&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;Read Registry to get the authentication Information.&lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;Another method would be reading Registry.  Authentication information can be read from the following registry entry. &lt;br /&gt;HKEY_LOCAL_MACHINE\Software\Microsoft\Microsoft SQL Server\MSSQL.##\MSSQLServer\LoginMode&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;Note : Change ## the number according to your environment. &lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;Eg. &lt;br /&gt;&lt;br /&gt;EXECUTE MASTER..XP_REGREAD &lt;br /&gt;'HKEY_LOCAL_MACHINE', 'SOFTWARE\MICROSOFT\MICROSOFT SQL SERVER\MSSQL.4\MSSQLSERVER',&lt;br /&gt;'LOGINMODE'&lt;br /&gt;Result&lt;br /&gt;Value  Data&lt;br /&gt;LoginMode 1&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1146926327588070502-6318010157905153731?l=madhuottapalam.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://madhuottapalam.blogspot.com/feeds/6318010157905153731/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=1146926327588070502&amp;postID=6318010157905153731' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1146926327588070502/posts/default/6318010157905153731'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1146926327588070502/posts/default/6318010157905153731'/><link rel='alternate' type='text/html' href='http://madhuottapalam.blogspot.com/2008/06/faq-how-to-find-authentication-mode-of.html' title='FAQ: How to find the authentication mode of a SQL Server Instance ?'/><author><name>Madhu K Nair</name><uri>http://www.blogger.com/profile/08936146465563191414</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='30' height='32' src='http://1.bp.blogspot.com/_4wBIz276vTw/TKtTNRq6sZI/AAAAAAAAASA/DVQPmnwt50c/S220/Madhu.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1146926327588070502.post-6232617388620649936</id><published>2008-06-18T22:08:00.000-07:00</published><updated>2009-11-28T00:36:31.772-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='FAQ'/><title type='text'>FAQ : How to find the Index Creation /Rebuild Date in SQL Server</title><content type='html'>AFAIK, there is no system object gives you the information of Index creation Date  in SQL Server. If the Clustered index is on PK then the creation date can get from sysobjects or sys.objects. But that is not the case always. &lt;br /&gt;&lt;br /&gt;This query which uses STATS_DATE() function to get the STATISTICS updated date. This will not give you accurate result if you are updating STATISTICS  explicitly. The logic behind the query is, if you rebuild indexes the STATISTICS are also being updated at the same time. So if you are not explicitly updating STATISTICS  using UPDATE STATISTICS  tableName command , then this query will give you the correct information&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;--In SQL Server 2000&lt;br /&gt;Select Name as IndexName,  &lt;br /&gt;STATS_DATE ( id , indid ) as IndexCreatedDate&lt;br /&gt;From sysindexes where id=object_id('HumanResources.Employee')&lt;br /&gt;&lt;br /&gt;-- In SQL Server 2005&lt;br /&gt;Select Name as IndexName,  &lt;br /&gt;STATS_DATE ( object_id , index_id ) as IndexCreatedDate&lt;br /&gt;From sys.indexes where object_id=object_id('HumanResources.Employee')&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1146926327588070502-6232617388620649936?l=madhuottapalam.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://madhuottapalam.blogspot.com/feeds/6232617388620649936/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=1146926327588070502&amp;postID=6232617388620649936' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1146926327588070502/posts/default/6232617388620649936'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1146926327588070502/posts/default/6232617388620649936'/><link rel='alternate' type='text/html' href='http://madhuottapalam.blogspot.com/2008/06/faq-how-to-find-index-creation-rebuild.html' title='FAQ : How to find the Index Creation /Rebuild Date in SQL Server'/><author><name>Madhu K Nair</name><uri>http://www.blogger.com/profile/08936146465563191414</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='30' height='32' src='http://1.bp.blogspot.com/_4wBIz276vTw/TKtTNRq6sZI/AAAAAAAAASA/DVQPmnwt50c/S220/Madhu.jpg'/></author><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1146926327588070502.post-7506703406022414613</id><published>2008-06-01T22:13:00.000-07:00</published><updated>2008-07-01T22:14:09.511-07:00</updated><title type='text'>Cumulative update package 7 for SQL Server 2005 Service Pack 2</title><content type='html'>Check out Cumulative update package 7 for SQL Server 2005 Service Pack 2 here&lt;br /&gt;&lt;a href="http://support.microsoft.com/kb/949095/en-us"&gt;http://support.microsoft.com/kb/949095/en-us&lt;/a&gt;.&lt;br /&gt;&lt;br /&gt;Check the bug fix list  and if your application need that bug fix then only apply cummulative hotfix in Production env.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1146926327588070502-7506703406022414613?l=madhuottapalam.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://madhuottapalam.blogspot.com/feeds/7506703406022414613/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=1146926327588070502&amp;postID=7506703406022414613' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1146926327588070502/posts/default/7506703406022414613'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1146926327588070502/posts/default/7506703406022414613'/><link rel='alternate' type='text/html' href='http://madhuottapalam.blogspot.com/2008/06/cumulative-update-package-7-for-sql.html' title='Cumulative update package 7 for SQL Server 2005 Service Pack 2'/><author><name>Madhu K Nair</name><uri>http://www.blogger.com/profile/08936146465563191414</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='30' height='32' src='http://1.bp.blogspot.com/_4wBIz276vTw/TKtTNRq6sZI/AAAAAAAAASA/DVQPmnwt50c/S220/Madhu.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1146926327588070502.post-167938553697831234</id><published>2008-06-01T22:12:00.000-07:00</published><updated>2008-07-01T22:12:24.958-07:00</updated><title type='text'>How to assign XML output of select *  FROM Yourtable FOR XML AUTO query to a variable</title><content type='html'>declare @DataXML xml&lt;br /&gt;set @DataXML =(SELECT *  FROM YourTable FOR XML AUTO, ELEMENTS)&lt;br /&gt;select @DataXML&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1146926327588070502-167938553697831234?l=madhuottapalam.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://madhuottapalam.blogspot.com/feeds/167938553697831234/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=1146926327588070502&amp;postID=167938553697831234' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1146926327588070502/posts/default/167938553697831234'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1146926327588070502/posts/default/167938553697831234'/><link rel='alternate' type='text/html' href='http://madhuottapalam.blogspot.com/2008/06/how-to-assign-xml-output-of-select-from.html' title='How to assign XML output of select *  FROM Yourtable FOR XML AUTO query to a variable'/><author><name>Madhu K Nair</name><uri>http://www.blogger.com/profile/08936146465563191414</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='30' height='32' src='http://1.bp.blogspot.com/_4wBIz276vTw/TKtTNRq6sZI/AAAAAAAAASA/DVQPmnwt50c/S220/Madhu.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1146926327588070502.post-2062632578110074522</id><published>2008-06-01T22:11:00.000-07:00</published><updated>2009-11-28T00:36:50.024-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='FAQ'/><title type='text'>FAQ : What is the difference between Lazywriter and Checkpoint in SQL Server</title><content type='html'>&lt;strong&gt;Lazywriter&lt;/strong&gt;&lt;br /&gt;The lazywriter thread sleeps for a specific interval of time. When it is restarted, it examines the size of the free buffer list. If the free buffer list is below a certain point, dependent on the size of the cache, the lazywriter thread scans the buffer cache to reclaim unused pages. It then writes dirty pages that have a reference count of 0. On the Windows 2000, Windows Server 2003, and Windows XP operating systems, most of the work populating the free buffer list and writing dirty pages is performed by the individual threads. The lazywriter thread typically has little to do.&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;Checkpoint&lt;/strong&gt;&lt;br /&gt;The checkpoint process also scans the buffer cache periodically and writes any dirty data pages to disk. The difference is that the checkpoint process does not put the buffer page back on the free list. The purpose of the checkpoint process is to minimize the number of dirty pages in memory to reduce the length of a recovery if the server fails. Its purpose is not to populate the free buffer list. Checkpoints typically find few dirty pages to write to disk, because most dirty pages are written to disk by the worker threads or the lazywriter thread in the period between two checkpoints&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;Refer&lt;/strong&gt;&lt;br /&gt;&lt;a href="http://msdn.microsoft.com/en-us/library/aa175260(SQL.80).aspx"&gt;http://msdn.microsoft.com/en-us/library/aa175260(SQL.80).aspx&lt;/a&gt;&lt;br /&gt;&lt;strong&gt;BOL&lt;/strong&gt;&lt;br /&gt;&lt;a href="ms-help://MS.SQLCC.v9/MS.SQLSVR.v9.en/udb9/html/4b0f27cd-f2ac-4761-8135-adc584bd8200.htm"&gt;ms-help://MS.SQLCC.v9/MS.SQLSVR.v9.en/udb9/html/4b0f27cd-f2ac-4761-8135-adc584bd8200.htm&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1146926327588070502-2062632578110074522?l=madhuottapalam.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://madhuottapalam.blogspot.com/feeds/2062632578110074522/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=1146926327588070502&amp;postID=2062632578110074522' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1146926327588070502/posts/default/2062632578110074522'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1146926327588070502/posts/default/2062632578110074522'/><link rel='alternate' type='text/html' href='http://madhuottapalam.blogspot.com/2008/06/faq-what-is-difference-between.html' title='FAQ : What is the difference between Lazywriter and Checkpoint in SQL Server'/><author><name>Madhu K Nair</name><uri>http://www.blogger.com/profile/08936146465563191414</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='30' height='32' src='http://1.bp.blogspot.com/_4wBIz276vTw/TKtTNRq6sZI/AAAAAAAAASA/DVQPmnwt50c/S220/Madhu.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1146926327588070502.post-8730858192122031057</id><published>2008-06-01T22:10:00.000-07:00</published><updated>2008-07-01T22:11:12.522-07:00</updated><title type='text'>FAQ: How to see what is inside hidden SQL Server 2005 Resource Database (mssqlsystemresource) ?</title><content type='html'>We all know the master database in SQL Server 2000 was split into two databases in SQL Server 2005. One kept as Master only and the other database is Resource database which is hidden. You can’t see that in Management studio or in any tool.  You can see the physical files in Data ( default )folder.  The idea behind this separation of objects is to allow very fast and safe upgrades. &lt;br /&gt;&lt;br /&gt;If you want to see what is inside this database follow these steps&lt;br /&gt;&lt;br /&gt;(a) Stop SQL Server&lt;br /&gt;(b) Copy /paste  mssqlsystemresource mdf and ldf files to a new location &lt;br /&gt;(c) Create a new database by Attaching the files from the new location &lt;br /&gt;&lt;br /&gt;Now you have the hidden database right in front….&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1146926327588070502-8730858192122031057?l=madhuottapalam.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://madhuottapalam.blogspot.com/feeds/8730858192122031057/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=1146926327588070502&amp;postID=8730858192122031057' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1146926327588070502/posts/default/8730858192122031057'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1146926327588070502/posts/default/8730858192122031057'/><link rel='alternate' type='text/html' href='http://madhuottapalam.blogspot.com/2008/06/faq-how-to-see-what-is-inside-hidden.html' title='FAQ: How to see what is inside hidden SQL Server 2005 Resource Database (mssqlsystemresource) ?'/><author><name>Madhu K Nair</name><uri>http://www.blogger.com/profile/08936146465563191414</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='30' height='32' src='http://1.bp.blogspot.com/_4wBIz276vTw/TKtTNRq6sZI/AAAAAAAAASA/DVQPmnwt50c/S220/Madhu.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1146926327588070502.post-5186482783274080343</id><published>2008-06-01T22:09:00.000-07:00</published><updated>2008-07-01T22:09:50.523-07:00</updated><title type='text'>Upgrading SQL Server from lower version to higher version</title><content type='html'>&lt;strong&gt;Upgrade methodology&lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;(a)    First step,  before going for any up gradation, you  should take full backup of the existing databases including system databases. If anything goes wrong you should have a full backup to fall upon&lt;br /&gt;(b)    Run Upgrade advisor :  You must run this tool before going for up-gradation.  This tool will analyze the existing database in lower version and suggest the potential problems , which may be because of the feature is removed or deprecated in the newer version.  Once the upgrade advisor projected any critical problem , you may address the problem before going for up-gradation.    &lt;br /&gt;(c)    Once you  found that there is no major issues reported by Upgrade Advisor, you can plan your up-gradation. You must document each and every step you follow. Also ensure that you have a rollback plan incase anything goes wrong. You must have a proper testing script as well.&lt;br /&gt;(d)    You have two choices in upgrade.  &lt;br /&gt;&lt;strong&gt;In Place upgrade  &lt;/strong&gt;: When you upgrade an earlier SQL Server release in-place through the install upgrade process, all existing application connections remain the same because the server and server instance do not change. This approach requires a more thorough fallback plan and testing. By performing an in-place upgrade, logins and users remain in-sync, database connections remain the same for applications, and SQL Agent jobs and other functionality is concurrently upgraded during the installation. Note that several features, such as log shipping, replication, and cluster environments, have special upgrade considerations. &lt;br /&gt;&lt;br /&gt;&lt;strong&gt;Side By Side &lt;/strong&gt;:  This method is more or less manual process hence you have full control over the process. You can test  the upgrade (migration) process by running parallel system , test it and once proven bring it online. But the disadvantage here is, you have to have  additional resource (Hardware/licenses ) .    Side by side will be always better since you have the existing instance intact. But at time it may not be feasible because of hardware constraint  or Instance Name (like the application demands Default Instance. I would say this method is more clean and controllable.&lt;br /&gt;&lt;br /&gt;(e) Once you have upgraded test the system with the application with full load before going online.  &lt;br /&gt;&lt;br /&gt;&lt;strong&gt;Migrating Database in Side by Side Upgrade.&lt;/strong&gt;&lt;br /&gt;(a) If  you have chosen side by side method, after installation of new version of sql server you must migrate the user database from older version sql server instance. There are three options available here.&lt;br /&gt;(a) Backup /Restore : Best and easy method. Benefit is source database can still be online , no downtime&lt;br /&gt;(b) Detach / Attach : You have down time at the source but easy method.&lt;br /&gt;(c) Copy Database Wizard : This tool internally does detach/attach only. &lt;br /&gt;&lt;br /&gt;&lt;strong&gt;Migration of SQL Logins&lt;/strong&gt;&lt;br /&gt;This is one of the major disadvantage of  Side by Side up-gradation.  You must transfer the SQL Logins explicitly. You must transfer the login with the password. Microsoft has provided the script for that. &lt;a href="http://support.microsoft.com/kb/246133"&gt;How to Transfer SQL Logins&lt;/a&gt; &lt;br /&gt; &lt;br /&gt;&lt;br /&gt;&lt;strong&gt;Migration of SQL Scheduled Jobs&lt;/strong&gt;&lt;br /&gt;Simple , just need to create the script from source and run that script in  target server. &lt;br /&gt;&lt;br /&gt;&lt;strong&gt;Migration of SSIS Packages&lt;/strong&gt;&lt;br /&gt;You can use save as option of SSIS package . You can open the package and save the package as file system and then migrate.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1146926327588070502-5186482783274080343?l=madhuottapalam.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://madhuottapalam.blogspot.com/feeds/5186482783274080343/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=1146926327588070502&amp;postID=5186482783274080343' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1146926327588070502/posts/default/5186482783274080343'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1146926327588070502/posts/default/5186482783274080343'/><link rel='alternate' type='text/html' href='http://madhuottapalam.blogspot.com/2008/06/upgrading-sql-server-from-lower-version.html' title='Upgrading SQL Server from lower version to higher version'/><author><name>Madhu K Nair</name><uri>http://www.blogger.com/profile/08936146465563191414</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='30' height='32' src='http://1.bp.blogspot.com/_4wBIz276vTw/TKtTNRq6sZI/AAAAAAAAASA/DVQPmnwt50c/S220/Madhu.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1146926327588070502.post-7886333970180410319</id><published>2008-05-28T22:14:00.000-07:00</published><updated>2008-07-01T22:15:16.214-07:00</updated><title type='text'>FAQ : What all are the recommended events for DTA / ITW workload</title><content type='html'>If you have provided same workload without different events and columns DTA may give you different report. For eg. if you have not included Duration column, DTA will tune the workload in the order they appear in the workload. IF the workload contains duration column , DTA will tune the events in the descending order of the Duration. So to get better result from DTA included recommended events and columns.&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;Events Recommended&lt;/strong&gt;&lt;br /&gt;RPC:Completed&lt;br /&gt;RPC:Starting&lt;br /&gt;SP:StmtCompleted&lt;br /&gt;SP:StmtStarting&lt;br /&gt;SQL:BatchCompleted&lt;br /&gt;SQL:BatchStarting&lt;br /&gt;SQL:StmtCompleted&lt;br /&gt;SQL:StmtStarting&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1146926327588070502-7886333970180410319?l=madhuottapalam.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://madhuottapalam.blogspot.com/feeds/7886333970180410319/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=1146926327588070502&amp;postID=7886333970180410319' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1146926327588070502/posts/default/7886333970180410319'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1146926327588070502/posts/default/7886333970180410319'/><link rel='alternate' type='text/html' href='http://madhuottapalam.blogspot.com/2008/05/faq-what-all-are-recommended-events-for.html' title='FAQ : What all are the recommended events for DTA / ITW workload'/><author><name>Madhu K Nair</name><uri>http://www.blogger.com/profile/08936146465563191414</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='30' height='32' src='http://1.bp.blogspot.com/_4wBIz276vTw/TKtTNRq6sZI/AAAAAAAAASA/DVQPmnwt50c/S220/Madhu.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1146926327588070502.post-6622553623456742216</id><published>2008-05-27T22:56:00.000-07:00</published><updated>2008-07-01T22:56:52.020-07:00</updated><title type='text'>FAQ : How to search for an object in all the databases</title><content type='html'>&lt;strong&gt;SQL Server 2005&lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;CREATE TABLE #TEMP (TABLENAME SYSNAME, OBJECTNAME SYSNAME,TYPE CHAR(10))&lt;br /&gt;&lt;br /&gt;INSERT INTO #TEMP&lt;br /&gt;&lt;br /&gt;EXEC SP_MSFOREACHDB "SELECT '?' DATABASENAME, NAME,TYPE FROM ?.SYS.ALL_OBJECTS  WHERE NAME='YourSearchingObjectName'"&lt;br /&gt;&lt;br /&gt;SELECT * FROM #TEMP&lt;br /&gt;&lt;br /&gt;DROP TABLE #TEMP&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;SQL Server 2000&lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;CREATE TABLE #TEMP (TABLENAME SYSNAME, OBJECTNAME SYSNAME,TYPE CHAR(10))&lt;br /&gt;&lt;br /&gt;INSERT INTO #TEMP&lt;br /&gt;&lt;br /&gt;EXEC SP_MSFOREACHDB "SELECT '?' DATABASENAME, NAME,XTYPE FROM ?..SYSOBJECTS  WHERE NAME='YourSearchingObjectName'"&lt;br /&gt;&lt;br /&gt;SELECT * FROM #TEMP&lt;br /&gt;&lt;br /&gt;DROP TABLE #TEMP&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;Note : Replace "YourSearchingObjectName" with the object name which you are searching in the select query&lt;/strong&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1146926327588070502-6622553623456742216?l=madhuottapalam.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://madhuottapalam.blogspot.com/feeds/6622553623456742216/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=1146926327588070502&amp;postID=6622553623456742216' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1146926327588070502/posts/default/6622553623456742216'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1146926327588070502/posts/default/6622553623456742216'/><link rel='alternate' type='text/html' href='http://madhuottapalam.blogspot.com/2008/05/faq-how-to-search-for-object-in-all.html' title='FAQ : How to search for an object in all the databases'/><author><name>Madhu K Nair</name><uri>http://www.blogger.com/profile/08936146465563191414</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='30' height='32' src='http://1.bp.blogspot.com/_4wBIz276vTw/TKtTNRq6sZI/AAAAAAAAASA/DVQPmnwt50c/S220/Madhu.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1146926327588070502.post-3426230546406630547</id><published>2008-05-06T23:10:00.000-07:00</published><updated>2008-07-06T23:13:55.739-07:00</updated><title type='text'>How to Audit or Bypass TRIGGER Execution Using CONTEXT_INFO()</title><content type='html'>When a TRIGGER executes, it may be useful to have the TRIGGER code know which Stored Procedure caused the action that is executing the TRIGGER code. It may be that there is a need to log the entry point, or perhaps, there is conditional logic in the TRIGGER that depends upon the entry point. In this paper, two different scenarios are addressed. First, How to Track Which Stored Procedure Fired the Trigger, and Second, How to Limit a TRIGGER to Fire ONLY from Certain Stored Prodedures. This approach has been tested with SQL Server 2005 and 2008. SQL Server 2000 requires a minor modification that is presented at the end of the paper.&lt;br /&gt;&lt;br /&gt;Check my paper in MSDN Wiki page&lt;br /&gt;&lt;a href="http://code.msdn.microsoft.com/SQLExamples/Wiki/View.aspx?title=AuditOrBypassTriggerExecution"&gt;http://code.msdn.microsoft.com/SQLExamples/Wiki/View.aspx?title=AuditOrBypassTriggerExecution&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1146926327588070502-3426230546406630547?l=madhuottapalam.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://madhuottapalam.blogspot.com/feeds/3426230546406630547/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=1146926327588070502&amp;postID=3426230546406630547' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1146926327588070502/posts/default/3426230546406630547'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1146926327588070502/posts/default/3426230546406630547'/><link rel='alternate' type='text/html' href='http://madhuottapalam.blogspot.com/2008/05/how-to-audit-or-bypass-trigger.html' title='How to Audit or Bypass TRIGGER Execution Using CONTEXT_INFO()'/><author><name>Madhu K Nair</name><uri>http://www.blogger.com/profile/08936146465563191414</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='30' height='32' src='http://1.bp.blogspot.com/_4wBIz276vTw/TKtTNRq6sZI/AAAAAAAAASA/DVQPmnwt50c/S220/Madhu.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1146926327588070502.post-2070297931407608845</id><published>2008-05-01T23:00:00.000-07:00</published><updated>2008-07-01T23:02:09.231-07:00</updated><title type='text'>FAQ - How to use Stored Procedure in Select Query</title><content type='html'>Very common question in T-SQL Forums&lt;br /&gt;&lt;br /&gt;The requirement is, need to use Stored procedure output (Exec SP) in Select query or in a Join. There is a method which may not be a recommended one. You can create a LoopBack Linked server to your own server and use OPENQUERY TO extract the data by EXECUTE Stored procedure.&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;LoopBack Linked Server &lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;Linked servers can be defined to point back (loop back) to the server on which they are defined. Loopback servers are most useful when testing an application that uses distributed queries on a single server network.&lt;br /&gt;&lt;br /&gt;Eg. &lt;br /&gt;&lt;br /&gt;SELECT *FROM   OPENROWSET &lt;br /&gt;('SQLOLEDB','Server=(local);TRUSTED_CONNECTION=YES;','set fmtonly off exec master.dbo.sp_who') &lt;br /&gt;&lt;br /&gt;OR&lt;br /&gt;&lt;br /&gt;sp_addlinkedserver @server = N'MyLink',&lt;br /&gt;    @srvproduct = N' ',&lt;br /&gt;    @provider = N'SQLNCLI', &lt;br /&gt;    @datasrc = N'MyServer', &lt;br /&gt;    @catalog = N'AdventureWorks'&lt;br /&gt;&lt;br /&gt;Note : &lt;br /&gt;&lt;strong&gt;@server = N'MyLink' :&lt;/strong&gt; It can not be your Server name. It is just a name and can be anything otherthan your actual servername. IF you give your server name in this parameter you will get an error as follows&lt;br /&gt;Msg 15028, Level 16, State 1, Procedure sp_MSaddserver_internal, Line 89&lt;br /&gt;The server 'LHI-115' already exists.&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;@datasrc = N'MyServer' :&lt;/strong&gt; This parameter value has to be your server name or IP.&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;@catalog =N'AdventureWorks' :&lt;/strong&gt; This is the database in which the Stored procedure exists.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;OPENQUERY to Extract data from Loopback linkeserver&lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;Select *from openquery([YourLoopbackServerName],'exec AdventureWorks.dbo.sptest')&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1146926327588070502-2070297931407608845?l=madhuottapalam.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://madhuottapalam.blogspot.com/feeds/2070297931407608845/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=1146926327588070502&amp;postID=2070297931407608845' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1146926327588070502/posts/default/2070297931407608845'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1146926327588070502/posts/default/2070297931407608845'/><link rel='alternate' type='text/html' href='http://madhuottapalam.blogspot.com/2008/05/faq-how-to-use-stored-procedure-in.html' title='FAQ - How to use Stored Procedure in Select Query'/><author><name>Madhu K Nair</name><uri>http://www.blogger.com/profile/08936146465563191414</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='30' height='32' src='http://1.bp.blogspot.com/_4wBIz276vTw/TKtTNRq6sZI/AAAAAAAAASA/DVQPmnwt50c/S220/Madhu.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1146926327588070502.post-8953417314193418148</id><published>2008-05-01T22:59:00.000-07:00</published><updated>2008-07-01T23:00:04.091-07:00</updated><title type='text'>FAQ :  How can we know the progress of a maintenance command using DMVs</title><content type='html'>Its very common that, when we run DBCC maintenance command we would like to know how long will it take or how much percentage the process is completed. Here we go…&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Select R.Session_id,R.Command,R.Percent_complete &lt;br /&gt;From&lt;br /&gt;sys.dm_exec_requests R &lt;br /&gt;Inner Join&lt;br /&gt;Sys.dm_exec_sessions S &lt;br /&gt;on S.Session_id=R.Session_ID and S.IS_User_Process=1&lt;br /&gt;&lt;br /&gt;This process is supported for DBCC CheckDB, DBCC CheckTable, DBCC CheckFilegroup,&lt;br /&gt;DBCC IndexDefrag, DBCC Shrinkfile&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1146926327588070502-8953417314193418148?l=madhuottapalam.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://madhuottapalam.blogspot.com/feeds/8953417314193418148/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=1146926327588070502&amp;postID=8953417314193418148' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1146926327588070502/posts/default/8953417314193418148'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1146926327588070502/posts/default/8953417314193418148'/><link rel='alternate' type='text/html' href='http://madhuottapalam.blogspot.com/2008/05/faq-how-can-we-know-progress-of.html' title='FAQ :  How can we know the progress of a maintenance command using DMVs'/><author><name>Madhu K Nair</name><uri>http://www.blogger.com/profile/08936146465563191414</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='30' height='32' src='http://1.bp.blogspot.com/_4wBIz276vTw/TKtTNRq6sZI/AAAAAAAAASA/DVQPmnwt50c/S220/Madhu.jpg'/></author><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1146926327588070502.post-6689094642486681655</id><published>2008-05-01T22:17:00.001-07:00</published><updated>2008-07-01T22:18:00.897-07:00</updated><title type='text'>FAQ : How to truncate and shrink Transaction Log file in SQL Server</title><content type='html'>First of all truncation of transaction log is not a recommended practice. But it is unavoidable if you have not kept proper backup policy and recovery model for your database. Its always better to know the cause and prevention for the transaction log size issue. Refer the following KB for more info&lt;br /&gt;&lt;br /&gt;Managing the Size of the Transaction Log File&lt;br /&gt;a&lt;a href="http://msdn.microsoft.com/en-us/library/ms365418(SQL.100).aspx"&gt;http://msdn.microsoft.com/en-us/library/ms365418(SQL.100).aspx&lt;/a&gt;&lt;br /&gt;Transaction Log Physical Architecture&lt;br /&gt;&lt;a href="http://msdn.microsoft.com/en-us/library/ms179355(SQL.100).aspx"&gt;http://msdn.microsoft.com/en-us/library/ms179355(SQL.100).aspx&lt;/a&gt;&lt;br /&gt;Factors That Can Delay Log Truncation&lt;br /&gt;&lt;a href="http://msdn.microsoft.com/en-us/library/ms345414(SQL.100).aspx"&gt;http://msdn.microsoft.com/en-us/library/ms345414(SQL.100).aspx&lt;/a&gt;&lt;br /&gt; &lt;br /&gt;&lt;br /&gt;Now coming to the point. If you have no space left with the drive where the Log file is kept and the size of the Transaction Log file is not manageable then its better to shrink the log. &lt;br /&gt;&lt;br /&gt;Broadly , you have two steps here. &lt;br /&gt;(a) Mark the inactive part of Trasaction log to release. &lt;br /&gt;(b) Release the marked release portion of Transaction log to OS.&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;SQL Server 2005&lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;-- Step 1 – Mark the inactive part of the log for release&lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;Use YourDatabaseName&lt;br /&gt;Go&lt;br /&gt;Backup Log YourDatabaseName With Truncate_Only&lt;br /&gt;GO&lt;br /&gt;&lt;strong&gt;&lt;br /&gt;-- Step 2 - Release the marked space to OS&lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;Declare @LogFileLogicalName sysname&lt;br /&gt;select @LogFileLogicalName=Name from sys.database_files where Type=1&lt;br /&gt;print @LogFileLogicalName&lt;br /&gt;&lt;br /&gt;DBCC Shrinkfile(@LogFileLogicalName,100)&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;Note :&lt;/strong&gt; If you have single log file the above mentioned script will work. IF you have multiple log file the change the script accordingly&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;SQl Server 2000&lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;-- Step 1 – Mark the inactive part of the log for release&lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;Use YourDatabaseName&lt;br /&gt;Go&lt;br /&gt;Backup Log YourDatabaseName With Truncate_Only&lt;br /&gt;GO&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;-- Step 2 - Release the marked space to OS&lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;Declare @LogFileLogicalName sysname&lt;br /&gt;select @LogFileLogicalName=Name from sysfiles where filename like '%.ldf'&lt;br /&gt;print @LogFileLogicalName&lt;br /&gt;&lt;br /&gt;DBCC Shrinkfile(@LogFileLogicalName,100)&lt;br /&gt;&lt;br /&gt; &lt;br /&gt;&lt;strong&gt;Note : &lt;/strong&gt;If you have single log file and the extension of the log file is .LDF the above mentioned script will work. IF you have multiple log file the change the script accordingly&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;SQL Server 2008&lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;In SQL Server this process have been changed. In 20008, just change the recovery model to simple and then use DBCC SHrinkfile command.&lt;br /&gt; &lt;br /&gt;select name,recovery_model_desc from sys.databases&lt;br /&gt;GO &lt;br /&gt;Alter database YourDatabaseName Recovery simple&lt;br /&gt;GO&lt;br /&gt;Declare @LogFileLogicalName sysname&lt;br /&gt;select @LogFileLogicalName=Name from sys.database_files where Type=1&lt;br /&gt;print @LogFileLogicalName&lt;br /&gt;&lt;br /&gt;DBCC Shrinkfile(@LogFileLogicalName,100)&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1146926327588070502-6689094642486681655?l=madhuottapalam.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://madhuottapalam.blogspot.com/feeds/6689094642486681655/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=1146926327588070502&amp;postID=6689094642486681655' title='5 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1146926327588070502/posts/default/6689094642486681655'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1146926327588070502/posts/default/6689094642486681655'/><link rel='alternate' type='text/html' href='http://madhuottapalam.blogspot.com/2008/05/faq-how-to-truncate-and-shrink.html' title='FAQ : How to truncate and shrink Transaction Log file in SQL Server'/><author><name>Madhu K Nair</name><uri>http://www.blogger.com/profile/08936146465563191414</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='30' height='32' src='http://1.bp.blogspot.com/_4wBIz276vTw/TKtTNRq6sZI/AAAAAAAAASA/DVQPmnwt50c/S220/Madhu.jpg'/></author><thr:total>5</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1146926327588070502.post-7220448493184262961</id><published>2008-05-01T22:17:00.000-07:00</published><updated>2008-07-01T22:17:28.586-07:00</updated><title type='text'>FAQ : How triggers in SQL Server 2005 impact Tempdb</title><content type='html'>In SQL Server 2005 the triggers are implemented using Version store feature. In earlier versions (SQL Server 2000/ SQL 7), the trigger's Inserted and Deleted tables data were captured by reading Transaction log. But in SQL Server 2005, the Inserted and Deleted data is stored in Tempdb as row version. So, if you have more trigger in SQL Server 2005, it may impact Tempdb performance.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1146926327588070502-7220448493184262961?l=madhuottapalam.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://madhuottapalam.blogspot.com/feeds/7220448493184262961/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=1146926327588070502&amp;postID=7220448493184262961' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1146926327588070502/posts/default/7220448493184262961'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1146926327588070502/posts/default/7220448493184262961'/><link rel='alternate' type='text/html' href='http://madhuottapalam.blogspot.com/2008/05/faq-how-triggers-in-sql-server-2005.html' title='FAQ : How triggers in SQL Server 2005 impact Tempdb'/><author><name>Madhu K Nair</name><uri>http://www.blogger.com/profile/08936146465563191414</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='30' height='32' src='http://1.bp.blogspot.com/_4wBIz276vTw/TKtTNRq6sZI/AAAAAAAAASA/DVQPmnwt50c/S220/Madhu.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1146926327588070502.post-4572661340867080400</id><published>2008-05-01T22:16:00.000-07:00</published><updated>2008-07-01T22:16:28.346-07:00</updated><title type='text'>FAQ : How to run DBCC DBREINDEX against all the user table in SQL Server</title><content type='html'>Simple, use undocumented stored procedure sp_msforeachtable. Since its undocumented there is no gurantee that it will be available in all the future versions. But in SQL Server 2000 and 2005 it works. &lt;br /&gt;&lt;br /&gt;Use YourdatabaseName&lt;br /&gt;EXEC sp_msforeachtable 'DBCC DBREINDEX( ''?'')'&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1146926327588070502-4572661340867080400?l=madhuottapalam.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://madhuottapalam.blogspot.com/feeds/4572661340867080400/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=1146926327588070502&amp;postID=4572661340867080400' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1146926327588070502/posts/default/4572661340867080400'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1146926327588070502/posts/default/4572661340867080400'/><link rel='alternate' type='text/html' href='http://madhuottapalam.blogspot.com/2008/05/faq-how-to-run-dbcc-dbreindex-against.html' title='FAQ : How to run DBCC DBREINDEX against all the user table in SQL Server'/><author><name>Madhu K Nair</name><uri>http://www.blogger.com/profile/08936146465563191414</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='30' height='32' src='http://1.bp.blogspot.com/_4wBIz276vTw/TKtTNRq6sZI/AAAAAAAAASA/DVQPmnwt50c/S220/Madhu.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1146926327588070502.post-5950807895123266315</id><published>2008-05-01T22:14:00.000-07:00</published><updated>2008-07-01T22:14:38.726-07:00</updated><title type='text'>FAQ : SQL Server DBA as a career option</title><content type='html'>This is a very common question in SQL Forums hence i thought to blog my view.&lt;br /&gt;&lt;br /&gt;If you are a college passed out or a newbie in IT field, then I would suggest you to  go for &lt;strong&gt;SQL Server MCTS (70-431)&lt;/strong&gt; and &lt;strong&gt;MCITP DBA (70-443 and  70-444)&lt;/strong&gt; certifications. Do not clear the certification for the sake of it. Learn the techniques and best practices mentioned in the syllabus. You must also go through the Virtual Courses available in Microsoft site. One great thing about Microsoft is , there are fantastic resource available in internet which comes free of cost. You just need to have MSN Live ID and login with that ID and refer the resource. Also must not forget download all the SQL OnDemand webcasts available in Microsoft site. Mind you, Webcast comes right from very experience folks who have been working for decades in this technology and also from the product teams who developed that products. Basically, reading , listening to experience people (webcast) and learn new technology will certainly give you a good launch in SQL Server. Always try to start with  new product versions available (like at this point of time we have 2005 and 2008 CTP) in the market to be a leader rather than a follower.  &lt;br /&gt;&lt;br /&gt;For those who are already into IT field and wants to switch to DBA career can also more or less follow the same steps I have mentioned earlier.  Key point in DBA for that matter any field, is Documentation. Try to document day to day activities and be process oriented. DBA is very risky at the same time secure job. Contradictory statements right?. Risky because you are working on production and data is nothing less than god for a DBA or you can say Data is your job. If anything goes wrong, it will may cost your job also.  Secure, because the technology in Database generally not changes drastically. Consider one is working in VB 6 and one fine day he has been told to work in .Net 2.0. He will surely have tough time. But for a DBA to jump from SQL Server 2000 to 2005 or 2008 may be a smooth drive compared to other technologies. &lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;SQL Server 2008 Virtual Lab&lt;/strong&gt;&lt;br /&gt;http://technet.microsoft.com/en-us/cc164207.aspx&lt;br /&gt;&lt;strong&gt;SQL Server 2005 Virtual Lab&lt;/strong&gt;&lt;br /&gt;http://technet.microsoft.com/en-us/bb499681.aspx&lt;br /&gt;&lt;strong&gt;SQL Server 2000 Virtual Lab&lt;/strong&gt;&lt;br /&gt;http://technet.microsoft.com/en-us/bb499685.aspx&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;Microsoft ondemand Webcasts&lt;/strong&gt;&lt;br /&gt;http://www.microsoft.com/events/webcasts/ondemand.mspx&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;Information about all the certification available SQL Server 2005&lt;/strong&gt;&lt;br /&gt;http://madhuottapalam.blogspot.com/2007_10_01_archive.html&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1146926327588070502-5950807895123266315?l=madhuottapalam.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://madhuottapalam.blogspot.com/feeds/5950807895123266315/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=1146926327588070502&amp;postID=5950807895123266315' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1146926327588070502/posts/default/5950807895123266315'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1146926327588070502/posts/default/5950807895123266315'/><link rel='alternate' type='text/html' href='http://madhuottapalam.blogspot.com/2008/05/faq-sql-server-dba-as-career-option.html' title='FAQ : SQL Server DBA as a career option'/><author><name>Madhu K Nair</name><uri>http://www.blogger.com/profile/08936146465563191414</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='30' height='32' src='http://1.bp.blogspot.com/_4wBIz276vTw/TKtTNRq6sZI/AAAAAAAAASA/DVQPmnwt50c/S220/Madhu.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1146926327588070502.post-1340130621196416381</id><published>2008-05-01T22:12:00.000-07:00</published><updated>2008-07-01T22:13:16.993-07:00</updated><title type='text'>How to find the time taken (total elapsed time) by the query?</title><content type='html'>Though SQL Server provides SET STATISTICS TIME option to find the total elapsed time taken by a query or a sp, I generally do not use this because, for large number of statement reading the output of Statistics time will be difficult.  It is better to keep your own script to get the elapsed time. Here is the script&lt;br /&gt;&lt;br /&gt;DECLARE &lt;br /&gt; @total_elapsed_time VARCHAR(100), &lt;br /&gt; @start_time Datetime,&lt;br /&gt; @complete_time Datetime&lt;br /&gt;&lt;br /&gt;SELECT @start_time = GETDATE()&lt;br /&gt;Print   @start_time&lt;br /&gt;-- here Paste the query which you want to execute &lt;br /&gt;select *From sysobjects ,sys.tables – Replace this query with your query /sp&lt;br /&gt; &lt;br /&gt;Set  @complete_time=getdate()&lt;br /&gt;          &lt;br /&gt;SELECT &lt;br /&gt;@total_elapsed_time = 'Total Elapsed Time (minutes:seconds) ' +&lt;br /&gt;CONVERT(CHAR(3),&lt;br /&gt;DATEDIFF(SS,@start_time,@complete_time)/60) +&lt;br /&gt;':' +&lt;br /&gt;CONVERT(CHAR(3),&lt;br /&gt;DATEDIFF(SS,@start_time,@complete_time)%60)&lt;br /&gt;print @total_elapsed_time&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;Note :&lt;/strong&gt; If you want to know   how long compilation and optimization took then use SET STATISTICS TIME&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1146926327588070502-1340130621196416381?l=madhuottapalam.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://madhuottapalam.blogspot.com/feeds/1340130621196416381/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=1146926327588070502&amp;postID=1340130621196416381' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1146926327588070502/posts/default/1340130621196416381'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1146926327588070502/posts/default/1340130621196416381'/><link rel='alternate' type='text/html' href='http://madhuottapalam.blogspot.com/2008/05/how-to-find-time-taken-total-elapsed.html' title='How to find the time taken (total elapsed time) by the query?'/><author><name>Madhu K Nair</name><uri>http://www.blogger.com/profile/08936146465563191414</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='30' height='32' src='http://1.bp.blogspot.com/_4wBIz276vTw/TKtTNRq6sZI/AAAAAAAAASA/DVQPmnwt50c/S220/Madhu.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1146926327588070502.post-7065975109110735203</id><published>2008-04-20T02:54:00.000-07:00</published><updated>2008-10-20T03:01:16.914-07:00</updated><title type='text'>FAQ: How to rename SA Account in SQL Server 2005</title><content type='html'>I never never knew that renaming SA is possible in SQL Server 2005. Recently i found a forum post and tried here we go...&lt;br /&gt;&lt;br /&gt;ALTER LOGIN sa DISABLE;&lt;br /&gt;ALTER LOGIN sa WITH NAME = [NewNameforSA];&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1146926327588070502-7065975109110735203?l=madhuottapalam.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://madhuottapalam.blogspot.com/feeds/7065975109110735203/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=1146926327588070502&amp;postID=7065975109110735203' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1146926327588070502/posts/default/7065975109110735203'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1146926327588070502/posts/default/7065975109110735203'/><link rel='alternate' type='text/html' href='http://madhuottapalam.blogspot.com/2008/04/faq-how-to-rename-sa-account-in-sql.html' title='FAQ: How to rename SA Account in SQL Server 2005'/><author><name>Madhu K Nair</name><uri>http://www.blogger.com/profile/08936146465563191414</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='30' height='32' src='http://1.bp.blogspot.com/_4wBIz276vTw/TKtTNRq6sZI/AAAAAAAAASA/DVQPmnwt50c/S220/Madhu.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1146926327588070502.post-173834352088049007</id><published>2008-04-15T23:02:00.000-07:00</published><updated>2008-07-01T23:03:48.123-07:00</updated><title type='text'>How to export the output of a stored procedure or query to a text file using SQLCMD command in SQL Server 2005 and later versions</title><content type='html'>How to pump the output of a stored procedure or query to a text file using SQLCMD command in SQL Server 2005 and later versions&lt;br /&gt;&lt;br /&gt; (&lt;strong&gt;a) Running SQLCMD command in Command prompt and create a file from the output&lt;/strong&gt;&lt;br /&gt;&lt;blockquote&gt;C:\&gt; sqlcmd -Sservername -dmaster -Usa -Psa -q"se&lt;br /&gt;lect *from sys.objects" -oC:\testoutput.txt&lt;/blockquote&gt;&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;(b) Push the output of a query to a file using XP_CMDShell and SQLCMD command&lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;Now what happens If we want to do this from Query Analyser. Simple , run the same command using XP_CMDShell.&lt;br /&gt;&lt;br /&gt;(a) Open a Query Analyser in Management Studio&lt;br /&gt;(b) Run the following query &lt;br /&gt;Exec XP_CMDShell 'sqlcmd -Sservername -dmaster -Usa -Psa -q"select *from sys.objects" -oC:\testoutput.txt'&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;(c) Third and simple method &lt;/strong&gt;&lt;br /&gt;We all know the two methods mentioned above. But there is another method which is very simple and flexible. SQL Server Management Studio Query Editor has support for SQLCMD scripts authoring and execution. We can switch ON or Off this feature. &lt;br /&gt;&lt;br /&gt;(a) Open Management Studio&lt;br /&gt;(b) Tools Menu --&gt;&gt; Select Options  Query Execution  General  check the check box at the bottom of the page on the right side of the dialog “By default, open new queries in SQLCMD mode.”&lt;br /&gt;(c) Press OK and save the settings&lt;br /&gt;(d) Now , open a query analyzer and type the following&lt;br /&gt;:out c:\queryresults.txt&lt;br /&gt;:error c:\queryerror.txt&lt;br /&gt;GO&lt;br /&gt;Select *from sys.objects&lt;br /&gt;go&lt;br /&gt;Select *from sys.objectsaaa&lt;br /&gt;&lt;br /&gt;&lt;br /&gt; &lt;br /&gt; Note : In the above mentioned command the output of the first query will be pushed to C:\queryresults.txt and the error due to the second select statement will be pushed to c:\queryerror.txt&lt;br /&gt;&lt;br /&gt;Disclaimer : &lt;br /&gt;&lt;br /&gt;All the SQLCMD commands are not supported from Query Analyser.  Following are the SQLCMD commands not supported in Query Analyser&lt;br /&gt;&lt;br /&gt;(a):serverlist Lists local and SQL Servers on the network.&lt;br /&gt;&lt;br /&gt;(b) :reset Discards the statement cache.&lt;br /&gt;&lt;br /&gt;(c) :perftrace Redirects timing output to a file, stderr, or stdout. This is not supported because Query Editor doesn't have this concept.&lt;br /&gt;&lt;br /&gt;(d) :listvar Lists the set SQLCMD scripting variables.&lt;br /&gt;&lt;br /&gt;(e) :ed Edits the current or last executed statement cache.&lt;br /&gt;&lt;br /&gt;(f) :help Shows the list of supported commands.&lt;br /&gt;&lt;br /&gt;if you use any command in Query Analyser, Query Editor issues a non-fatal warning into the Messages tab during execution and continues on.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;Summary :&lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;All the three methods are equally useful. Many folks may not have observed  the third method that is why i thought to blog this..&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1146926327588070502-173834352088049007?l=madhuottapalam.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://madhuottapalam.blogspot.com/feeds/173834352088049007/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=1146926327588070502&amp;postID=173834352088049007' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1146926327588070502/posts/default/173834352088049007'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1146926327588070502/posts/default/173834352088049007'/><link rel='alternate' type='text/html' href='http://madhuottapalam.blogspot.com/2008/04/how-to-export-output-of-stored.html' title='How to export the output of a stored procedure or query to a text file using SQLCMD command in SQL Server 2005 and later versions'/><author><name>Madhu K Nair</name><uri>http://www.blogger.com/profile/08936146465563191414</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='30' height='32' src='http://1.bp.blogspot.com/_4wBIz276vTw/TKtTNRq6sZI/AAAAAAAAASA/DVQPmnwt50c/S220/Madhu.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1146926327588070502.post-2172200854776473492</id><published>2008-04-01T23:00:00.000-07:00</published><updated>2008-07-01T23:00:39.864-07:00</updated><title type='text'>FAQ : How to clear SQL Server cache / memory</title><content type='html'>&lt;strong&gt;Warning : Not to be used in production env.&lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;In Development or tsesting env its very common that during performance tuning we do clear cache to get correct picture. It may also required that only a particular db related cache should be clear. here wo go...&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;(a) Clear entire procedure and databuffer cache&lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;Checkpoint  -- Write dirty pages to disk&lt;br /&gt;DBCC FreeProcCache  -- Clear entire proc cache&lt;br /&gt;DBCC DropCleanBuffers -- Clear entire data cache&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;(b) Clear only a particular db procedure cache using undocumented DBCC command&lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;Declare @DBID int&lt;br /&gt;Select @DBID =db_id(‘YourDBname’)&lt;br /&gt;DBCC  FLUSHPROCINDB(@DBID) – Undocumented dbcc command to clear only a db proc cache&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1146926327588070502-2172200854776473492?l=madhuottapalam.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://madhuottapalam.blogspot.com/feeds/2172200854776473492/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=1146926327588070502&amp;postID=2172200854776473492' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1146926327588070502/posts/default/2172200854776473492'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1146926327588070502/posts/default/2172200854776473492'/><link rel='alternate' type='text/html' href='http://madhuottapalam.blogspot.com/2008/04/faq-how-to-clear-sql-server-cache.html' title='FAQ : How to clear SQL Server cache / memory'/><author><name>Madhu K Nair</name><uri>http://www.blogger.com/profile/08936146465563191414</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='30' height='32' src='http://1.bp.blogspot.com/_4wBIz276vTw/TKtTNRq6sZI/AAAAAAAAASA/DVQPmnwt50c/S220/Madhu.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1146926327588070502.post-1207266171498510113</id><published>2008-04-01T22:58:00.000-07:00</published><updated>2008-07-01T22:59:09.513-07:00</updated><title type='text'>FAQ : How to move a physical file (MDF or LDF) from one location to another in SQL Server 2005</title><content type='html'>In SQL Server 2000, if you want to move a physical file of a database from one location to another , you have to detach and attach the database. In SQL Server 2005, this process has been made very simple, you need to take the database offline, alter the file path with the new one using Alter Database command  and  copy the database file to new location manually and finally take the database online. Simple&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;--Step 1 : Create Database&lt;/strong&gt;&lt;br /&gt;Create Database TestMoveFile and check the database file location&lt;br /&gt;GO&lt;br /&gt;Select *From Sys.master_files where database_id=db_id('TestmoveFile')&lt;br /&gt;GO&lt;br /&gt;&lt;strong&gt;--Step 2 : Alter Database and Set the db to offline&lt;/strong&gt;&lt;br /&gt;Alter Database TestMoveFile Set Offline&lt;br /&gt;GO&lt;br /&gt;&lt;strong&gt;-- Step 3 : Move the physical file to new location &lt;/strong&gt;&lt;br /&gt;--Move the file to new location using dos command or Windows GUI&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;--Step 4 : Alter the database file path using Alter Database command&lt;/strong&gt;&lt;br /&gt;Alter Database TestMoveFile Modify File(Name='TestMoveFile',FileName='c:\TestmoveFile.mdf')&lt;br /&gt;Go&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;-- Step 5 : Set the database Online and check the file path&lt;/strong&gt;&lt;br /&gt;Alter database TestMoveFile Set Online&lt;br /&gt;GO&lt;br /&gt;Select *From Sys.master_files where database_id=db_id('TestmoveFile')&lt;br /&gt;&lt;br /&gt;Go&lt;br /&gt;Drop database TestMoveFile&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1146926327588070502-1207266171498510113?l=madhuottapalam.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://madhuottapalam.blogspot.com/feeds/1207266171498510113/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=1146926327588070502&amp;postID=1207266171498510113' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1146926327588070502/posts/default/1207266171498510113'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1146926327588070502/posts/default/1207266171498510113'/><link rel='alternate' type='text/html' href='http://madhuottapalam.blogspot.com/2008/04/faq-how-to-move-physical-file-mdf-or.html' title='FAQ : How to move a physical file (MDF or LDF) from one location to another in SQL Server 2005'/><author><name>Madhu K Nair</name><uri>http://www.blogger.com/profile/08936146465563191414</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='30' height='32' src='http://1.bp.blogspot.com/_4wBIz276vTw/TKtTNRq6sZI/AAAAAAAAASA/DVQPmnwt50c/S220/Madhu.jpg'/></author><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1146926327588070502.post-7208616267960908463</id><published>2008-04-01T22:57:00.001-07:00</published><updated>2008-07-01T22:58:23.095-07:00</updated><title type='text'>FAQ : What is the difference between DELETE TABLE and TRUNCATE TABLE commands</title><content type='html'>&lt;strong&gt;TRUNCATE&lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;• Less Transaction Log entry because 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 log and hence TRUNCATE is fast&lt;br /&gt;• TRUNCATE apply Fewer table locks&lt;br /&gt;• TRUNCATE is DDL Statement&lt;br /&gt;• TRUNCATE Release the tables spaces to System&lt;br /&gt;• TRUNCATE Can not have WHERE Conditions&lt;br /&gt;• TRUNCATE does not fire trigger&lt;br /&gt;• TRUNCATE reset the identity to 0 (if table have any)&lt;br /&gt;• TRUNCATE Can not be used against the tables involved in TRUNCATE transactional replication or merge replication.&lt;br /&gt;• TRUNCATE Can not be used against the table used in Indexed view &lt;br /&gt;• TRUNCATE can not be used against the table that Are referenced by a FOREIGN KEY constraint.&lt;br /&gt;• TRUNCATE commands are not tracked by DDL trigger&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;Note : &lt;/strong&gt;TRUNCATE  can be rollbacked. I have seen many place where its is mentioned that it can not&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;DELETE&lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;• DELETE FROM TABLE command logs each records in transaction log , hence DELETE is slow.&lt;br /&gt;• DELETE apply more locks to the table&lt;br /&gt;• DELETE is a DML command&lt;br /&gt;• DELETE remove the records but will not release the space to the system&lt;br /&gt;• DELETE can have WHERE conditions &lt;br /&gt;• DELETE Fires TRIGGER &lt;br /&gt;• DELETE do not RESET IDENTITY&lt;br /&gt;• DELETE Can be used against table used transactional replication or merge replication&lt;br /&gt;• DELETE Can be used in tables reference by a  Foregin Key and tables involved in Indexed view&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1146926327588070502-7208616267960908463?l=madhuottapalam.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://madhuottapalam.blogspot.com/feeds/7208616267960908463/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=1146926327588070502&amp;postID=7208616267960908463' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1146926327588070502/posts/default/7208616267960908463'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1146926327588070502/posts/default/7208616267960908463'/><link rel='alternate' type='text/html' href='http://madhuottapalam.blogspot.com/2008/04/faq-what-is-difference-between-delete.html' title='FAQ : What is the difference between DELETE TABLE and TRUNCATE TABLE commands'/><author><name>Madhu K Nair</name><uri>http://www.blogger.com/profile/08936146465563191414</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='30' height='32' src='http://1.bp.blogspot.com/_4wBIz276vTw/TKtTNRq6sZI/AAAAAAAAASA/DVQPmnwt50c/S220/Madhu.jpg'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1146926327588070502.post-5732659949780798772</id><published>2008-04-01T22:57:00.000-07:00</published><updated>2009-02-12T01:11:29.781-08:00</updated><title type='text'>FAQ : Index Scan Vs Seek in SQL Server</title><content type='html'>There are five logical/physical operators in SQL Server related to Index scan ,Index Seek and  Table scan. &lt;br /&gt;&lt;br /&gt;(a) Table Scan&lt;br /&gt;(b) Clustered Index Scan&lt;br /&gt;(c) Clustered Index Seek&lt;br /&gt;(d) Index Scan (Non- Clustered index Seek)&lt;br /&gt;(e) Index Seek (Non- Clustered index Seek)&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;Table Scan&lt;/strong&gt; &lt;br /&gt; Table Scan retrieves all rows from the table (if you have no WHERE Conditions). Basically, before returning the rows, it traverse through all data pages related to the table. If you have where condition, though it travel through all the pages only those rows are returned which satisfy the conditions. When you do not have Clustered index on the table it does a table scan. In other words, both Clustered Index Scan (clustered index is nothing but the data itself) and Table Scan are same because in both method system traverse through all the data pages. Generally, you should avoid table scan.&lt;br /&gt;&lt;strong&gt;&lt;br /&gt;Clustered Index Scan&lt;/strong&gt;&lt;br /&gt;Clustered Index Scan is nothing but horizontally traversing though the clustered index data pages. Clustered Index Scan return all the rows from the clustered index (Clustered index is nothing but Data).  If you have where condition , only the satisfying rows are returned, but system traverse through all the data pages of the clustered index. Both Table scan and Clustered Index Scan are generally considered to be bad. But at times like if the table is small contains only few rows table or clustered index scan may be good also&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;Clustered Index Seek&lt;/strong&gt;&lt;br /&gt;Clustered Index Seek traverse vertically right down to the Data page where the requested data is stored. Basically any seek is vertically traversing though the B-Tree structure (as we all know the index is stored in B-tree structure in sql server). System does a Seek when it find a useful index and generally its done for highly selective query.&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;Index Scan or Non-Clustered Index Scan&lt;/strong&gt;&lt;br /&gt;As already said, Scan is horizontal traversing of B-Tree data  pages.  But in this case it horizontally traverse though the Non-Clustered index available. Its not same as Clustered index scan or Table Scan. In SQL Server , while reading execution plan you can find only Index Scan not Non-Clustered Index Scan. But you must read Index Scan as Non-Clustered Index Scan.&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;Index Seek or Non-Clustered Index Seek&lt;/strong&gt;&lt;br /&gt;As already mentioned Seek is Vertical traversing of B-Tree to the data page. But in Index seek it vertical traversing of Non-Clustered Index. Generally, its considered as the best option for high selective query.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1146926327588070502-5732659949780798772?l=madhuottapalam.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://madhuottapalam.blogspot.com/feeds/5732659949780798772/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=1146926327588070502&amp;postID=5732659949780798772' title='3 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1146926327588070502/posts/default/5732659949780798772'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1146926327588070502/posts/default/5732659949780798772'/><link rel='alternate' type='text/html' href='http://madhuottapalam.blogspot.com/2008/04/faq-index-scan-vs-seek-in-sql-server.html' title='FAQ : Index Scan Vs Seek in SQL Server'/><author><name>Madhu K Nair</name><uri>http://www.blogger.com/profile/08936146465563191414</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='30' height='32' src='http://1.bp.blogspot.com/_4wBIz276vTw/TKtTNRq6sZI/AAAAAAAAASA/DVQPmnwt50c/S220/Madhu.jpg'/></author><thr:total>3</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1146926327588070502.post-2345999066667586497</id><published>2008-04-01T07:24:00.000-07:00</published><updated>2008-11-01T07:27:38.642-07:00</updated><title type='text'>FAQ : How to reset SA Password when there is no Buildin\Administrator role in SQL Server 2005</title><content type='html'>Check &lt;a href="http://blogs.msdn.com/raulga/archive/2007/07/12/disaster-recovery-what-to-do-when-the-sa-account-password-is-lost-in-sql-server-2005.aspx"&gt;Raul Garcia's blog Entry&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1146926327588070502-2345999066667586497?l=madhuottapalam.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://madhuottapalam.blogspot.com/feeds/2345999066667586497/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=1146926327588070502&amp;postID=2345999066667586497' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1146926327588070502/posts/default/2345999066667586497'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1146926327588070502/posts/default/2345999066667586497'/><link rel='alternate' type='text/html' href='http://madhuottapalam.blogspot.com/2008/11/faq-forgot-sa-password-and-removed.html' title='FAQ : How to reset SA Password when there is no Buildin\Administrator role in SQL Server 2005'/><author><name>Madhu K Nair</name><uri>http://www.blogger.com/profile/08936146465563191414</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='30' height='32' src='http://1.bp.blogspot.com/_4wBIz276vTw/TKtTNRq6sZI/AAAAAAAAASA/DVQPmnwt50c/S220/Madhu.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1146926327588070502.post-6215872888918767527</id><published>2008-02-26T06:24:00.000-08:00</published><updated>2008-10-26T06:29:08.406-07:00</updated><title type='text'>FAQ : Query to get all the Dynamic Management Views/Functions</title><content type='html'>Select * From Sys.All_Objects&lt;br /&gt;Where Type IN ('V','TF','IF')&lt;br /&gt;and Name Like '%dm_%' And&lt;br /&gt;Schema_ID=4&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1146926327588070502-6215872888918767527?l=madhuottapalam.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://madhuottapalam.blogspot.com/feeds/6215872888918767527/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=1146926327588070502&amp;postID=6215872888918767527' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1146926327588070502/posts/default/6215872888918767527'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1146926327588070502/posts/default/6215872888918767527'/><link rel='alternate' type='text/html' href='http://madhuottapalam.blogspot.com/2008/02/faq-query-to-get-all-dynamic-management.html' title='FAQ : Query to get all the Dynamic Management Views/Functions'/><author><name>Madhu K Nair</name><uri>http://www.blogger.com/profile/08936146465563191414</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='30' height='32' src='http://1.bp.blogspot.com/_4wBIz276vTw/TKtTNRq6sZI/AAAAAAAAASA/DVQPmnwt50c/S220/Madhu.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1146926327588070502.post-6084714415263496124</id><published>2008-02-07T23:04:00.000-08:00</published><updated>2008-07-01T23:04:46.056-07:00</updated><title type='text'>Webcasts in Feb 2008</title><content type='html'>Check out the webcasts schedule in the month of Feb.&lt;br /&gt;http://www.microsoft.com/india/webcasts/&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1146926327588070502-6084714415263496124?l=madhuottapalam.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://madhuottapalam.blogspot.com/feeds/6084714415263496124/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=1146926327588070502&amp;postID=6084714415263496124' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1146926327588070502/posts/default/6084714415263496124'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1146926327588070502/posts/default/6084714415263496124'/><link rel='alternate' type='text/html' href='http://madhuottapalam.blogspot.com/2008/02/webcasts-in-feb-2008.html' title='Webcasts in Feb 2008'/><author><name>Madhu K Nair</name><uri>http://www.blogger.com/profile/08936146465563191414</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='30' height='32' src='http://1.bp.blogspot.com/_4wBIz276vTw/TKtTNRq6sZI/AAAAAAAAASA/DVQPmnwt50c/S220/Madhu.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1146926327588070502.post-4503938654462922467</id><published>2008-02-02T23:05:00.000-08:00</published><updated>2008-07-01T23:08:18.292-07:00</updated><title type='text'>DOs and Don’t when  Running Profiler</title><content type='html'>We run profiler often for many reasons. We generally, do this on Test/UAT environment. Running profiler on production is not recommended but not completely avoidable always. You may need to run profiler/trace even on production server. But to get better result with less overload, we may need to follow some guideline. I think following are the general guideline which we can follow when we run profiler on any environment.&lt;br /&gt;&lt;br /&gt;(a) Do not save the trace result into a table on the same database &lt;br /&gt;(b) Run the trace with proper filter. Monitor only the required events otherwise the trace may overload the system.&lt;br /&gt;(c) Run the trace from any other machines other than which you are monitoring. You can connect from Test server or any other workstation which acts as a monitor to the actual server. &lt;br /&gt;(d) If you are running the trace for workload then run the Trace for the whole business day when activities are high to get exact picture.&lt;br /&gt;(e) Create a template with the events you need and save it to re-use.&lt;br /&gt;(f) You may save the result to a table so that you can run sql query against it.&lt;br /&gt;&lt;br /&gt;Note : It is always recommended to run T-SQL Storedprocedure that define the trace rather than running Profiler GUI.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1146926327588070502-4503938654462922467?l=madhuottapalam.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://madhuottapalam.blogspot.com/feeds/4503938654462922467/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=1146926327588070502&amp;postID=4503938654462922467' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1146926327588070502/posts/default/4503938654462922467'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1146926327588070502/posts/default/4503938654462922467'/><link rel='alternate' type='text/html' href='http://madhuottapalam.blogspot.com/2008/07/dos-and-dont-when-running-profiler.html' title='DOs and Don’t when  Running Profiler'/><author><name>Madhu K Nair</name><uri>http://www.blogger.com/profile/08936146465563191414</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='30' height='32' src='http://1.bp.blogspot.com/_4wBIz276vTw/TKtTNRq6sZI/AAAAAAAAASA/DVQPmnwt50c/S220/Madhu.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1146926327588070502.post-8799676613032451203</id><published>2008-01-01T23:09:00.000-08:00</published><updated>2008-07-03T00:17:31.806-07:00</updated><title type='text'>A dream come true... you can call me MVP</title><content type='html'>I have no words... I have been honoured by Microsoft and I am a MVP now... From a Soldier to a MVP, probably first MVP from Indian Defence Services , its been a great new year for me&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1146926327588070502-8799676613032451203?l=madhuottapalam.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://madhuottapalam.blogspot.com/feeds/8799676613032451203/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=1146926327588070502&amp;postID=8799676613032451203' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1146926327588070502/posts/default/8799676613032451203'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1146926327588070502/posts/default/8799676613032451203'/><link rel='alternate' type='text/html' href='http://madhuottapalam.blogspot.com/2008/07/dream-come-true-you-can-call-me-mvp.html' title='A dream come true... you can call me MVP'/><author><name>Madhu K Nair</name><uri>http://www.blogger.com/profile/08936146465563191414</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='30' height='32' src='http://1.bp.blogspot.com/_4wBIz276vTw/TKtTNRq6sZI/AAAAAAAAASA/DVQPmnwt50c/S220/Madhu.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1146926327588070502.post-4166469850779392878</id><published>2007-12-09T23:14:00.000-08:00</published><updated>2008-07-01T23:14:29.119-07:00</updated><title type='text'>SQL Server 2008 Virtual Lab</title><content type='html'>&lt;a href="http://msevents.microsoft.com/CUI/WebCastEventDetails.aspx?EventID=1032357626&amp;amp;EventCategory=3&amp;amp;culture=en-US&amp;amp;CountryCode=US"&gt;TechNet Virtual Lab: Administering Servers by Using Declarative Management Framework (DMF) Policies&lt;/a&gt;&lt;br /&gt;&lt;a href="http://msevents.microsoft.com/CUI/WebCastEventDetails.aspx?EventID=1032358592&amp;amp;EventCategory=3&amp;amp;culture=en-US&amp;amp;CountryCode=US"&gt;TechNet Virtual Lab: Authoring Reports Using SQL Server 2008 Reporting Services&lt;/a&gt;&lt;br /&gt;&lt;a href="http://msevents.microsoft.com/CUI/WebCastEventDetails.aspx?EventID=1032357624&amp;amp;EventCategory=3&amp;amp;culture=en-US&amp;amp;CountryCode=US"&gt;TechNet Virtual Lab: Implementing Change Data Capture (CDC) in SQL Server 2008&lt;/a&gt;&lt;br /&gt;&lt;a href="http://msevents.microsoft.com/CUI/WebCastEventDetails.aspx?EventID=1032358846&amp;amp;EventCategory=3&amp;amp;culture=en-US&amp;amp;CountryCode=US"&gt;TechNet Virtual Lab: Learn How to Build Occasionally Connected Applications with SQL Server 2008&lt;/a&gt;&lt;br /&gt;&lt;a href="http://msevents.microsoft.com/CUI/WebCastEventDetails.aspx?EventID=1032357623&amp;amp;EventCategory=3&amp;amp;culture=en-US&amp;amp;CountryCode=US"&gt;TechNet Virtual Lab: What's new in SQL Server 2008 for Database Administrators&lt;/a&gt;&lt;br /&gt;&lt;a href="http://msevents.microsoft.com/CUI/WebCastEventDetails.aspx?EventID=1032357625&amp;amp;EventCategory=3&amp;amp;culture=en-US&amp;amp;CountryCode=US"&gt;TechNet Virtual Lab: Working with the new DATE data type in SQL Server 2008&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1146926327588070502-4166469850779392878?l=madhuottapalam.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://madhuottapalam.blogspot.com/feeds/4166469850779392878/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=1146926327588070502&amp;postID=4166469850779392878' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1146926327588070502/posts/default/4166469850779392878'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1146926327588070502/posts/default/4166469850779392878'/><link rel='alternate' type='text/html' href='http://madhuottapalam.blogspot.com/2007/12/sql-server-2008-virtual-lab.html' title='SQL Server 2008 Virtual Lab'/><author><name>Madhu K Nair</name><uri>http://www.blogger.com/profile/08936146465563191414</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='30' height='32' src='http://1.bp.blogspot.com/_4wBIz276vTw/TKtTNRq6sZI/AAAAAAAAASA/DVQPmnwt50c/S220/Madhu.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1146926327588070502.post-1002629363308461402</id><published>2007-10-20T23:18:00.000-07:00</published><updated>2008-07-01T23:19:18.804-07:00</updated><title type='text'>How to Install SQL Server Client Tools from Command Line</title><content type='html'>Command line installation of Client Tools&lt;br /&gt;driveletter:\Servers\Setup&gt;start /Wait setup.exe ADDLOCAL=Client_Components,Connectivity,SQL_Tools90,SQL_BooksOnline&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1146926327588070502-1002629363308461402?l=madhuottapalam.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://madhuottapalam.blogspot.com/feeds/1002629363308461402/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=1146926327588070502&amp;postID=1002629363308461402' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1146926327588070502/posts/default/1002629363308461402'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1146926327588070502/posts/default/1002629363308461402'/><link rel='alternate' type='text/html' href='http://madhuottapalam.blogspot.com/2007/10/how-to-install-sql-server-client-tools.html' title='How to Install SQL Server Client Tools from Command Line'/><author><name>Madhu K Nair</name><uri>http://www.blogger.com/profile/08936146465563191414</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='30' height='32' src='http://1.bp.blogspot.com/_4wBIz276vTw/TKtTNRq6sZI/AAAAAAAAASA/DVQPmnwt50c/S220/Madhu.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1146926327588070502.post-4952717337094707075</id><published>2007-10-20T23:17:00.000-07:00</published><updated>2008-07-01T23:18:01.589-07:00</updated><title type='text'>FAQ: SQL Server Connectivity Troubleshooting</title><content type='html'>Connectivity issues are very common in SQL Server 2005 since there are few settings to be done at server level and OS level to enable the server for remote connection. There are many documents available from Microsoft Protocol team gives step by step troubleshooting process. I always refer those Bolgs whenever I see such issues in forums. Then I thought to have a consolidated list where all the links are available&lt;br /&gt;&lt;br /&gt;(a) Check whether the server is configured to accept remote connections. Use SAC to enable server for remote connection&lt;br /&gt;.&lt;br /&gt;(b) Ensure that the SQL Browser service is started (SQL Browser equivalent in 2000 is SQL Server Resolution Protocol (SSRP) )&lt;br /&gt;&lt;br /&gt;(c) Determine whether clients are specifying the correct port (for using fixed ports with named instances) in the server alias or connection string.&lt;br /&gt;&lt;br /&gt;(d) Check whether the client’s network protocols are enabled and configured to correctly handshake with those of the server.&lt;br /&gt;&lt;br /&gt;(e) Be sure you have permission to connect on the server’s endpoints.&lt;br /&gt;&lt;br /&gt;(f) When using encryption, be sure the server and client certificates match (that is, check their Common Name (CN) and any other relevant attributes) and are installed and configured correctly on both sides.&lt;br /&gt;&lt;br /&gt;(g) Make certain that your firewalls are configured to permit the required network traffic.&lt;br /&gt;&lt;br /&gt;(h) Check to see whether your users have permission to log in to the server and access the specified database.&lt;br /&gt;&lt;br /&gt;(i) Make sure the provider, driver, DSN, server alias, or other connection mechanism is still valid and hasn’t been altered or removed from the system.&lt;br /&gt;&lt;br /&gt;Refer following KBs and Blogs for more info :-&lt;br /&gt;&lt;a title="http://support.microsoft.com/kb/914277" href="http://support.microsoft.com/kb/914277"&gt;http://support.microsoft.com/kb/914277&lt;/a&gt;&lt;br /&gt;&lt;a title="http://blogs.msdn.com/sql_protocols/archive/2006/09/30/SQL-Server-2005-Remote-Connectivity-Issue-TroubleShooting.aspx" href="http://blogs.msdn.com/sql_protocols/archive/2006/09/30/SQL-Server-2005-Remote-Connectivity-Issue-TroubleShooting.aspx"&gt;http://blogs.msdn.com/sql_protocols/archive/2006/09/30/SQL-Server-2005-Remote-Connectivity-Issue-TroubleShooting.aspx&lt;/a&gt;&lt;br /&gt;&lt;a title="http://blogs.msdn.com/sql_protocols/archive/2005/10/22/483684.aspx" href="http://blogs.msdn.com/sql_protocols/archive/2005/10/22/483684.aspx"&gt;http://blogs.msdn.com/sql_protocols/archive/2005/10/22/483684.aspx&lt;/a&gt;&lt;br /&gt;&lt;a title="http://blogs.msdn.com/sql_protocols/archive/2005/10/29/486861.aspx" href="http://blogs.msdn.com/sql_protocols/archive/2005/10/29/486861.aspx"&gt;http://blogs.msdn.com/sql_protocols/archive/2005/10/29/486861.aspx&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1146926327588070502-4952717337094707075?l=madhuottapalam.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://madhuottapalam.blogspot.com/feeds/4952717337094707075/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=1146926327588070502&amp;postID=4952717337094707075' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1146926327588070502/posts/default/4952717337094707075'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1146926327588070502/posts/default/4952717337094707075'/><link rel='alternate' type='text/html' href='http://madhuottapalam.blogspot.com/2007/10/faq-sql-server-connectivity.html' title='FAQ: SQL Server Connectivity Troubleshooting'/><author><name>Madhu K Nair</name><uri>http://www.blogger.com/profile/08936146465563191414</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='30' height='32' src='http://1.bp.blogspot.com/_4wBIz276vTw/TKtTNRq6sZI/AAAAAAAAASA/DVQPmnwt50c/S220/Madhu.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1146926327588070502.post-1896344552007250215</id><published>2007-10-20T22:43:00.000-07:00</published><updated>2008-07-02T22:44:07.083-07:00</updated><title type='text'>How to Detect Deadlocks from SQL Profiler</title><content type='html'>&lt;span style="font-family:courier new;"&gt;Deadloack detection is a  very common requirement in Development (even in Production) environment.  There are couple of method to detect Dead Locks.  In SQL Server 2000, trace flag 1204 can be set to capture the processes involved in the deadlock. The output is text based but provides valuable information about the types of locks and the statements that were executing at the time of the deadlock. In addition to this approach, SQL Server 2005 offers the ability to capture detailed deadlock information via the SQL Server Profiler.  The process of Dead Lock detection in SQL Server 2005 is as follows&lt;br /&gt;&lt;br /&gt;(a)  Create a new trace, Select a Blank template; this leaves the selection of all the events, data columns, and filters to you.&lt;br /&gt;&lt;br /&gt;(b)  Add the Locks:Deadlock graph event to the trace from the Locks category. An additional tab appears on the Trace Properties window, named Event Extraction Settings.&lt;br /&gt;&lt;br /&gt;(c)           Click the Save Deadlock XML Events Separately check box. This causes the deadlock information to be written to a separate file. You could also export the results after the trace has been run by using the File, Export option.&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1146926327588070502-1896344552007250215?l=madhuottapalam.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://madhuottapalam.blogspot.com/feeds/1896344552007250215/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=1146926327588070502&amp;postID=1896344552007250215' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1146926327588070502/posts/default/1896344552007250215'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1146926327588070502/posts/default/1896344552007250215'/><link rel='alternate' type='text/html' href='http://madhuottapalam.blogspot.com/2007/10/how-to-detect-deadlocks-from-sql.html' title='How to Detect Deadlocks from SQL Profiler'/><author><name>Madhu K Nair</name><uri>http://www.blogger.com/profile/08936146465563191414</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='30' height='32' src='http://1.bp.blogspot.com/_4wBIz276vTw/TKtTNRq6sZI/AAAAAAAAASA/DVQPmnwt50c/S220/Madhu.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1146926327588070502.post-2172328484611578546</id><published>2007-10-19T22:51:00.000-07:00</published><updated>2008-07-02T22:51:44.446-07:00</updated><title type='text'>SQL Server 2005 Pricing and Licensing</title><content type='html'>Licensing is one area where I always struggle to give my suggestion because it’s a legal issue and  the suggestion should politically correct. Check this document right from Microsoft...&lt;br /&gt;&lt;br /&gt;&lt;a href="http://download.microsoft.com/download/e/c/a/ecafe5d1-b514-48ab-93eb-61377df9c5c2/SQLServer2005Licensingv1.1.doc"&gt;http://download.microsoft.com/download/e/c/a/ecafe5d1-b514-48ab-93eb-61377df9c5c2/SQLServer2005Licensingv1.1.doc&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;a href="http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=3007704&amp;SiteID=1"&gt;Also Check this thread&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;Developer and Express edition Licensing Model always need little clarificaiton&lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;Developer Edition Licensing&lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;The Developer Edition of SQL Server 2005 is available for a fixed price of $49.95(subjected to change). The Developer Edition is licensed per developer and must be used for designing, developing, and testing purposes only. &lt;br /&gt;&lt;br /&gt;&lt;strong&gt;Express Edition Licensing&lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;The Express Edition of SQL Server 2005 is available via free download Microsoft site. Developers can redistribute it with their applications at no cost by simply registering for redistribution rights with Microsoft. The Express Edition does not require a CAL when it is used on a standalone basis. If it connects to a SQL Server instance running Enterprise Edition, Standard Edition, or Workgroup Edition, a separate user or device CAL is required unless the SQL Server instance it connects to is licensed under the per-processor model.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1146926327588070502-2172328484611578546?l=madhuottapalam.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://madhuottapalam.blogspot.com/feeds/2172328484611578546/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=1146926327588070502&amp;postID=2172328484611578546' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1146926327588070502/posts/default/2172328484611578546'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1146926327588070502/posts/default/2172328484611578546'/><link rel='alternate' type='text/html' href='http://madhuottapalam.blogspot.com/2007/10/sql-server-2005-pricing-and-licensing.html' title='SQL Server 2005 Pricing and Licensing'/><author><name>Madhu K Nair</name><uri>http://www.blogger.com/profile/08936146465563191414</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='30' height='32' src='http://1.bp.blogspot.com/_4wBIz276vTw/TKtTNRq6sZI/AAAAAAAAASA/DVQPmnwt50c/S220/Madhu.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1146926327588070502.post-1726855662701287403</id><published>2007-10-19T22:50:00.000-07:00</published><updated>2008-07-02T22:50:58.241-07:00</updated><title type='text'>Deprecated/Removed Command Line Utilities of SQL Server 2005</title><content type='html'>Tool Purpose Status&lt;br /&gt;&lt;br /&gt;isql Used to execute SQL/SP/Script from Command Prompt Removed&lt;br /&gt;&lt;br /&gt;rebuildm This utility was used was used to rebuild the master database. Removed&lt;br /&gt;&lt;br /&gt;regrebld This utility was used to back up and restore the Removed&lt;br /&gt;SQL Server Registry entries.&lt;br /&gt;&lt;br /&gt;sqlmaint This utility is used to execute maintenance plans that were Deprecated&lt;br /&gt;created in previous versions of SQL Server.&lt;br /&gt;&lt;br /&gt;readpipe This utility is used to verify a client’s connectivity to SQL Server Deprecated&lt;br /&gt;through named pipes&lt;br /&gt;&lt;br /&gt;Osql Used to execute SQL/SP/Script from Command Prompt Deprecated&lt;br /&gt;&lt;br /&gt;makepipe This utility is used to verify a client’s connectivity Deprecated&lt;br /&gt;to SQL Server through named pipes&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1146926327588070502-1726855662701287403?l=madhuottapalam.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://madhuottapalam.blogspot.com/feeds/1726855662701287403/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=1146926327588070502&amp;postID=1726855662701287403' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1146926327588070502/posts/default/1726855662701287403'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1146926327588070502/posts/default/1726855662701287403'/><link rel='alternate' type='text/html' href='http://madhuottapalam.blogspot.com/2007/10/deprecatedremoved-command-line.html' title='Deprecated/Removed Command Line Utilities of SQL Server 2005'/><author><name>Madhu K Nair</name><uri>http://www.blogger.com/profile/08936146465563191414</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='30' height='32' src='http://1.bp.blogspot.com/_4wBIz276vTw/TKtTNRq6sZI/AAAAAAAAASA/DVQPmnwt50c/S220/Madhu.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1146926327588070502.post-1908118364538780907</id><published>2007-10-02T23:15:00.000-07:00</published><updated>2008-07-01T23:15:52.318-07:00</updated><title type='text'>SQL Server Express 4GB Size Limitation and the Error</title><content type='html'>&lt;span style="font-family:courier new;"&gt;I have seen lot of queries regarding the size limitation in SQL Server Express. We all know there is limitaiton and its 4GB. But is it exactly 4GB or when the engine stops you pumping more data into the database? And whats the error you gets? These are the few FAQ on this subject. Then I thought I should try myself and document it.&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;SQL Server Version&lt;br /&gt;&lt;/strong&gt;&lt;br /&gt;Microsoft SQL Server 2005 - 9.00.1399.06 (Intel X86)&lt;br /&gt;Oct 14 2005 00:33:37&lt;br /&gt;Copyright (c) 1988-2005 Microsoft Corporation&lt;br /&gt;Express Edition on Windows NT 5.1 (Build 2600: Service Pack 2)&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;(a) When We try to restore a database of size more than 4 GB&lt;br /&gt;&lt;/strong&gt;&lt;br /&gt;RESTORE FILELISTONLY FROM DISK='D:\GP.bak'&lt;br /&gt;RESTORE DATABASE GPtogpx&lt;br /&gt;FROM DISK='D:\GP.bak'&lt;br /&gt;WITH MOVE'Gp' TO 'd:\GP.mdf',&lt;br /&gt;MOVE 'Gp_log' TO 'd:\GP_log.ldf'&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;Error&lt;br /&gt;&lt;/strong&gt;Msg 1827, Level 16, State 4, Line 1&lt;br /&gt;CREATE DATABASE or ALTER DATABASE failed because the&lt;br /&gt;resulting cumulative database size would exceed your licensed&lt;br /&gt;limit of 4096 MB per database. Msg 3013, Level 16, State 1, Line 1&lt;br /&gt;RESTORE DATABASE is terminating abnormally.&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;(b) When a database crosses 4 GB Limit&lt;br /&gt;&lt;/strong&gt;&lt;br /&gt;&lt;strong&gt;sp_spaceused Result&lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;database_name    database_size        unallocated space&lt;br /&gt;-------------------- ------------------------------------&lt;br /&gt;ABC              4216.75 MB            77.16 MB&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;reserved    data     index_size       unused&lt;br /&gt;------------------ ------------------ ------------------&lt;br /&gt;4115296 KB  4098792 KB    11824 KB     4680 KB&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;Error &lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;Msg 1101, Level 17, State 12, Line 3&lt;br /&gt;Could not allocate a new page for database 'GPtogpx' because of insufficient disk space in filegroup 'PRIMARY'. Create the necessary space by dropping objects in the filegroup, adding additional files to the filegroup, or setting autogrowth on for existing files in the filegroup.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;So, the bottom line of this study is, the limitation is just not in the paper and it really going to hit you sooner or later if the database going to grow beyond 4GB. So go for Licensed Edition&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1146926327588070502-1908118364538780907?l=madhuottapalam.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://madhuottapalam.blogspot.com/feeds/1908118364538780907/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=1146926327588070502&amp;postID=1908118364538780907' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1146926327588070502/posts/default/1908118364538780907'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1146926327588070502/posts/default/1908118364538780907'/><link rel='alternate' type='text/html' href='http://madhuottapalam.blogspot.com/2007/10/sql-server-express-4gb-size-limitation.html' title='SQL Server Express 4GB Size Limitation and the Error'/><author><name>Madhu K Nair</name><uri>http://www.blogger.com/profile/08936146465563191414</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='30' height='32' src='http://1.bp.blogspot.com/_4wBIz276vTw/TKtTNRq6sZI/AAAAAAAAASA/DVQPmnwt50c/S220/Madhu.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1146926327588070502.post-5793822669370692724</id><published>2007-09-30T22:53:00.000-07:00</published><updated>2008-07-02T22:53:21.570-07:00</updated><title type='text'>How to upgrade SQL server 2005</title><content type='html'>use SKUUPGRADE=1 swtich from the command prompt with setup.&lt;br /&gt;&lt;br /&gt;Eg :&lt;br /&gt;start /wait setup.exe ADDLOCAL=SQL_Engine INSTANCENAME=MSSQLSERVER UPGRADE=SQL_Engine SKUUPGRADE=1 /qb&lt;br /&gt;&lt;br /&gt;Refer&lt;br /&gt;http://msdn2.microsoft.com/en-us/library/ms144259.aspx#skuupgrade&lt;br /&gt;&lt;br /&gt;Evaluation to EE Upgrade&lt;br /&gt;Refer :&lt;br /&gt;http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=2111140&amp;SiteID=1&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1146926327588070502-5793822669370692724?l=madhuottapalam.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://madhuottapalam.blogspot.com/feeds/5793822669370692724/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=1146926327588070502&amp;postID=5793822669370692724' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1146926327588070502/posts/default/5793822669370692724'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1146926327588070502/posts/default/5793822669370692724'/><link rel='alternate' type='text/html' href='http://madhuottapalam.blogspot.com/2007/09/how-to-upgrade-sql-server-2005.html' title='How to upgrade SQL server 2005'/><author><name>Madhu K Nair</name><uri>http://www.blogger.com/profile/08936146465563191414</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='30' height='32' src='http://1.bp.blogspot.com/_4wBIz276vTw/TKtTNRq6sZI/AAAAAAAAASA/DVQPmnwt50c/S220/Madhu.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1146926327588070502.post-1806070084659981884</id><published>2007-09-22T22:58:00.000-07:00</published><updated>2008-07-02T22:58:27.891-07:00</updated><title type='text'>Troubleshooting Performance Problems in SQL Server 2005</title><content type='html'>Good resource on Troubleshooting Performance Problems in SQL Server 2005&lt;br /&gt;http://www.microsoft.com/technet/prodtechnol/sql/2005/tsprfprb.mspx&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1146926327588070502-1806070084659981884?l=madhuottapalam.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://madhuottapalam.blogspot.com/feeds/1806070084659981884/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=1146926327588070502&amp;postID=1806070084659981884' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1146926327588070502/posts/default/1806070084659981884'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1146926327588070502/posts/default/1806070084659981884'/><link rel='alternate' type='text/html' href='http://madhuottapalam.blogspot.com/2007/09/troubleshooting-performance-problems-in.html' title='Troubleshooting Performance Problems in SQL Server 2005'/><author><name>Madhu K Nair</name><uri>http://www.blogger.com/profile/08936146465563191414</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='30' height='32' src='http://1.bp.blogspot.com/_4wBIz276vTw/TKtTNRq6sZI/AAAAAAAAASA/DVQPmnwt50c/S220/Madhu.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1146926327588070502.post-8813614373460546110</id><published>2007-08-29T04:42:00.000-07:00</published><updated>2008-08-29T04:44:53.950-07:00</updated><title type='text'>Msg 3154, Level 16, State 4, Server YourDatabaseName, Line 1</title><content type='html'>This error tells you that the database being restored is already existing in the server. Use WITH REPLACE or Change the database Name which you are restoring.&lt;br /&gt;&lt;br /&gt;RESTORE DATABASE YOURDATABASENAME FROM DISK='D:\YOURDB.BAK' WITH REPLACE&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1146926327588070502-8813614373460546110?l=madhuottapalam.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://madhuottapalam.blogspot.com/feeds/8813614373460546110/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=1146926327588070502&amp;postID=8813614373460546110' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1146926327588070502/posts/default/8813614373460546110'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1146926327588070502/posts/default/8813614373460546110'/><link rel='alternate' type='text/html' href='http://madhuottapalam.blogspot.com/2007/08/msg-3154-level-16-state-4-server.html' title='Msg 3154, Level 16, State 4, Server YourDatabaseName, Line 1'/><author><name>Madhu K Nair</name><uri>http://www.blogger.com/profile/08936146465563191414</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='30' height='32' src='http://1.bp.blogspot.com/_4wBIz276vTw/TKtTNRq6sZI/AAAAAAAAASA/DVQPmnwt50c/S220/Madhu.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1146926327588070502.post-4612716204185188721</id><published>2007-08-22T23:15:00.000-07:00</published><updated>2008-07-01T23:17:06.089-07:00</updated><title type='text'>FAQ : SQL Server Certifications</title><content type='html'>&lt;p&gt;&lt;a href="http://www.microsoft.com/learning/mcp/newgen/default.asp" target="_parent"&gt;&lt;strong&gt;The New Generation of Microsoft Certifications&lt;/strong&gt;&lt;/a&gt; &lt;a href="http://www.microsoft.com/learning/mcp/newgen/default.asp"&gt;http://www.microsoft.com/learning/mcp/newgen/default.asp&lt;/a&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;&lt;a href="http://www.microsoft.com/learning/mcp/newgen/faq/" target="_parent"&gt;&lt;strong&gt;Microsoft Next Generation of Certifications: Frequently Asked Questions&lt;/strong&gt;&lt;/a&gt; &lt;a href="http://www.microsoft.com/learning/mcp/newgen/faq/"&gt;http://www.microsoft.com/learning/mcp/newgen/faq/&lt;/a&gt;&lt;/p&gt;&lt;p&gt;&lt;strong&gt;&lt;/strong&gt;&lt;a href="http://www.microsoft.com/learning/mcp/mcitp/" target="_parent"&gt;&lt;strong&gt;Microsoft Certifications for IT Professionals&lt;/strong&gt;&lt;/a&gt;&lt;/p&gt;&lt;p&gt;http://www.microsoft.com/learning/mcp/mcitp&lt;/p&gt;&lt;p&gt;&lt;span style="font-family:courier new;"&gt;&lt;strong&gt;MCITP Database Developer &lt;/strong&gt;&lt;/span&gt;&lt;/p&gt;&lt;ol&gt;&lt;li&gt;&lt;span style="font-size:85%;"&gt;&lt;span style="font-family:courier new;"&gt;SQL Server MCTS (70-431) &lt;/span&gt;&lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;span style="font-size:85%;"&gt;&lt;span style="font-family:courier new;"&gt;70-441 (Designing DB Solution)&lt;/span&gt;&lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;span style="font-size:85%;"&gt;&lt;span style="font-family:courier new;"&gt;70-442 (Designing and Optimizing Data Access&lt;/span&gt;&lt;/span&gt;&lt;/li&gt;&lt;/ol&gt;&lt;p&gt;&lt;span style="font-family:Courier New;"&gt;&lt;strong&gt;MCITP DB Administrator&lt;/strong&gt;&lt;/span&gt;&lt;/p&gt;&lt;ol&gt;&lt;li&gt;&lt;span style="font-size:85%;"&gt;&lt;span style="font-family:Courier New;"&gt;70-431 (MCTS) &lt;/span&gt;&lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;span style="font-size:85%;"&gt;&lt;span style="font-family:Courier New;"&gt;70-443 Designing a DB Server Infrastructure&lt;/span&gt;&lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;span style="font-size:85%;"&gt;&lt;span style="font-family:Courier New;"&gt;70-444 Optimizing and Maintaining a Database Administration Solution &lt;/span&gt;&lt;/span&gt;&lt;/li&gt;&lt;/ol&gt;&lt;p&gt;&lt;span style="font-size:85%;"&gt;Or &lt;strong&gt;If you are upgrading from MCDBA&lt;/strong&gt;&lt;/span&gt;&lt;/p&gt;&lt;ol&gt;&lt;li&gt;&lt;span style="font-size:85%;"&gt;70-431(MCTS ) &lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;span style="font-size:85%;"&gt;70447 ( Database Administration by Using Microsoft SQL Server 2005 )&lt;/span&gt;&lt;/li&gt;&lt;/ol&gt;&lt;span style="font-size:85%;"&gt;&lt;p&gt;&lt;br /&gt;&lt;strong&gt;MCITP: Business Intelligence Developer &lt;/strong&gt;&lt;/span&gt;&lt;/p&gt;&lt;span style="font-size:85%;"&gt;&lt;ol&gt;&lt;li&gt;MCTS: SQL Server 2005 (70-431) + &lt;/li&gt;&lt;li&gt;70-445: PRO: Designing Business Intelligence Solutions by Using Microsoft SQL Server 2005 Analysis Services +&lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;span style="font-size:85%;"&gt;70-446: PRO: Designing a Business Intelligence Infrastructure by Using Microsoft SQL Server 2005&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;/li&gt;&lt;/ol&gt;&lt;/span&gt;&lt;p&gt;&lt;span style="font-size:85%;"&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="font-size:85%;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1146926327588070502-4612716204185188721?l=madhuottapalam.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://madhuottapalam.blogspot.com/feeds/4612716204185188721/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=1146926327588070502&amp;postID=4612716204185188721' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1146926327588070502/posts/default/4612716204185188721'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1146926327588070502/posts/default/4612716204185188721'/><link rel='alternate' type='text/html' href='http://madhuottapalam.blogspot.com/2007/08/faq-sql-server-certifications.html' title='FAQ : SQL Server Certifications'/><author><name>Madhu K Nair</name><uri>http://www.blogger.com/profile/08936146465563191414</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='30' height='32' src='http://1.bp.blogspot.com/_4wBIz276vTw/TKtTNRq6sZI/AAAAAAAAASA/DVQPmnwt50c/S220/Madhu.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1146926327588070502.post-809164688174230288</id><published>2007-08-10T23:11:00.000-07:00</published><updated>2008-07-02T23:12:14.534-07:00</updated><title type='text'>SQL Server 2005 Service Pack and hot fixes</title><content type='html'>single window for all Service packs and other hot fixes of SQL Server 2005.&lt;br /&gt;&lt;br /&gt;http://support.microsoft.com/kb/913089/&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1146926327588070502-809164688174230288?l=madhuottapalam.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://madhuottapalam.blogspot.com/feeds/809164688174230288/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=1146926327588070502&amp;postID=809164688174230288' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1146926327588070502/posts/default/809164688174230288'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1146926327588070502/posts/default/809164688174230288'/><link rel='alternate' type='text/html' href='http://madhuottapalam.blogspot.com/2007/08/sql-server-2005-service-pack-and-hot.html' title='SQL Server 2005 Service Pack and hot fixes'/><author><name>Madhu K Nair</name><uri>http://www.blogger.com/profile/08936146465563191414</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='30' height='32' src='http://1.bp.blogspot.com/_4wBIz276vTw/TKtTNRq6sZI/AAAAAAAAASA/DVQPmnwt50c/S220/Madhu.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1146926327588070502.post-8878973555893501913</id><published>2007-07-02T23:16:00.000-07:00</published><updated>2008-07-02T23:16:30.366-07:00</updated><title type='text'>Next version of BPA forSQL Server 2005</title><content type='html'>The new version of the &lt;a class="" href="http://www.microsoft.com/downloads/details.aspx?FamilyID=DA0531E4-E94C-4991-82FA-F0E3FBD05E63&amp;amp;displaylang=en" target="_blank"&gt;Best Practices Analyzer from MSDN Downloads&lt;/a&gt;.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1146926327588070502-8878973555893501913?l=madhuottapalam.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://madhuottapalam.blogspot.com/feeds/8878973555893501913/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=1146926327588070502&amp;postID=8878973555893501913' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1146926327588070502/posts/default/8878973555893501913'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1146926327588070502/posts/default/8878973555893501913'/><link rel='alternate' type='text/html' href='http://madhuottapalam.blogspot.com/2007/07/next-version-of-bpa-forsql-server-2005.html' title='Next version of BPA forSQL Server 2005'/><author><name>Madhu K Nair</name><uri>http://www.blogger.com/profile/08936146465563191414</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='30' height='32' src='http://1.bp.blogspot.com/_4wBIz276vTw/TKtTNRq6sZI/AAAAAAAAASA/DVQPmnwt50c/S220/Madhu.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1146926327588070502.post-8974842212429516363</id><published>2007-07-02T23:14:00.000-07:00</published><updated>2008-07-02T23:14:41.150-07:00</updated><title type='text'>Bookmark Lookup Logical Operation removed from SQL Server 2005</title><content type='html'>The Bookmark Lookup logical operation was removed in SQL Server 2005 and replaced with clustered index seek and RID lookup. Previous versions of SQL Server displayed the Bookmark Lookup icon but actually performed the clustered index seek and RID lookup.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1146926327588070502-8974842212429516363?l=madhuottapalam.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://madhuottapalam.blogspot.com/feeds/8974842212429516363/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=1146926327588070502&amp;postID=8974842212429516363' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1146926327588070502/posts/default/8974842212429516363'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1146926327588070502/posts/default/8974842212429516363'/><link rel='alternate' type='text/html' href='http://madhuottapalam.blogspot.com/2007/07/bookmark-lookup-logical-operation.html' title='Bookmark Lookup Logical Operation removed from SQL Server 2005'/><author><name>Madhu K Nair</name><uri>http://www.blogger.com/profile/08936146465563191414</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='30' height='32' src='http://1.bp.blogspot.com/_4wBIz276vTw/TKtTNRq6sZI/AAAAAAAAASA/DVQPmnwt50c/S220/Madhu.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1146926327588070502.post-1146293146435718529</id><published>2007-07-02T23:12:00.000-07:00</published><updated>2008-07-02T23:13:07.372-07:00</updated><title type='text'>patterns &amp; practices Performance Testing Guidance project Community site.</title><content type='html'>Perfect resource for Performance Testing. Worth to read and implement. Atleast gothrough once ,stuffed with lot of information.&lt;br /&gt;&lt;br /&gt;http://www.codeplex.com/PerfTesting&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1146926327588070502-1146293146435718529?l=madhuottapalam.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://madhuottapalam.blogspot.com/feeds/1146293146435718529/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=1146926327588070502&amp;postID=1146293146435718529' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1146926327588070502/posts/default/1146293146435718529'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1146926327588070502/posts/default/1146293146435718529'/><link rel='alternate' type='text/html' href='http://madhuottapalam.blogspot.com/2007/07/patterns-practices-performance-testing.html' title='patterns &amp; practices Performance Testing Guidance project Community site.'/><author><name>Madhu K Nair</name><uri>http://www.blogger.com/profile/08936146465563191414</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='30' height='32' src='http://1.bp.blogspot.com/_4wBIz276vTw/TKtTNRq6sZI/AAAAAAAAASA/DVQPmnwt50c/S220/Madhu.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1146926327588070502.post-1660535736406653237</id><published>2007-07-02T23:11:00.000-07:00</published><updated>2008-07-02T23:11:36.202-07:00</updated><title type='text'>Few SQL OS  DMVs Query- Courtesy to Slava</title><content type='html'>Taken from Slava Oks's Blog. &lt;br /&gt;http://blogs.msdn.com/slavao/archive/2006/09/28/776437.aspx&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;&lt;br /&gt;sys.dm_os_schedulers&lt;/strong&gt;&lt;br /&gt;Q. Do I need to by more CPUs?&lt;br /&gt;In order to answer this question you have to find out if your load is really CPU bounded.  Your load is really CPU bounded if a number of runnable tasks per each scheduler always greater than 1 and all of your queries have correct plan.  The latter statement is very important, your load can be CPU bounded due to the fact that somehow optimizer generated bad plan – it can happen if your statistics out of date or you tried to perform handcrafted optimization. In this case you don’t want to run to Circuit City to buy more CPUs right a way – you want to fix the plan. Here is the query to find out average length of a runable queue on the system:&lt;br /&gt;&lt;br /&gt; &lt;br /&gt;&lt;br /&gt;select &lt;br /&gt;&lt;br /&gt;AVG (runnable_tasks_count) &lt;br /&gt;&lt;br /&gt;from &lt;br /&gt;&lt;br /&gt;sys.dm_os_schedulers &lt;br /&gt;&lt;br /&gt;where &lt;br /&gt;&lt;br /&gt;status = 'VISIBLE ONLINE'&lt;br /&gt;&lt;br /&gt; &lt;br /&gt;&lt;br /&gt;Buying more CPUs has also to do with capacity planning. You have to be very careful when performing capacity planning on hardware with HT enabled – remember you don’t have extra physical CPUs. Keep in mind that if your load runs at 60% CPU utilization - it doesn’t mean that you have 40% of extra CPU capacity. You will be very surprise how fast CPU load will jump from 60% to 80% and then even faster to 100% once you apply more and more load. &lt;br /&gt;&lt;br /&gt; &lt;br /&gt;&lt;br /&gt;Q. What is affinity of my schedulers to CPUs?&lt;br /&gt; &lt;br /&gt;&lt;br /&gt;select &lt;br /&gt;&lt;br /&gt;      scheduler_id, &lt;br /&gt;&lt;br /&gt;      CAST (cpu_id as varbinary) AS scheduler_affinity_mask&lt;br /&gt;&lt;br /&gt;from &lt;br /&gt;&lt;br /&gt;sys.dm_os_schedulers &lt;br /&gt;&lt;br /&gt; &lt;br /&gt;&lt;br /&gt;Does my machine have either hard or soft NUMA configuration enabled?&lt;br /&gt; &lt;br /&gt;&lt;br /&gt;select &lt;br /&gt;&lt;br /&gt;      CASE count( DISTINCT parent_node_id)&lt;br /&gt;&lt;br /&gt;      WHEN 1 THEN 'NUMA disabled'&lt;br /&gt;&lt;br /&gt;      ELSE 'NUMA enabled'&lt;br /&gt;&lt;br /&gt;      END&lt;br /&gt;&lt;br /&gt;from&lt;br /&gt;&lt;br /&gt;      sys.dm_os_schedulers&lt;br /&gt;&lt;br /&gt;where parent_node_id &lt;&gt; 32&lt;br /&gt;&lt;br /&gt; &lt;br /&gt;&lt;br /&gt;Q. Should I configure SQL Server to use more threads – sp_configure ‘max server threads’?&lt;br /&gt;You can answer this question by looking at the work queue length for each scheduler. If on average such value is above 1 then you might benefit from adding more threads to the system but only if&lt;br /&gt;&lt;br /&gt;A.  Your load currently is not CPU bounded (See info above on how to find out if your load is CPU bound) &lt;br /&gt;&lt;br /&gt;B. Your load currently doesn’t experience any other heavy waits (If you add more threads in this case they will just end up waiting as everyone else)&lt;br /&gt;&lt;br /&gt; &lt;br /&gt;&lt;br /&gt;select &lt;br /&gt;&lt;br /&gt;AVG (work_queue_count) &lt;br /&gt;&lt;br /&gt;from &lt;br /&gt;&lt;br /&gt;sys.dm_os_schedulers &lt;br /&gt;&lt;br /&gt;where &lt;br /&gt;&lt;br /&gt;status = 'VISIBLE ONLINE'&lt;br /&gt;&lt;br /&gt; &lt;br /&gt;&lt;br /&gt;Q: Is my system I/O bound?&lt;br /&gt;You can answer this question by monitoring length of I/O queues.&lt;br /&gt;&lt;br /&gt; &lt;br /&gt;&lt;br /&gt;select &lt;br /&gt;&lt;br /&gt;      pending_disk_io_count &lt;br /&gt;&lt;br /&gt;from &lt;br /&gt;&lt;br /&gt;      sys.dm_os_schedulers&lt;br /&gt;&lt;br /&gt; &lt;br /&gt;&lt;br /&gt; If over time they keep on growing or you are seeing periodic jumps or numbers stay relatively high most likely your system is I/O bound. In order to identify the cause you will have to dive further.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1146926327588070502-1660535736406653237?l=madhuottapalam.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://madhuottapalam.blogspot.com/feeds/1660535736406653237/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=1146926327588070502&amp;postID=1660535736406653237' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1146926327588070502/posts/default/1660535736406653237'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1146926327588070502/posts/default/1660535736406653237'/><link rel='alternate' type='text/html' href='http://madhuottapalam.blogspot.com/2007/07/few-sql-os-dmvs-query-courtesy-to-slava.html' title='Few SQL OS  DMVs Query- Courtesy to Slava'/><author><name>Madhu K Nair</name><uri>http://www.blogger.com/profile/08936146465563191414</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='30' height='32' src='http://1.bp.blogspot.com/_4wBIz276vTw/TKtTNRq6sZI/AAAAAAAAASA/DVQPmnwt50c/S220/Madhu.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1146926327588070502.post-4610925069194469668</id><published>2007-07-02T22:54:00.000-07:00</published><updated>2008-07-02T22:54:22.737-07:00</updated><title type='text'>Connecting to SQL Server 2005 on Vista and Longhorn</title><content type='html'>I have seen lots of post in forums connecting to sql server 2005 on Vista. Check out this post by Protocol Team. http://blogs.msdn.com/sql_protocols/archive/2007/06/18/connecting-to-sql-server-2005-on-vista-and-longhorn.aspx#comments&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1146926327588070502-4610925069194469668?l=madhuottapalam.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://madhuottapalam.blogspot.com/feeds/4610925069194469668/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=1146926327588070502&amp;postID=4610925069194469668' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1146926327588070502/posts/default/4610925069194469668'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1146926327588070502/posts/default/4610925069194469668'/><link rel='alternate' type='text/html' href='http://madhuottapalam.blogspot.com/2007/07/connecting-to-sql-server-2005-on-vista.html' title='Connecting to SQL Server 2005 on Vista and Longhorn'/><author><name>Madhu K Nair</name><uri>http://www.blogger.com/profile/08936146465563191414</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='30' height='32' src='http://1.bp.blogspot.com/_4wBIz276vTw/TKtTNRq6sZI/AAAAAAAAASA/DVQPmnwt50c/S220/Madhu.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1146926327588070502.post-5962451314946160539</id><published>2007-07-02T22:52:00.000-07:00</published><updated>2008-07-02T22:52:39.310-07:00</updated><title type='text'>Default Trace in SQL Server 2005</title><content type='html'>When i saw *SQL Trace ID 1 was started by login "sa" * in my Error Log I was little surprised. Since i have never started any trace I was wondering what  is this all about.  Then i came to know that this is the default trace started which is a new  feature introduced in SQL Server 2005. Then i was curious about how can i see the contents. here we go...&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;To See All the Trace and its location :&lt;br /&gt;select * from ::fn_trace_getinfo(default) &lt;br /&gt;&lt;br /&gt;To get the File Location&lt;br /&gt;select * from ::fn_trace_getinfo(default) where Property=2&lt;br /&gt;&lt;br /&gt;And copy paste the Value column text.&lt;br /&gt;&lt;br /&gt;To Get the Trace Data&lt;br /&gt;&lt;br /&gt;SELECT * FROM fn_trace_gettable('C:\Program Files\Microsoft SQL Server\MSSQL.1\MSSQL\LOG\log.trc', default) where starttime&gt;'2007-10-15'&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1146926327588070502-5962451314946160539?l=madhuottapalam.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://madhuottapalam.blogspot.com/feeds/5962451314946160539/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=1146926327588070502&amp;postID=5962451314946160539' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1146926327588070502/posts/default/5962451314946160539'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1146926327588070502/posts/default/5962451314946160539'/><link rel='alternate' type='text/html' href='http://madhuottapalam.blogspot.com/2007/07/default-trace-in-sql-server-2005.html' title='Default Trace in SQL Server 2005'/><author><name>Madhu K Nair</name><uri>http://www.blogger.com/profile/08936146465563191414</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='30' height='32' src='http://1.bp.blogspot.com/_4wBIz276vTw/TKtTNRq6sZI/AAAAAAAAASA/DVQPmnwt50c/S220/Madhu.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1146926327588070502.post-79553098174949169</id><published>2007-06-20T23:44:00.000-07:00</published><updated>2008-07-02T23:45:28.869-07:00</updated><title type='text'>Webcast on SQL Server 2005 by Vinod</title><content type='html'>Webcast on SQL Server 2005 by Vinod&lt;br /&gt;&lt;br /&gt;&lt;a href="https://msevents.microsoft.com/CUI/Register.aspx?culture=en-IN&amp;EventID=1032341137&amp;amp;CountryCode=IN&amp;IsRedirect=false"&gt;Capacity Planning Considerations – SQL Server 2005&lt;/a&gt; - June 20th (2-3 PM IST)&lt;br /&gt;&lt;br /&gt;&lt;a href="https://msevents.microsoft.com/CUI/Register.aspx?culture=en-IN&amp;EventID=1032341135&amp;amp;CountryCode=IN&amp;IsRedirect=false"&gt;Understanding IO and Storage system with SQL Server 2005&lt;/a&gt; - June 21st (2-3 PM IST)&lt;br /&gt;&lt;br /&gt;&lt;a href="https://msevents.microsoft.com/CUI/Register.aspx?culture=en-IN&amp;EventID=1032341139&amp;amp;CountryCode=IN&amp;IsRedirect=false"&gt;Performance Tuning and Troubleshooting – SQL Server 2005&lt;/a&gt; - June 22th (2-3 PM IST)&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1146926327588070502-79553098174949169?l=madhuottapalam.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://madhuottapalam.blogspot.com/feeds/79553098174949169/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=1146926327588070502&amp;postID=79553098174949169' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1146926327588070502/posts/default/79553098174949169'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1146926327588070502/posts/default/79553098174949169'/><link rel='alternate' type='text/html' href='http://madhuottapalam.blogspot.com/2007/06/webcast-on-sql-server-2005-by-vinod.html' title='Webcast on SQL Server 2005 by Vinod'/><author><name>Madhu K Nair</name><uri>http://www.blogger.com/profile/08936146465563191414</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='30' height='32' src='http://1.bp.blogspot.com/_4wBIz276vTw/TKtTNRq6sZI/AAAAAAAAASA/DVQPmnwt50c/S220/Madhu.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1146926327588070502.post-2941198550932108912</id><published>2007-06-17T23:45:00.000-07:00</published><updated>2008-07-02T23:46:12.573-07:00</updated><title type='text'>SQL Server 2008 (Katmai) CTP Released</title><content type='html'>Great news... Microsoft has released CTP version of SQL Server 2008.&lt;br /&gt;&lt;br /&gt;&lt;a href="https://connect.microsoft.com/SQLServer/content/content.aspx?ContentID=5395"&gt;https://connect.microsoft.com/SQLServer/content/content.aspx?ContentID=5395&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1146926327588070502-2941198550932108912?l=madhuottapalam.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://madhuottapalam.blogspot.com/feeds/2941198550932108912/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=1146926327588070502&amp;postID=2941198550932108912' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1146926327588070502/posts/default/2941198550932108912'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1146926327588070502/posts/default/2941198550932108912'/><link rel='alternate' type='text/html' href='http://madhuottapalam.blogspot.com/2007/06/sql-server-2008-katmai-ctp-released.html' title='SQL Server 2008 (Katmai) CTP Released'/><author><name>Madhu K Nair</name><uri>http://www.blogger.com/profile/08936146465563191414</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='30' height='32' src='http://1.bp.blogspot.com/_4wBIz276vTw/TKtTNRq6sZI/AAAAAAAAASA/DVQPmnwt50c/S220/Madhu.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1146926327588070502.post-1800500372016014358</id><published>2007-05-26T23:47:00.000-07:00</published><updated>2008-07-02T23:47:34.396-07:00</updated><title type='text'>SQL Server 2005 Performance Dashboard Reports</title><content type='html'>This is a wonderful resource to have with SSMS. With SP2 giving you an window to build custom reports use these for your help to diagonize problems.  Download from here&lt;br /&gt;&lt;a href="http://www.microsoft.com/downloads/details.aspx?FamilyId=1D3A4A0D-7E0C-4730-8204-E419218C1EFC&amp;displaylang=en"&gt;http://www.microsoft.com/downloads/details.aspx?FamilyId=1D3A4A0D-7E0C-4730-8204-E419218C1EFC&amp;amp;displaylang=en&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1146926327588070502-1800500372016014358?l=madhuottapalam.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://madhuottapalam.blogspot.com/feeds/1800500372016014358/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=1146926327588070502&amp;postID=1800500372016014358' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1146926327588070502/posts/default/1800500372016014358'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1146926327588070502/posts/default/1800500372016014358'/><link rel='alternate' type='text/html' href='http://madhuottapalam.blogspot.com/2007/05/sql-server-2005-performance-dashboard.html' title='SQL Server 2005 Performance Dashboard Reports'/><author><name>Madhu K Nair</name><uri>http://www.blogger.com/profile/08936146465563191414</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='30' height='32' src='http://1.bp.blogspot.com/_4wBIz276vTw/TKtTNRq6sZI/AAAAAAAAASA/DVQPmnwt50c/S220/Madhu.jpg'/></author><thr:total>0</thr:total></entry></feed>
