<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>TechnoBlogy &#187; SQL Server</title>
	<atom:link href="http://technoblogy.net/tag/sql-server/feed/" rel="self" type="application/rss+xml" />
	<link>http://technoblogy.net</link>
	<description>Technology with a Big difference</description>
	<lastBuildDate>Mon, 05 Dec 2011 17:29:42 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.2.1</generator>
		<item>
		<title>Performance Tuning&#8211;SQL Server</title>
		<link>http://technoblogy.net/performance-tuningsql-server/</link>
		<comments>http://technoblogy.net/performance-tuningsql-server/#comments</comments>
		<pubDate>Sun, 23 Jan 2011 13:28:25 +0000</pubDate>
		<dc:creator>Nauman</dc:creator>
				<category><![CDATA[Databases]]></category>
		<category><![CDATA[SQL Server]]></category>
		<category><![CDATA[database statistics]]></category>
		<category><![CDATA[index tuning]]></category>
		<category><![CDATA[joining techniques]]></category>
		<category><![CDATA[optimization]]></category>
		<category><![CDATA[performace tunning]]></category>
		<category><![CDATA[performance]]></category>
		<category><![CDATA[query processing]]></category>
		<category><![CDATA[tuning]]></category>

		<guid isPermaLink="false">http://technoblogy.net/performance-tuningsql-server/</guid>
		<description><![CDATA[Many times in your organization an issue is raised that SQL server database is very much slow and its performance is not up to the mark. First thing that comes in mind is are indexes correctly applied to table that are being used? And most of the tim]]></description>
			<content:encoded><![CDATA[<p>Performance tunning is a must for any database because without your Database is the same as retrieving data from file system.</p>
<p>Many times in your organization an issue is raised that SQL server database is very much slow and its performance is not up to the mark. First thing that comes in mind is are indexes correctly applied to table that are being used? And most of the time indexes are applied, than what is the issue.</p>
<p>Most users think that only indexes are the reason for bad performance of a SQL server database, this is not true, there are many other reasons for slow response from your DB.</p>
<p>Following are some of the areas each of which are to be checked separately for resolution of performance issues in a SQL Server database:</p>
<p><strong>Joining Techniques</strong></p>
<p><strong>Optimization of Queries used</strong></p>
<p><strong>Maintaining up to date Statistics</strong></p>
<p><strong>Logical Query Processing</strong></p>
<p><strong>TempDB tuning</strong></p>
<p><strong>Hardware Issues (slow hard disks, CPU, Memory etc)</strong></p>
<p><strong>Index Tuning</strong></p>
<p>If all above areas are checked and planned properly, then probability of slow response from a SQL server database are very much minimized.</p>
]]></content:encoded>
			<wfw:commentRss>http://technoblogy.net/performance-tuningsql-server/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>SQL Server 2011</title>
		<link>http://technoblogy.net/sql-server-2011/</link>
		<comments>http://technoblogy.net/sql-server-2011/#comments</comments>
		<pubDate>Tue, 18 Jan 2011 12:52:15 +0000</pubDate>
		<dc:creator>Nauman</dc:creator>
				<category><![CDATA[SQL Server]]></category>
		<category><![CDATA[2011]]></category>
		<category><![CDATA[new features]]></category>
		<category><![CDATA[release]]></category>
		<category><![CDATA[sql server 2011]]></category>

		<guid isPermaLink="false">http://technoblogy.net/?p=813</guid>
		<description><![CDATA[Finally release date for SQL Server 2011 has been announced i.e November 11, 2010. The major features of the new products are as following: Enhanced Mission-Critical Platform: an enhanced highly available and scalable platform. Developer and IT Productivity: new innovative productivity tools and features. Pervasive Insight: expanding the reach of BI to business users and [...]]]></description>
			<content:encoded><![CDATA[<p>Finally release date for SQL Server 2011 has been announced i.e November 11, 2010.</p>
<p>The major features of the new products are as following:</p>
<ul>
<li>Enhanced Mission-Critical Platform: an enhanced highly available and scalable platform.</li>
<li>Developer and IT Productivity: new innovative productivity tools and features.</li>
<li>Pervasive Insight: expanding the reach of BI to business users and end-to-end data integration and management.</li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://technoblogy.net/sql-server-2011/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Cannot Resolve Collation Conflict</title>
		<link>http://technoblogy.net/cannot-resolve-collation-conflict/</link>
		<comments>http://technoblogy.net/cannot-resolve-collation-conflict/#comments</comments>
		<pubDate>Mon, 20 Sep 2010 10:59:49 +0000</pubDate>
		<dc:creator>Nauman</dc:creator>
				<category><![CDATA[Databases]]></category>
		<category><![CDATA[SQL Server]]></category>
		<category><![CDATA[collation]]></category>
		<category><![CDATA[conflict]]></category>
		<category><![CDATA[error]]></category>

		<guid isPermaLink="false">http://technoblogy.net/?p=581</guid>
		<description><![CDATA[
Collation can be defined at column level in MS SQL Server. An annoying error that comes up when using two columns that have different collations defined. ]]></description>
			<content:encoded><![CDATA[<p>Collation can be defined at column level in MS SQL Server. An annoying error that comes up when using two columns that have different collations defined.</p>
<p>For example:</p>
<blockquote><p>SELECT A.USER1, A.USER2, B.ROLENAME</p>
<p>FROM USERS A, ROLES B</p>
<p>WHERE A.ROLEID = B.ROLEID</p></blockquote>
<p>A.ROLEID and B.ROLEID both have different collations and it upon executing above query it will generate an error: &#8220;<strong>cannot resolve collation conflict.</strong></p>
<p>To resolve this error add <code>COLLATE DATABASE_DEFAULT</code> on both side of equal operator:</p>
<blockquote><p>SELECT A.USER1, A.USER2, B.ROLENAME</p>
<p>FROM USERS A, ROLES B</p>
<p>WHERE A.ROLEID COLLATE DATABASE_DEFAULT = B.ROLEID COLLATE DATABASE_DEFAULT</p></blockquote>
<p>Resolved.</p>
]]></content:encoded>
			<wfw:commentRss>http://technoblogy.net/cannot-resolve-collation-conflict/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Percentage of Work completed &#8211; SQL Server</title>
		<link>http://technoblogy.net/percentage-of-work-completed-sql-server/</link>
		<comments>http://technoblogy.net/percentage-of-work-completed-sql-server/#comments</comments>
		<pubDate>Tue, 24 Aug 2010 16:27:06 +0000</pubDate>
		<dc:creator>Nauman</dc:creator>
				<category><![CDATA[SQL Server]]></category>
		<category><![CDATA[DMV]]></category>
		<category><![CDATA[percentage completed]]></category>
		<category><![CDATA[sys.dm_exec_requests]]></category>

		<guid isPermaLink="false">http://technoblogy.net/percentage-of-work-completed-sql-server/</guid>
		<description><![CDATA[Today, I was taking a manual backup of a database through a scheduled Job. Normally this backup job takes about 1 hour to complete, but today it was still executing for almost 3 hours. I started to look up Activity monitor, dbcc commands for any lock against the database, but of no avail. After searching [...]]]></description>
			<content:encoded><![CDATA[<p>Today, I was taking a manual backup of a database through a scheduled Job. Normally this backup job takes about 1 hour to complete, but today it was still executing for almost 3 hours. I started to look up Activity monitor, dbcc commands for any lock against the database, but of no avail.</p>
<blockquote><p>After searching on internet i came across a DMV(Dynamic Management View) provided in SQL Server. This view has almost every detail of a single process executing in SQL Server.</p>
<p><strong>DMV &#8211; sys.dm_exec_requests</strong></p>
<p>Following script returned my desired result of percentage completed of my backup job:</p>
<p>SELECT Session_Id, Reads, Writes, Cpu_Time, Logical_Reads, Total_Elapsed_Time,</p>
<p>Blocking_Session_Id, Percent_Complete, Command,</p>
<p>(select text from sys.dm_exec_sql_text(sql_handle)) as Text FROM</p>
<p>sys.dm_exec_requests(nolock) WHERE session_id = 90</p></blockquote>
<p>Hope this helps.</p>
]]></content:encoded>
			<wfw:commentRss>http://technoblogy.net/percentage-of-work-completed-sql-server/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Get indexes on all tables &#8211; SQL Server</title>
		<link>http://technoblogy.net/get-indexes-on-all-tables-sql-server/</link>
		<comments>http://technoblogy.net/get-indexes-on-all-tables-sql-server/#comments</comments>
		<pubDate>Tue, 24 Aug 2010 16:14:03 +0000</pubDate>
		<dc:creator>Nauman</dc:creator>
				<category><![CDATA[SQL Server]]></category>
		<category><![CDATA[clustered]]></category>
		<category><![CDATA[Indexes]]></category>
		<category><![CDATA[non clustered]]></category>
		<category><![CDATA[tables]]></category>

		<guid isPermaLink="false">http://technoblogy.net/get-indexes-on-all-tables-sql-server/</guid>
		<description><![CDATA[An important ingredient in database designing is creating, maintaining and rebuilding indexes after some specified intervals. One main  aspect of database tuning is to apply indexes. Index must exist in databases otherwise their would be a lot of performance issues. While searching across internet, i came across a script that will list all the tables [...]]]></description>
			<content:encoded><![CDATA[<p>An important ingredient in database designing is creating, maintaining and rebuilding indexes after some specified intervals. One main  aspect of database tuning is to apply indexes. Index must exist in databases otherwise their would be a lot of performance issues.</p>
<p>While searching across internet, i came across a script that will list all the tables in my database and also show how many indexes are created/applied on those table wither clustered or non clustered.</p>
<p>Here’s the script:</p>
<blockquote><p>with cte as<br />
(<br />
select<br />
table_name = o.name,  �<br />
o.[object_id],<br />
i.index_id,<br />
i.type,<br />
i.type_desc<br />
from<br />
sys.indexes i<br />
inner join<br />
sys.objects o on i.[object_id] = o.[object_id]<br />
where<br />
o.type in (&#8216;U&#8217;)<br />
and<br />
o.is_ms_shipped = 0 and i.is_disabled = 0  and i.is_hypothetical = 0<br />
and<br />
i.type &lt;= 2<br />
), cte2 as<br />
(<br />
select<br />
*<br />
from<br />
cte c<br />
pivot<br />
(count(type) for type_desc in ([HEAP], [CLUSTERED], [NONCLUSTERED])) pv<br />
)<br />
select<br />
c2.table_name,<br />
[rows] = max(p.rows),<br />
is_heap = sum([HEAP]),<br />
is_clustered = sum([CLUSTERED]),<br />
num_of_nonclustered = sum([NONCLUSTERED])<br />
from<br />
cte2 c2<br />
inner join<br />
sys.partitions p on c2.[object_id] = p.[object_id] and c2.index_id = p.index_id<br />
group by<br />
table_name</p></blockquote>
]]></content:encoded>
			<wfw:commentRss>http://technoblogy.net/get-indexes-on-all-tables-sql-server/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Migrate from MySQL to SQL Server</title>
		<link>http://technoblogy.net/migrate-from-mysql-to-sql-server/</link>
		<comments>http://technoblogy.net/migrate-from-mysql-to-sql-server/#comments</comments>
		<pubDate>Mon, 23 Aug 2010 15:35:40 +0000</pubDate>
		<dc:creator>Nauman</dc:creator>
				<category><![CDATA[SQL Server]]></category>
		<category><![CDATA[Microsoft]]></category>
		<category><![CDATA[migration]]></category>
		<category><![CDATA[MySQL]]></category>

		<guid isPermaLink="false">http://technoblogy.net/migrate-from-mysql-to-sql-server/</guid>
		<description><![CDATA[Migrate from MySQL to SQL Server with ease. Microsoft has launched a small utility to migrate a database from MySQL to SQL Server. Name of the utility is SQL Server Migration Assistant for MySQL. More details can be found here]]></description>
			<content:encoded><![CDATA[<p>Migrate from MySQL to SQL Server with ease. Microsoft has launched a small utility to migrate a database from MySQL to SQL Server. Name of the utility is SQL Server Migration Assistant for MySQL.</p>
<p>More details can be found <a href="http://blogs.technet.com/b/dataplatforminsider/archive/2010/08/12/microsoft-announces-sql-server-migration-assistant-for-mysql.aspx" target="_blank">here</a></p>
]]></content:encoded>
			<wfw:commentRss>http://technoblogy.net/migrate-from-mysql-to-sql-server/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Remove a Stored Procedure in Production Environment</title>
		<link>http://technoblogy.net/remove-a-stored-procedure-in-production-environment/</link>
		<comments>http://technoblogy.net/remove-a-stored-procedure-in-production-environment/#comments</comments>
		<pubDate>Mon, 23 Aug 2010 15:35:13 +0000</pubDate>
		<dc:creator>Nauman</dc:creator>
				<category><![CDATA[SQL Server]]></category>
		<category><![CDATA[production]]></category>
		<category><![CDATA[remove]]></category>
		<category><![CDATA[stored procedure]]></category>
		<category><![CDATA[techniques]]></category>

		<guid isPermaLink="false">http://technoblogy.net/remove-a-stored-procedure-in-production-environment/</guid>
		<description><![CDATA[How to remove a Stored Procedure in SQL Server production environment? How can we be so sure that is not being used any more? You need to know every single path from where this procedure is initiating before you can actually remove it from production. Following are some ways to determine the usage of a [...]]]></description>
			<content:encoded><![CDATA[<p>How to remove a Stored Procedure in SQL Server production environment? How can we be so sure that is not being used any more?</p>
<p>You need to know every single path from where this procedure is initiating before you can actually remove it from production. Following are some ways to determine the usage of a procedure in SQL Server.</p>
<ol>
<li>Set up a trace and filter through SQL Server profiler service on procedure name and ID.</li>
<li>Another way is to regularly check procedure plan cache to see if there is a cached plan for the procedure.</li>
<li>Alternatively you can use a 3rd party audit software to retrieve procedure executions. (Most of these soft wares use tracing at the back end)\</li>
</ol>
]]></content:encoded>
			<wfw:commentRss>http://technoblogy.net/remove-a-stored-procedure-in-production-environment/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Retrieve permissions on SQL Server database</title>
		<link>http://technoblogy.net/retrieve-permissions-on-sql-server-database/</link>
		<comments>http://technoblogy.net/retrieve-permissions-on-sql-server-database/#comments</comments>
		<pubDate>Sun, 22 Aug 2010 17:38:28 +0000</pubDate>
		<dc:creator>Nauman</dc:creator>
				<category><![CDATA[SQL Server]]></category>
		<category><![CDATA[objects]]></category>
		<category><![CDATA[permissions]]></category>

		<guid isPermaLink="false">http://technoblogy.net/retrieve-permissions-on-sql-server-database/</guid>
		<description><![CDATA[SQL Server permissions can be granted to on an object level (schema, database, database objects). In newer versions of SQL Server permissions can be given to user at a more granular level.]]></description>
			<content:encoded><![CDATA[<p> </p>
<p>SQL Server permissions can be granted to on an object level (schema, database, database objects). In newer versions of SQL Server permissions can be given to user at a more granular level.</p>
<p>To retrieve all the permissions granted to a specific user SQL server has a function named: <strong>fn_my_permission.</strong>  This function is only accessible to system administrator. e.g</p>
<p>following query will retrieve all the permissions on server.</p>
<blockquote><p><em>select * From fn_my_permissions(NULL, NULL)  </em></p></blockquote>
<p>following query retrieve all the permissions on a database:</p>
<blockquote><p><em>select * From fn_my_permissions(NULL, ‘database’)</em></p></blockquote>
<p> </p>
<p>following query retrieve all the permissions on a dbo schema:</p>
<blockquote><p><em>select * From fn_my_permissions(’dbo’, ’schema’)</em></p></blockquote>
]]></content:encoded>
			<wfw:commentRss>http://technoblogy.net/retrieve-permissions-on-sql-server-database/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>How to Improve I/O performance for SQL Server</title>
		<link>http://technoblogy.net/how-to-improve-io-performance-for-sql-server/</link>
		<comments>http://technoblogy.net/how-to-improve-io-performance-for-sql-server/#comments</comments>
		<pubDate>Sun, 22 Aug 2010 13:23:40 +0000</pubDate>
		<dc:creator>Nauman</dc:creator>
				<category><![CDATA[SQL Server]]></category>
		<category><![CDATA[I/O]]></category>
		<category><![CDATA[performance]]></category>

		<guid isPermaLink="false">http://technoblogy.net/how-to-improve-io-performance-for-sql-server/</guid>
		<description><![CDATA[  If underline I/O architecture system is working properly then every time SQL Server do some transaction (Read/Write) it can do it without waiting. But if load on the system is up, then SQL transaction have to wait for their turns for processing. This can significantly reduce SQL Server performance. There is a much greater [...]]]></description>
			<content:encoded><![CDATA[<p> </p>
<p>If underline I/O architecture system is working properly then every time SQL Server do some transaction (Read/Write) it can do it without waiting. But if load on the system is up, then SQL transaction have to wait for their turns for processing. This can significantly reduce SQL Server performance. There is a much greater issue when you are not in charge of the underlying storage system. For that the main thing is to optimize the queries running by SQL Server.</p>
<p>Following are some tip to monitor and increase I/O performance of SQL Server.</p>
<p><strong>Queries using maximum I/O.</strong></p>
<p>This query will return top 25 queries that were the slowest in processing.</p>
<blockquote>
<pre><em>SELECT TOP 25
    q.[text],
    (total_logical_reads/execution_count) AS avg_logical_reads,
    (total_logical_writes/execution_count) AS avg_logical_writes,
    (total_physical_reads/execution_count) AS avg_phys_reads,
     Execution_count
FROM sys.dm_exec_query_stats
    cross apply sys.dm_exec_sql_text(plan_handle) AS q
ORDER BY
 (total_logical_reads + total_logical_writes) DESC</em></pre>
</blockquote>
<pre> </pre>
<p>Check which queries can be optimized and update them. Execute the above query frequently to check queries that can potentially create I/O bottleneck on system.</p>
<p><strong>Reading un necessary Data.</strong></p>
<p>When you are retrieving data, which is not going to be used than you are also overusing your I/O performance. One great example of this type of query is:</p>
<pre> </pre>
<pre>SELECT * FROM [Table]</pre>
<p> </p>
<p>Always retrieve only those columns that are going to be used. In cases where you want to get all the columns than specifically write all column names on your select clause.</p>
<p>Also use a WHERE clause where applicable because it will filter out rows that will not be used.</p>
<p><strong>Create Covered Indexes</strong></p>
<p>Once you have optimized your queries by using explicit column names and appropriate WHERE clause filtration of records, you can now focus on creating non-clustered covered index for the queries that have excessive read I/O. Covered indexes contain all columns as a part of index that are being used in SQL WHERE clause. You can also determine what columns are in need to be indexed by examining SQL execution plan of the query.</p>
]]></content:encoded>
			<wfw:commentRss>http://technoblogy.net/how-to-improve-io-performance-for-sql-server/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Import CSV file in SQL Server</title>
		<link>http://technoblogy.net/import-csv-file-in-sql-server/</link>
		<comments>http://technoblogy.net/import-csv-file-in-sql-server/#comments</comments>
		<pubDate>Fri, 28 May 2010 05:45:29 +0000</pubDate>
		<dc:creator>Nauman</dc:creator>
				<category><![CDATA[Databases]]></category>
		<category><![CDATA[SQL Server]]></category>
		<category><![CDATA[bulk insert]]></category>
		<category><![CDATA[csv]]></category>
		<category><![CDATA[import]]></category>

		<guid isPermaLink="false">http://technoblogy.net/?p=391</guid>
		<description><![CDATA[Importing a CSV(Comma Separated File) in SQL server is a very common task, and most of us use the Import /Export feature of SQL server to do this. Import/Export feature has SSIS (SQL Server Integration Services) as it backbone and works great with most of the Databases, file types etc. But today we are going [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://technoblogy.net/wp-content/uploads/2010/08/SQL-Server.png"></a>Importing a CSV(<strong>C</strong>omma <strong>S</strong>eparated <strong>F</strong>ile) in SQL server is a very common task, and most of us use the Import /Export feature of SQL server to do this. Import/Export feature has SSIS (SQL Server Integration Services) as it backbone and works great with most of the Databases, file types etc.</p>
<p>But today we are going to import a CSV file in SQL server through simple SQL queries. Following are the only two steps to follows for a loading a CSV file in SQL Server:</p>
<ul>
<li>Create a table, with all the columns you need to import from CSV file.</li>
<li>Next use Bulk Insert query to load all the data in SQL Server table create in step 1.</li>
</ul>
<p><strong>Example</strong></p>
<blockquote><p>CREATE TABLE CSV_LOAD</p>
<p>(</p>
<p>ID INT,</p>
<p>NAME VARCHAR(40),</p>
<p>CLASS VARCHAR(40)</p>
<p>)</p></blockquote>
<p>Our CSV file contains these values:</p>
<blockquote><p>1,NAUMAN,BSC</p>
<p>2,RIZWAN,MBA</p>
<p>3,FURQAN,A LEVELS</p></blockquote>
<p>Now the main part for Bulk Insert</p>
<blockquote><p>BULK INSERT CSV_LOAD</p>
<p>FROM &#8216;c:\csvload.csv&#8217;</p>
<p>WITH</p>
<p>(</p>
<p>FIELDTERMINATOR = &#8216;,&#8217;,</p>
<p>ROWTERMINATOR = &#8216;\n&#8217;</p>
<p>)</p></blockquote>
<p>Thats it.</p>
]]></content:encoded>
			<wfw:commentRss>http://technoblogy.net/import-csv-file-in-sql-server/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

