<?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/"
	xmlns:georss="http://www.georss.org/georss" xmlns:geo="http://www.w3.org/2003/01/geo/wgs84_pos#" xmlns:media="http://search.yahoo.com/mrss/"
	>

<channel>
	<title>SQL Server help</title>
	<atom:link href="http://sqlhelp.wordpress.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://sqlhelp.wordpress.com</link>
	<description>Complete support for SQL Server, Visual Basic, Active Server Pages help</description>
	<lastBuildDate>Mon, 16 Nov 2009 04:46:27 +0000</lastBuildDate>
	<generator>http://wordpress.com/</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<cloud domain='sqlhelp.wordpress.com' port='80' path='/?rsscloud=notify' registerProcedure='' protocol='http-post' />
<image>
		<url>http://www.gravatar.com/blavatar/9b770f7eeda80ffe3a2722ffa47d9ab4?s=96&#038;d=http://s.wordpress.com/i/buttonw-com.png</url>
		<title>SQL Server help</title>
		<link>http://sqlhelp.wordpress.com</link>
	</image>
	<atom:link rel="search" type="application/opensearchdescription+xml" href="http://sqlhelp.wordpress.com/osd.xml" title="SQL Server help" />
		<item>
		<title>How to pass parameters dynamically</title>
		<link>http://sqlhelp.wordpress.com/2009/11/15/how-pass-parameters-dynamically/</link>
		<comments>http://sqlhelp.wordpress.com/2009/11/15/how-pass-parameters-dynamically/#comments</comments>
		<pubDate>Sun, 15 Nov 2009 12:51:33 +0000</pubDate>
		<dc:creator>Raghunath Bhandari</dc:creator>
				<category><![CDATA[Parameters dynamically]]></category>
		<category><![CDATA[Best way to call procedure]]></category>
		<category><![CDATA[COALESCE]]></category>
		<category><![CDATA[How pass parameters dynamically]]></category>
		<category><![CDATA[MSQL tips]]></category>
		<category><![CDATA[Optional parameter in SQL]]></category>
		<category><![CDATA[SQL Server]]></category>

		<guid isPermaLink="false">http://sqlhelp.wordpress.com/?p=387</guid>
		<description><![CDATA[How to pass parameters dynamically?
MS-SQL has many features to call the procedure from other application and from SQL itself, See the example.
Some time you need optional parameter in Procedure then assign null as default so that it will not ask you compulsory.
CREATE PROCEDURE dbo.TESTPROCEDURE
@param1 VARCHAR(32) = NULL,
@param2 INT = NULL
AS
BEGIN
SET NOCOUNT ON 
SELECT Param1 = [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=sqlhelp.wordpress.com&blog=5672629&post=387&subd=sqlhelp&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p><strong>How to pass parameters dynamically</strong>?<br />
MS-SQL has many features to call the procedure from other application and from SQL itself, See the example.<br />
Some time you need optional parameter in Procedure then assign null as default so that it will not ask you compulsory.</p>
<p><code>CREATE PROCEDURE dbo.TESTPROCEDURE<br />
@param1 VARCHAR(32) = NULL,<br />
@param2 INT = NULL<br />
AS<br />
BEGIN<br />
SET NOCOUNT ON </code></p>
<p><code>SELECT Param1 = COALESCE<br />
(<br />
@param1,<br />
'@param1 was Blank'<br />
)</code></p>
<p><code>SELECT Param2 = COALESCE<br />
(<br />
RTRIM(@param2),<br />
'@param2 was Blank'<br />
)<br />
END<br />
GO</code></p>
<p><code>EXEC dbo.TESTPROCEDURE @param1='HELLO', @param2=1<br />
EXEC dbo.TESTPROCEDURE @param1='HELLO'<br />
EXEC dbo.TESTPROCEDURE @param2=1<br />
EXEC dbo.TESTPROCEDURE 'HELLO',1<br />
EXEC dbo.TESTPROCEDURE 'HELLO</code></p>
<blockquote><p>There are so many way to get the result from procedure, Choose any of them which you like.</p></blockquote>
  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/sqlhelp.wordpress.com/387/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/sqlhelp.wordpress.com/387/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/sqlhelp.wordpress.com/387/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/sqlhelp.wordpress.com/387/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/sqlhelp.wordpress.com/387/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/sqlhelp.wordpress.com/387/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/sqlhelp.wordpress.com/387/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/sqlhelp.wordpress.com/387/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/sqlhelp.wordpress.com/387/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/sqlhelp.wordpress.com/387/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=sqlhelp.wordpress.com&blog=5672629&post=387&subd=sqlhelp&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://sqlhelp.wordpress.com/2009/11/15/how-pass-parameters-dynamically/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/344460fcb9807a37c97174a2edc9d970?s=96&#38;d=identicon" medium="image">
			<media:title type="html">Raghunath Bhandari</media:title>
		</media:content>
	</item>
		<item>
		<title>Table Row in String</title>
		<link>http://sqlhelp.wordpress.com/2009/10/29/table-row-in-string/</link>
		<comments>http://sqlhelp.wordpress.com/2009/10/29/table-row-in-string/#comments</comments>
		<pubDate>Thu, 29 Oct 2009 11:58:42 +0000</pubDate>
		<dc:creator>Raghunath Bhandari</dc:creator>
				<category><![CDATA[Table Row in String]]></category>
		<category><![CDATA[COALESCE]]></category>
		<category><![CDATA[How to create a row data as string.]]></category>
		<category><![CDATA[MSSQL tisp]]></category>
		<category><![CDATA[MSSQL tricks]]></category>
		<category><![CDATA[Multiple value in single String]]></category>
		<category><![CDATA[SQL help]]></category>
		<category><![CDATA[String creation]]></category>

		<guid isPermaLink="false">http://sqlhelp.wordpress.com/?p=377</guid>
		<description><![CDATA[How to create the row data as string.
If you have table row data and you need to show all the records in a single string, use the following query.
DATA:
--------------------
Name
RAM
SHYAM
HARI
RITA

RESULT:
---------------------
Name
RAM,SHYAM,HARI,RITA

Use the following query
------------------------------------
DECLARE @strList varchar(100)
SELECT @strList = COALESCE(@strList + ', ', '') +
 CAST(Name AS varchar(5))
FROM TABLE1

SELECT @strList
There are complex example in internet but you can [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=sqlhelp.wordpress.com&blog=5672629&post=377&subd=sqlhelp&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p><strong>How to create the row data as string.</strong></p>
<p>If you have table row data and you need to show all the records in a single string, use the following query.</p>
<pre><strong>DATA:</strong>
--------------------
<code>Name
RAM
SHYAM
HARI
RITA</code>

<strong>RESULT</strong>:
---------------------
<code>Name
RAM,SHYAM,HARI,RITA</code>

Use the following query
------------------------------------
<code>DECLARE @strList varchar(100)
SELECT @strList = COALESCE(@strList + ', ', '') +
 CAST(Name AS varchar(5))
FROM TABLE1

SELECT @strList</code></pre>
<p>There are complex example in internet but you can use this simple query to get this solutions. No need to use complex cursor to get such result.</p>
  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/sqlhelp.wordpress.com/377/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/sqlhelp.wordpress.com/377/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/sqlhelp.wordpress.com/377/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/sqlhelp.wordpress.com/377/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/sqlhelp.wordpress.com/377/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/sqlhelp.wordpress.com/377/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/sqlhelp.wordpress.com/377/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/sqlhelp.wordpress.com/377/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/sqlhelp.wordpress.com/377/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/sqlhelp.wordpress.com/377/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=sqlhelp.wordpress.com&blog=5672629&post=377&subd=sqlhelp&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://sqlhelp.wordpress.com/2009/10/29/table-row-in-string/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/344460fcb9807a37c97174a2edc9d970?s=96&#38;d=identicon" medium="image">
			<media:title type="html">Raghunath Bhandari</media:title>
		</media:content>
	</item>
		<item>
		<title>How to parametrize OPENQUERY in MSSQL</title>
		<link>http://sqlhelp.wordpress.com/2009/10/07/how-to-parametrize-openquery-in-mssql/</link>
		<comments>http://sqlhelp.wordpress.com/2009/10/07/how-to-parametrize-openquery-in-mssql/#comments</comments>
		<pubDate>Wed, 07 Oct 2009 07:17:19 +0000</pubDate>
		<dc:creator>Raghunath Bhandari</dc:creator>
				<category><![CDATA[Parametrize OPENQUERY]]></category>
		<category><![CDATA[How to parametrize OPENQUERY in MSSQL]]></category>
		<category><![CDATA[Linked server]]></category>
		<category><![CDATA[Microsoft SQL server]]></category>
		<category><![CDATA[MSSQL tricks]]></category>
		<category><![CDATA[OPENQUERY]]></category>
		<category><![CDATA[parametrize query]]></category>
		<category><![CDATA[Tips]]></category>

		<guid isPermaLink="false">http://sqlhelp.wordpress.com/?p=373</guid>
		<description><![CDATA[How to parametrize OPENQUERY in MSSQL:
MSSQL has good feature of linked server between two different Database in same location or in remote location.
OPENQUERY helps you to execute your query in Linked server (remote) .
In linked server you can directly execute your query without OPENQUERY but the performance will be a issue.
As per my experience OPENQUERY [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=sqlhelp.wordpress.com&blog=5672629&post=373&subd=sqlhelp&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p><strong>How to parametrize OPENQUERY in MSSQL:</strong></p>
<p>MSSQL has good feature of linked server between two different Database in same location or in remote location.<br />
OPENQUERY helps you to execute your query in Linked server (remote) .</p>
<p>In linked server you can directly execute your query without OPENQUERY but the performance will be a issue.</p>
<p>As per my experience OPENQUERY is best way to access the linked servers.</p>
<p><strong>If you want to pass your variable in OPENQUERY than it is so simple. Use the following way to pass your variable in OPENQUERY. </strong></p>
<p><strong><br />
</strong></p>
<p><code>DECLARE @strDate VARCHAR(10)<br />
DECLARE @strSql VARCHAR(8000)<br />
DECLARE @strLinked VARCHAR(8000)</code></p>
<p><code>SET @strDate= '2009-01-01'</code></p>
<p><code>SET @strSsql= 'SELECT * FROM TABLE1 WHERE TRN_DATE =' + '''' + '''' + @strDate+ '''' + ''''</code></p>
<p><code>SET @strLinked= 'SELECT * FROM OPENQUERY(MYLINKEDSERVER,' + '''' + @strSql+ '''' + ')'</code></p>
<p><code>--############ Print and see your script</code><br />
<code>PRINT @strLinked</code></p>
<p><code>--############ Final Execution</code><br />
<code>EXEC(@strLinked)</code></p>
<p><strong>As per MSDN:</strong></p>
<p>Executes the specified pass-through query on the specified linked server. This server is an OLE DB data source. OPENQUERY can be referenced in the FROM clause of a query as if it were a table name. OPENQUERY can also be referenced as the target table of an INSERT, UPDATE, or DELETE statement. This is subject to the capabilities of the OLE DB provider. Although the query may return multiple result sets, OPENQUERY returns only the first one.</p>
  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/sqlhelp.wordpress.com/373/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/sqlhelp.wordpress.com/373/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/sqlhelp.wordpress.com/373/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/sqlhelp.wordpress.com/373/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/sqlhelp.wordpress.com/373/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/sqlhelp.wordpress.com/373/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/sqlhelp.wordpress.com/373/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/sqlhelp.wordpress.com/373/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/sqlhelp.wordpress.com/373/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/sqlhelp.wordpress.com/373/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=sqlhelp.wordpress.com&blog=5672629&post=373&subd=sqlhelp&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://sqlhelp.wordpress.com/2009/10/07/how-to-parametrize-openquery-in-mssql/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/344460fcb9807a37c97174a2edc9d970?s=96&#38;d=identicon" medium="image">
			<media:title type="html">Raghunath Bhandari</media:title>
		</media:content>
	</item>
		<item>
		<title>How to find date name in MSSQL</title>
		<link>http://sqlhelp.wordpress.com/2009/08/10/how-to-find-date-name/</link>
		<comments>http://sqlhelp.wordpress.com/2009/08/10/how-to-find-date-name/#comments</comments>
		<pubDate>Mon, 10 Aug 2009 09:46:08 +0000</pubDate>
		<dc:creator>Raghunath Bhandari</dc:creator>
				<category><![CDATA[How to find Date Name]]></category>
		<category><![CDATA[datename]]></category>
		<category><![CDATA[dateName function in SQL]]></category>
		<category><![CDATA[dw]]></category>
		<category><![CDATA[getdate(0]]></category>
		<category><![CDATA[How to find Date Name in MSSQL]]></category>
		<category><![CDATA[how to return date name in SQL]]></category>
		<category><![CDATA[how to return dayname in SQL]]></category>
		<category><![CDATA[how to return weekday in SQL]]></category>

		<guid isPermaLink="false">http://sqlhelp.wordpress.com/?p=367</guid>
		<description><![CDATA[How to find Date Name in MSSQL:
if you want to return a weekday or date name of particular date then it is so simple in MSSQL.

See the example:
select DATENAME(dw , getDate())

This query returns today&#8217;s date name like Sunday, Monday etc.
You can pass &#8220;dw&#8221; or &#8220;weekday&#8221; as a first parameter to date name which specifies the [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=sqlhelp.wordpress.com&blog=5672629&post=367&subd=sqlhelp&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p><strong>How to find Date Name in MSSQL:</strong></p>
<p><strong></strong>if you want to return a weekday or date name of particular date then it is so simple in MSSQL.<br />
<strong><br />
See the example:</strong></p>
<p><code>select DATENAME(dw , getDate())<br />
</code><br />
This query returns today&#8217;s date name like Sunday, Monday etc.</p>
<p>You can pass &#8220;dw&#8221; or &#8220;weekday&#8221; as a first parameter to date name which specifies the part of date returned.</p>
  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/sqlhelp.wordpress.com/367/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/sqlhelp.wordpress.com/367/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/sqlhelp.wordpress.com/367/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/sqlhelp.wordpress.com/367/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/sqlhelp.wordpress.com/367/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/sqlhelp.wordpress.com/367/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/sqlhelp.wordpress.com/367/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/sqlhelp.wordpress.com/367/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/sqlhelp.wordpress.com/367/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/sqlhelp.wordpress.com/367/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=sqlhelp.wordpress.com&blog=5672629&post=367&subd=sqlhelp&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://sqlhelp.wordpress.com/2009/08/10/how-to-find-date-name/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/344460fcb9807a37c97174a2edc9d970?s=96&#38;d=identicon" medium="image">
			<media:title type="html">Raghunath Bhandari</media:title>
		</media:content>
	</item>
		<item>
		<title>How to delete the MSSQL transaction log.</title>
		<link>http://sqlhelp.wordpress.com/2009/08/09/how-to-delete-the-mssql-transaction-log/</link>
		<comments>http://sqlhelp.wordpress.com/2009/08/09/how-to-delete-the-mssql-transaction-log/#comments</comments>
		<pubDate>Sun, 09 Aug 2009 13:34:35 +0000</pubDate>
		<dc:creator>Raghunath Bhandari</dc:creator>
				<category><![CDATA[How to delete the MSSQL transaction log.]]></category>
		<category><![CDATA[Advance query]]></category>
		<category><![CDATA[BACKUP LOG]]></category>
		<category><![CDATA[Database tricks]]></category>
		<category><![CDATA[DBA jobs]]></category>
		<category><![CDATA[DBCC]]></category>
		<category><![CDATA[DBCC SHRINKFILE]]></category>
		<category><![CDATA[How to check file size from query]]></category>
		<category><![CDATA[MSSQL LOG BACKUP]]></category>
		<category><![CDATA[step to clean your LOG size]]></category>
		<category><![CDATA[Tips]]></category>
		<category><![CDATA[tricks]]></category>

		<guid isPermaLink="false">http://sqlhelp.wordpress.com/?p=361</guid>
		<description><![CDATA[How to delete the MSSQL transaction log.
If your transaction log is big or too much large. it will utilize your space and other issue might be there, so you need to clean up the transaction log time to time. Follow the following steps and clean your LOG size.
1)  first take log backup
BACKUP LOG IMEKL TO [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=sqlhelp.wordpress.com&blog=5672629&post=361&subd=sqlhelp&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p><strong>How to delete the MSSQL transaction log.</strong></p>
<p>If your transaction log is big or too much large. it will utilize your space and other issue might be there, so you need to clean up the transaction log time to time. Follow the following steps and clean your LOG size.</p>
<p>1)  first take log backup</p>
<p><code>BACKUP LOG IMEKL TO DISK='d:\TEMP.bak' with init</code></p>
<p>2) Shrink your Database.</p>
<p><code><br />
USE TESTDB<br />
GO<br />
DBCC SHRINKFILE ('TESTDB_log', EMPTYFILE);<br />
GO<br />
</code></p>
<p><strong>From GUI mode: <em>Rclick  DB ==&gt; Task ==&gt; Shirinks ==&gt; Database ==&gt; specify size and press OK</em><br />
</strong></p>
<p>3) Now see your log and file size.</p>
<p><code><br />
SELECT name AS [File Name] , file_id, physical_name AS [Physical Name],<br />
size/128 AS [Total Size in MB],<br />
size/128.0 - CAST(FILEPROPERTY(name, 'SpaceUsed') AS int)/128.0<br />
AS [Available Space In MB]<br />
FROM sys.database_files;</code></p>
<p>MSDN:<br />
<span>You can reduce the default size of an empty file by using DBCC SHRINKFILE <em>target_size</em>. For example, if you create a 5-MB file and then shrink the file to 3 MB while the file is still empty, the default file size is set to 3 MB. This applies only to empty files that have never contained data.</span></p>
  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/sqlhelp.wordpress.com/361/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/sqlhelp.wordpress.com/361/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/sqlhelp.wordpress.com/361/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/sqlhelp.wordpress.com/361/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/sqlhelp.wordpress.com/361/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/sqlhelp.wordpress.com/361/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/sqlhelp.wordpress.com/361/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/sqlhelp.wordpress.com/361/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/sqlhelp.wordpress.com/361/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/sqlhelp.wordpress.com/361/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=sqlhelp.wordpress.com&blog=5672629&post=361&subd=sqlhelp&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://sqlhelp.wordpress.com/2009/08/09/how-to-delete-the-mssql-transaction-log/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/344460fcb9807a37c97174a2edc9d970?s=96&#38;d=identicon" medium="image">
			<media:title type="html">Raghunath Bhandari</media:title>
		</media:content>
	</item>
		<item>
		<title>Display Line Numbers In SQL Queries</title>
		<link>http://sqlhelp.wordpress.com/2009/07/10/display-line-numbers-in-sql-queries/</link>
		<comments>http://sqlhelp.wordpress.com/2009/07/10/display-line-numbers-in-sql-queries/#comments</comments>
		<pubDate>Fri, 10 Jul 2009 13:26:54 +0000</pubDate>
		<dc:creator>Raghunath Bhandari</dc:creator>
				<category><![CDATA[Display Line Numbers]]></category>
		<category><![CDATA[Display Line Numbers In SQL Queries]]></category>
		<category><![CDATA[Line number in SQL]]></category>
		<category><![CDATA[SQL 2008 line number]]></category>

		<guid isPermaLink="false">http://sqlhelp.wordpress.com/?p=356</guid>
		<description><![CDATA[Display Line Numbers In SQL Queries
By default in SQL Query analyzer line numbers are not shown.
Follow the steps below:
GOTO:  Tools =&#62; Text Editor =&#62;All Languages =&#62; General =&#62;Line Number (Select this check box).
Now when you open a “New Query” line numbers will appear.
       <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=sqlhelp.wordpress.com&blog=5672629&post=356&subd=sqlhelp&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p><strong>Display Line Numbers In SQL Queries</strong></p>
<p>By default in SQL Query analyzer line numbers are not shown.</p>
<p>Follow the steps below:</p>
<p>GOTO:  Tools =&gt; Text Editor =&gt;All Languages =&gt; General =&gt;Line Number (Select this check box).</p>
<p>Now when you open a “New Query” line numbers will appear.</p>
  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/sqlhelp.wordpress.com/356/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/sqlhelp.wordpress.com/356/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/sqlhelp.wordpress.com/356/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/sqlhelp.wordpress.com/356/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/sqlhelp.wordpress.com/356/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/sqlhelp.wordpress.com/356/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/sqlhelp.wordpress.com/356/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/sqlhelp.wordpress.com/356/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/sqlhelp.wordpress.com/356/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/sqlhelp.wordpress.com/356/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=sqlhelp.wordpress.com&blog=5672629&post=356&subd=sqlhelp&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://sqlhelp.wordpress.com/2009/07/10/display-line-numbers-in-sql-queries/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/344460fcb9807a37c97174a2edc9d970?s=96&#38;d=identicon" medium="image">
			<media:title type="html">Raghunath Bhandari</media:title>
		</media:content>
	</item>
		<item>
		<title>Saving change is not permitted</title>
		<link>http://sqlhelp.wordpress.com/2009/07/02/saving-change-is-not-permitted/</link>
		<comments>http://sqlhelp.wordpress.com/2009/07/02/saving-change-is-not-permitted/#comments</comments>
		<pubDate>Thu, 02 Jul 2009 10:38:26 +0000</pubDate>
		<dc:creator>Raghunath Bhandari</dc:creator>
				<category><![CDATA[Saving change is not permitted]]></category>
		<category><![CDATA[Permission issue to update table]]></category>
		<category><![CDATA[SQL 2008]]></category>
		<category><![CDATA[Sql 2008 Management Tools]]></category>

		<guid isPermaLink="false">http://sqlhelp.wordpress.com/?p=348</guid>
		<description><![CDATA[Saving change is not permitted
Some time if your setting changed by some one then you can not update table in MSSQL 2008.
you will see the below error:
&#8220;A table that can not be re-created or enabled the options prevent saving changes.
Sql 2008 Management Tools: Can&#8217;t save changes that require Recreation of Database&#8221;
That time you need to [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=sqlhelp.wordpress.com&blog=5672629&post=348&subd=sqlhelp&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p><strong>Saving change is not permitted</strong></p>
<p>Some time if your setting changed by some one then you can not update table in MSSQL 2008.<br />
you will see the below error:</p>
<blockquote><p>&#8220;A table that can not be re-created or enabled the options prevent saving changes.<br />
Sql 2008 Management Tools: Can&#8217;t save changes that require Recreation of Database&#8221;</p></blockquote>
<p>That time you need to update your setting.</p>
<p>The fix is:</p>
<p><strong>Go to Tools =&gt; Options =&gt; Designers =&gt;Tables and Designers and uncheck the <em>Prevent Saving Changes</em> <em>that require table re-creation </em>option:</strong></p>
<p>As it is, reverting back to the &#8216;old&#8217; behavior now doesn&#8217;t let you know that a table recreate is required either, so the behavior now is the same as was with the old tools. Here Microsoft added some useful functionality and then UI fails to expose it intelligently.</p>
  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/sqlhelp.wordpress.com/348/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/sqlhelp.wordpress.com/348/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/sqlhelp.wordpress.com/348/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/sqlhelp.wordpress.com/348/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/sqlhelp.wordpress.com/348/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/sqlhelp.wordpress.com/348/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/sqlhelp.wordpress.com/348/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/sqlhelp.wordpress.com/348/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/sqlhelp.wordpress.com/348/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/sqlhelp.wordpress.com/348/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=sqlhelp.wordpress.com&blog=5672629&post=348&subd=sqlhelp&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://sqlhelp.wordpress.com/2009/07/02/saving-change-is-not-permitted/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/344460fcb9807a37c97174a2edc9d970?s=96&#38;d=identicon" medium="image">
			<media:title type="html">Raghunath Bhandari</media:title>
		</media:content>
	</item>
		<item>
		<title>MERGE (Transact-SQL)</title>
		<link>http://sqlhelp.wordpress.com/2009/07/01/merge-transact-sql/</link>
		<comments>http://sqlhelp.wordpress.com/2009/07/01/merge-transact-sql/#comments</comments>
		<pubDate>Wed, 01 Jul 2009 11:54:01 +0000</pubDate>
		<dc:creator>Raghunath Bhandari</dc:creator>
				<category><![CDATA[MERGE (Transact-SQL 2008)]]></category>
		<category><![CDATA[How to use MERGE in SQL]]></category>
		<category><![CDATA[Multiple TSQL in SAME Query]]></category>
		<category><![CDATA[New SQL features]]></category>
		<category><![CDATA[Raghunath Bhandari]]></category>

		<guid isPermaLink="false">http://sqlhelp.wordpress.com/?p=343</guid>
		<description><![CDATA[MERGE (Transact-SQL 2008)

 
MERGE is new feature , it Performs insert, update, or delete operations on a target table based on the results of a join with a source table. For example, you can synchronize two tables by inserting, updating, or deleting rows in one table based on differences found in the other table.
Examples  [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=sqlhelp.wordpress.com&blog=5672629&post=343&subd=sqlhelp&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><div><strong>MERGE (Transact-SQL 2008)</strong></div>
<p><!--Content type: DocStudio. Transform: devdiv2mtps.xslt.--></p>
<p><span> </span></p>
<p>MERGE is new feature , it Performs insert, update, or delete operations on a target table based on the results of a join with a source table. For example, you can synchronize two tables by inserting, updating, or deleting rows in one table based on differences found in the other table.</p>
<p><strong>Examples </strong> <a id="sectionToggle2"></a></p>
<p><code>CREATE TABLE TABLE1<br />
(<br />
Monthid INTEGER,<br />
Month_Name VARCHAR(15)<br />
)<br />
GO<br />
INSERT INTO TABLE1<br />
VALUES(1,'JAN')<br />
INSERT INTO TABLE1<br />
VALUES(2,'FEB')<br />
INSERT INTO TABLE1<br />
VALUES(3,'MAR')<br />
INSERT INTO TABLE1<br />
VALUES(4,'APR')<br />
INSERT INTO TABLE1<br />
VALUES(5,'MAY')<br />
GO</code></p>
<p><code>CREATE TABLE TABLE2<br />
(<br />
Monthid INTEGER,<br />
Month_Name VARCHAR(15)<br />
)<br />
GO<br />
INSERT INTO TABLE2<br />
VALUES(1,'JAN')<br />
INSERT INTO TABLE2<br />
VALUES(6,'JUNE')<br />
INSERT INTO TABLE2<br />
VALUES(7,'JULY')</code><br />
<code><br />
select * from TABLE2<br />
select * from TABLE1</code></p>
<p><code>MERGE TABLE1 AS t1<br />
USING (SELECT Monthid,Month_Name FROM TABLE2) AS t2<br />
ON t1.Monthid = t2.Monthid<br />
WHEN MATCHED AND t1.Monthid &gt; 8 THEN DELETE<br />
WHEN MATCHED THEN UPDATE SET t1.Monthid = t2.Monthid<br />
WHEN NOT MATCHED THEN<br />
INSERT(Monthid,Month_Name)<br />
VALUES(Monthid,Month_Name);<br />
GO<br />
</code><br />
<strong>MSDN:<br />
Using MERGE to perform INSERT and UPDATE operations on a table in a single statement</strong></p>
<p>A common scenario is updating one or more columns in a table if a matching row exists, or inserting the data as a new row if a matching row does not exist. This is usually done by passing parameters to a stored procedure that contains the appropriate UPDATE and INSERT statements. With the MERGE statement, you can perform both tasks in a single statement. The following example shows a stored procedure that contains both an INSERT statement and an UPDATE statement. The procedure is then modified to perform the equivalent operations by using a single MERGE statement.</p>
  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/sqlhelp.wordpress.com/343/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/sqlhelp.wordpress.com/343/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/sqlhelp.wordpress.com/343/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/sqlhelp.wordpress.com/343/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/sqlhelp.wordpress.com/343/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/sqlhelp.wordpress.com/343/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/sqlhelp.wordpress.com/343/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/sqlhelp.wordpress.com/343/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/sqlhelp.wordpress.com/343/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/sqlhelp.wordpress.com/343/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=sqlhelp.wordpress.com&blog=5672629&post=343&subd=sqlhelp&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://sqlhelp.wordpress.com/2009/07/01/merge-transact-sql/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/344460fcb9807a37c97174a2edc9d970?s=96&#38;d=identicon" medium="image">
			<media:title type="html">Raghunath Bhandari</media:title>
		</media:content>
	</item>
		<item>
		<title>CREATE TYPE TABLE (Transact-SQL 2008)</title>
		<link>http://sqlhelp.wordpress.com/2009/06/28/create-type-table-transact-sql-2008/</link>
		<comments>http://sqlhelp.wordpress.com/2009/06/28/create-type-table-transact-sql-2008/#comments</comments>
		<pubDate>Sun, 28 Jun 2009 11:49:32 +0000</pubDate>
		<dc:creator>Raghunath Bhandari</dc:creator>
				<category><![CDATA[CREATE TYPE TABLE]]></category>
		<category><![CDATA[Author Raghunath Bhandari]]></category>
		<category><![CDATA[Create Type MyTable as TABLE]]></category>
		<category><![CDATA[how to use the Table UDT]]></category>
		<category><![CDATA[how to use Type Table in SQL 2008]]></category>
		<category><![CDATA[MS SQL new feature Create  type table]]></category>
		<category><![CDATA[New feature in SQL 2008]]></category>
		<category><![CDATA[SQL 2008]]></category>
		<category><![CDATA[Table UDT]]></category>
		<category><![CDATA[Table UDT as a parameter in SQL Stored Procedure.]]></category>

		<guid isPermaLink="false">http://sqlhelp.wordpress.com/?p=338</guid>
		<description><![CDATA[CREATE TYPE TABLE (Transact-SQL 2008)
Create TYPE  Table is new opotion in SQL2008. It is very easy to handle and good to use in TSQ.
This is good as compare to TEMP Table.
Here is the Example:
Create Type MyTable as TABLE
(
ID INT IDENTITY (1,1),
NAME varchar(20),
ADRES VARCHAR(200)
)

DECLARE @T AS MyTable;

INSERT INTO @T( NAME, ADRES) VALUES( 'RAGHU', 'KTM' )
INSERT INTO [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=sqlhelp.wordpress.com&blog=5672629&post=338&subd=sqlhelp&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p><strong>CREATE TYPE TABLE (Transact-SQL 2008)</strong></p>
<p>Create TYPE  Table is new opotion in SQL2008. It is very easy to handle and good to use in TSQ.<br />
This is good as compare to TEMP Table.</p>
<p><strong>Here is the Example:</strong><br />
<code>Create Type MyTable as TABLE<br />
(<br />
ID INT IDENTITY (1,1),<br />
NAME varchar(20),<br />
ADRES VARCHAR(200)<br />
)<br />
</code><br />
<code>DECLARE @T AS MyTable;</code><br />
<code><br />
INSERT INTO @T( NAME, ADRES) VALUES( 'RAGHU', 'KTM' )<br />
INSERT INTO @T( NAME, ADRES) VALUES( 'RAGHU', 'KTM' )<br />
INSERT INTO @T( NAME, ADRES) VALUES( 'RAGHU', 'KTM' )<br />
INSERT INTO @T( NAME, ADRES) VALUES( 'RAGHU', 'KTM' )</code></p>
<p><code><br />
SELECT * FROM @T ;<br />
DROP TYPE MyTable;<br />
</code></p>
<p>Many a times, we need to utilize a single Stored Procedure to update multiple database tables with one-to-many relationships. In such occasions, we end up concatenating large strings, and inside the procedure, end up parsing the string to get records. With SQL Server 2008, it is very simple, and we no more need to write tons of lines of code to implement such requirements.</p>
<p><code>CREATE PROC dbo.sp_GetOrders<br />
(@T AS dbo.tbl_Order READONLY)<br />
AS<br />
SELECT O.OrderID, O.OrderDate, O.CustomerID<br />
FROM dbo.tbl_Order AS O JOIN @T AS T ON<br />
O.OrderID = T. OrderID<br />
ORDER BY T. RecordID;<br />
GO</code><br />
<code><br />
DECLARE @MyOrderIDs AS dbo.tbl_Order;<br />
INSERT INTO @MyOrderIDs(pos, orderid) VALUES(1, 10248)<br />
INSERT INTO @MyOrderIDs(pos, orderid) VALUES(2, 10250)<br />
INSERT INTO @MyOrderIDs(pos, orderid) VALUES(3, 10249);</code></p>
<p><code><br />
EXEC dbo.sp_GetOrders @T = @MyOrderIDs;<br />
</code></p>
<p>This example shows  how to use the <code>Table</code> UDT as a parameter in SQL Stored Procedure.<br />
Hope you enjoyed this feature. Happy Programming.</p>
  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/sqlhelp.wordpress.com/338/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/sqlhelp.wordpress.com/338/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/sqlhelp.wordpress.com/338/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/sqlhelp.wordpress.com/338/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/sqlhelp.wordpress.com/338/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/sqlhelp.wordpress.com/338/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/sqlhelp.wordpress.com/338/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/sqlhelp.wordpress.com/338/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/sqlhelp.wordpress.com/338/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/sqlhelp.wordpress.com/338/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=sqlhelp.wordpress.com&blog=5672629&post=338&subd=sqlhelp&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://sqlhelp.wordpress.com/2009/06/28/create-type-table-transact-sql-2008/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/344460fcb9807a37c97174a2edc9d970?s=96&#38;d=identicon" medium="image">
			<media:title type="html">Raghunath Bhandari</media:title>
		</media:content>
	</item>
		<item>
		<title>Find All SQL Server Instance Running in Local Network</title>
		<link>http://sqlhelp.wordpress.com/2009/04/27/find-all-sql-server-instance-running-in-local-network/</link>
		<comments>http://sqlhelp.wordpress.com/2009/04/27/find-all-sql-server-instance-running-in-local-network/#comments</comments>
		<pubDate>Mon, 27 Apr 2009 09:50:53 +0000</pubDate>
		<dc:creator>Raghunath Bhandari</dc:creator>
				<category><![CDATA[SQL Server Instance Running]]></category>
		<category><![CDATA[How to list all SQL Server Instance Running in Local Network:]]></category>
		<category><![CDATA[Instance Running]]></category>
		<category><![CDATA[MS SQL server]]></category>
		<category><![CDATA[MSSQL tips]]></category>
		<category><![CDATA[MSSQL tricks]]></category>
		<category><![CDATA[Raghunath Bhandari]]></category>

		<guid isPermaLink="false">http://sqlhelp.wordpress.com/?p=332</guid>
		<description><![CDATA[How to list all SQL Server Instance Running in Local Network:
Some time you need to see the List of other running SQL server on your network. It is so simple and easy to call from other application also.
See the example:
-- ######### Query
EXEC master..xp_cmdshell 'osql -L'

-- ############ Result

NULL
Servers:
    (local)
    MAIL_SERVER
 [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=sqlhelp.wordpress.com&blog=5672629&post=332&subd=sqlhelp&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p><strong>How to list all SQL Server Instance Running in Local Network:</strong><br />
Some time you need to see the List of other running SQL server on your network. It is so simple and easy to call from other application also.</p>
<p>See the example:</p>
<pre>-- ######### Query
EXEC master..xp_cmdshell 'osql -L'

-- ############ Result

NULL
Servers:
    (local)
    MAIL_SERVER
    RAGHU
    RAGHU\SQLEXPRESS
    SERVER1
NULL</pre>
<p>If you want to get the same list from Command prompt then:</p>
<p>C:\&gt; osql -L</p>
<p>it will show you the same list.</p>
  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/sqlhelp.wordpress.com/332/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/sqlhelp.wordpress.com/332/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/sqlhelp.wordpress.com/332/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/sqlhelp.wordpress.com/332/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/sqlhelp.wordpress.com/332/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/sqlhelp.wordpress.com/332/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/sqlhelp.wordpress.com/332/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/sqlhelp.wordpress.com/332/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/sqlhelp.wordpress.com/332/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/sqlhelp.wordpress.com/332/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=sqlhelp.wordpress.com&blog=5672629&post=332&subd=sqlhelp&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://sqlhelp.wordpress.com/2009/04/27/find-all-sql-server-instance-running-in-local-network/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/344460fcb9807a37c97174a2edc9d970?s=96&#38;d=identicon" medium="image">
			<media:title type="html">Raghunath Bhandari</media:title>
		</media:content>
	</item>
		<item>
		<title>MSSQL Server cursors</title>
		<link>http://sqlhelp.wordpress.com/2009/04/06/mssql-server-cursors/</link>
		<comments>http://sqlhelp.wordpress.com/2009/04/06/mssql-server-cursors/#comments</comments>
		<pubDate>Mon, 06 Apr 2009 09:57:43 +0000</pubDate>
		<dc:creator>Raghunath Bhandari</dc:creator>
				<category><![CDATA[MSSQL Server cursors]]></category>
		<category><![CDATA[Author Raghu]]></category>
		<category><![CDATA[cursors]]></category>
		<category><![CDATA[Example of cursors]]></category>
		<category><![CDATA[how to user cursors]]></category>
		<category><![CDATA[Select row by row]]></category>
		<category><![CDATA[SQL cursor]]></category>

		<guid isPermaLink="false">http://sqlhelp.wordpress.com/?p=329</guid>
		<description><![CDATA[How to use MSSQL Server cursors?
SQL Server cursors are database objects used to manipulate data in a set on a row-by-row basis. You can fetch cursor rows and perform operations on them in a loop just like using any looping mechanism found in any other programming language. Before you can use a cursor, you need [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=sqlhelp.wordpress.com&blog=5672629&post=329&subd=sqlhelp&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p><strong>How to use MSSQL Server cursors?</strong><br />
SQL Server cursors are database objects used to manipulate data in a set on a row-by-row basis. You can fetch cursor rows and perform operations on them in a loop just like using any looping mechanism found in any other programming language. Before you can use a cursor, you need to declare it.</p>
<p><strong>Example:</strong></p>
<pre><code>declare @row as varchar(20)</code>
DECLARE cur1 CURSOR FOR

SELECT rowid FROM Table1</pre>
<pre>OPEN cur1</pre>
<pre>FETCH NEXT FROM cur1 INTO @row
WHILE @@FETCH_STATUS = 0
BEGIN</pre>
<pre>    SELECT * FROM Table1 WHERE rowid = @row</pre>
<pre>    FETCH NEXT FROM cur1 INTO @row</pre>
<pre>END
CLOSE cur1
DEALLOCATE cur1</pre>
<p><strong>DECLARE CURSOR</strong></p>
<p>The DECLARE CURSOR command defines the attributes of a Transact-SQL server cursor, such as its scrolling behavior and the query used to build the result set on which the cursor operates. DECLARE CURSOR accepts both a syntax based on the SQL-92 standard and a syntax using a set of Transact-SQL extensions.</p>
  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/sqlhelp.wordpress.com/329/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/sqlhelp.wordpress.com/329/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/sqlhelp.wordpress.com/329/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/sqlhelp.wordpress.com/329/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/sqlhelp.wordpress.com/329/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/sqlhelp.wordpress.com/329/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/sqlhelp.wordpress.com/329/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/sqlhelp.wordpress.com/329/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/sqlhelp.wordpress.com/329/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/sqlhelp.wordpress.com/329/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=sqlhelp.wordpress.com&blog=5672629&post=329&subd=sqlhelp&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://sqlhelp.wordpress.com/2009/04/06/mssql-server-cursors/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/344460fcb9807a37c97174a2edc9d970?s=96&#38;d=identicon" medium="image">
			<media:title type="html">Raghunath Bhandari</media:title>
		</media:content>
	</item>
		<item>
		<title>Password Encryption and Decrypt</title>
		<link>http://sqlhelp.wordpress.com/2009/04/01/password-encryption-and-decrypt/</link>
		<comments>http://sqlhelp.wordpress.com/2009/04/01/password-encryption-and-decrypt/#comments</comments>
		<pubDate>Wed, 01 Apr 2009 06:15:26 +0000</pubDate>
		<dc:creator>Raghunath Bhandari</dc:creator>
				<category><![CDATA[Encrypt Password and Compare]]></category>
		<category><![CDATA[Easy way to check Password]]></category>
		<category><![CDATA[Insert encrypted value to a table]]></category>
		<category><![CDATA[MS SQL Password compare]]></category>
		<category><![CDATA[MSSQL builtin encrypt function]]></category>
		<category><![CDATA[MSSQL Encryption]]></category>
		<category><![CDATA[One way encryption]]></category>
		<category><![CDATA[Password encrypt function]]></category>
		<category><![CDATA[pwdcompare]]></category>
		<category><![CDATA[pwdencrypt]]></category>

		<guid isPermaLink="false">http://sqlhelp.wordpress.com/?p=325</guid>
		<description><![CDATA[How to Encrypt Password and compare?
MS SQL has its own built in function to Encrypt password or secure text and compare it. This is very simple see the Example:
&#8212;1 , Create a Table to insert.
Create table tempPassTable
(
id int,
pwd varbinary(200)
)
&#8212;2, Insert encrypted value to a table.

insert into tempPassTable(id,pwd)
select 1, pwdencrypt('abcd')
&#8212;3, Compare encrypted value and user input [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=sqlhelp.wordpress.com&blog=5672629&post=325&subd=sqlhelp&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p><strong>How to Encrypt Password and compare?</strong></p>
<p>MS SQL has its own built in function to Encrypt password or secure text and compare it. This is very simple see the Example:</p>
<p><strong>&#8212;1 , Create a Table to insert.</strong></p>
<pre>Create table tempPassTable
(
id int,
pwd varbinary(200)
)</pre>
<p><strong>&#8212;2, Insert encrypted value to a table.<br />
</strong></p>
<pre>insert into tempPassTable(id,pwd)
select 1, pwdencrypt('abcd')</pre>
<p><strong>&#8212;3, Compare encrypted value and user input value.<br />
</strong></p>
<pre>
if (select pwdcompare('abcd',pwd,0) from tempPassTable)=0
select 'Invalid Password'
else
select 'Valid Password'</pre>
<pre></pre>
  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/sqlhelp.wordpress.com/325/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/sqlhelp.wordpress.com/325/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/sqlhelp.wordpress.com/325/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/sqlhelp.wordpress.com/325/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/sqlhelp.wordpress.com/325/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/sqlhelp.wordpress.com/325/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/sqlhelp.wordpress.com/325/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/sqlhelp.wordpress.com/325/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/sqlhelp.wordpress.com/325/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/sqlhelp.wordpress.com/325/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=sqlhelp.wordpress.com&blog=5672629&post=325&subd=sqlhelp&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://sqlhelp.wordpress.com/2009/04/01/password-encryption-and-decrypt/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/344460fcb9807a37c97174a2edc9d970?s=96&#38;d=identicon" medium="image">
			<media:title type="html">Raghunath Bhandari</media:title>
		</media:content>
	</item>
		<item>
		<title>TSQL Delete on join</title>
		<link>http://sqlhelp.wordpress.com/2009/02/27/tsql-delete-on-join/</link>
		<comments>http://sqlhelp.wordpress.com/2009/02/27/tsql-delete-on-join/#comments</comments>
		<pubDate>Fri, 27 Feb 2009 09:08:25 +0000</pubDate>
		<dc:creator>Raghunath Bhandari</dc:creator>
				<category><![CDATA[TSQL Delete on join]]></category>
		<category><![CDATA[Delete statement on join]]></category>
		<category><![CDATA[MS SQL]]></category>
		<category><![CDATA[MS SQL delete on join]]></category>
		<category><![CDATA[SQL Delete on Join]]></category>
		<category><![CDATA[subquery delete]]></category>

		<guid isPermaLink="false">http://sqlhelp.wordpress.com/?p=318</guid>
		<description><![CDATA[Delete statement on join:
Some time you need to delete a table on join.
This example will help you to run delete statement on sql join.
Example:
DELETE table1
FROM table1  t1
JOIN table2 t2 ON t1.IDCOL=t2.IDCOL
This T-SQL is checking TABLE2, If records exists then delete TABLE1. Weather IDCOL is already there in TABLE2 or not?
     [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=sqlhelp.wordpress.com&blog=5672629&post=318&subd=sqlhelp&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p><strong>Delete statement on join:</strong></p>
<p>Some time you need to delete a table on join.<br />
This example will help you to run delete statement on sql join.</p>
<p><strong>Example:</strong></p>
<p><code>DELETE table1<br />
FROM </code><code>table1 </code><code> t1<br />
JOIN </code><code>table2 </code><code>t2 ON t1.IDCOL=t2.</code><code>IDCOL</code></p>
<p>This T-SQL is checking TABLE2, If records exists then delete TABLE1. Weather IDCOL is already there in TABLE2 or not?</p>
  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/sqlhelp.wordpress.com/318/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/sqlhelp.wordpress.com/318/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/sqlhelp.wordpress.com/318/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/sqlhelp.wordpress.com/318/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/sqlhelp.wordpress.com/318/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/sqlhelp.wordpress.com/318/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/sqlhelp.wordpress.com/318/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/sqlhelp.wordpress.com/318/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/sqlhelp.wordpress.com/318/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/sqlhelp.wordpress.com/318/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=sqlhelp.wordpress.com&blog=5672629&post=318&subd=sqlhelp&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://sqlhelp.wordpress.com/2009/02/27/tsql-delete-on-join/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/344460fcb9807a37c97174a2edc9d970?s=96&#38;d=identicon" medium="image">
			<media:title type="html">Raghunath Bhandari</media:title>
		</media:content>
	</item>
		<item>
		<title>How to find hard disk serial number ?</title>
		<link>http://sqlhelp.wordpress.com/2009/01/24/how-to-find-hard-disk-serial-number/</link>
		<comments>http://sqlhelp.wordpress.com/2009/01/24/how-to-find-hard-disk-serial-number/#comments</comments>
		<pubDate>Sat, 24 Jan 2009 07:44:39 +0000</pubDate>
		<dc:creator>Raghunath Bhandari</dc:creator>
				<category><![CDATA[Hard drive Serial Number]]></category>
		<category><![CDATA[Computer unique number]]></category>
		<category><![CDATA[Get Computer unique number form VB6]]></category>
		<category><![CDATA[get drive serial number]]></category>
		<category><![CDATA[getdrive serial number]]></category>
		<category><![CDATA[Hard disk serial number]]></category>
		<category><![CDATA[How to find Harddisk SerialNumber]]></category>
		<category><![CDATA[software security]]></category>
		<category><![CDATA[VB tips]]></category>
		<category><![CDATA[VB Tricks]]></category>
		<category><![CDATA[Visual Basic]]></category>
		<category><![CDATA[Visual basic code]]></category>
		<category><![CDATA[Visual Basic Tips]]></category>

		<guid isPermaLink="false">http://sqlhelp.wordpress.com/?p=302</guid>
		<description><![CDATA[How to find hard disk serial number ?
If you want to get the  hard drive serial number or computer unique number then use this function.
&#8216;Computer Unique No or hard drive serial number From Visual Basic
Private Declare Function GetVolumeInformation _
Lib "kernel32.dll" _
Alias "GetVolumeInformationA" _
(ByVal lpRootPathName As String, _
ByVal lpVolumeNameBuffer As String, _
ByVal nVolumeNameSize As Integer, [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=sqlhelp.wordpress.com&blog=5672629&post=302&subd=sqlhelp&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p><strong>How to find hard disk serial number ?</strong></p>
<p>If you want to get the  hard drive serial number or computer unique number then use this function.</p>
<p>&#8216;Computer Unique No or hard drive serial number From Visual Basic</p>
<pre>Private Declare Function GetVolumeInformation _
Lib "kernel32.dll" _
Alias "GetVolumeInformationA" _
(ByVal lpRootPathName As String, _
ByVal lpVolumeNameBuffer As String, _
ByVal nVolumeNameSize As Integer, _
lpVolumeSerialNumber As Long, _
lpMaximumComponentLength As Long, _
lpFileSystemFlags As Long, _
ByVal lpFileSystemNameBuffer As String, _
ByVal nFileSystemNameSize As Long) As Long</pre>
<p><strong>This Function will return serial number of a Drive</strong></p>
<pre>Public Function GetSerialNumber(DriveLetter As String) As String
Dim SerialNum As Long
Dim VolNameBuf As String
Dim FileSysNameBuf As String

Select Case Len(DriveLetter)
Case 1
If DriveLetter Like "[a-z]" Then
DriveLetter = Left$(DriveLetter, 1) &amp; ":\"
Else
GetSerialNumber = "Error - Bad drive designation"
End If
Case 2
If LCase(DriveLetter) Like "[a-z]:" Then
DriveLetter = DriveLetter &amp; "\"
Else
GetSerialNumber = "Error - Bad drive designation"
End If
Case 3
If LCase(DriveLetter) Like "[!a-z]:\" Then
GetSerialNumber = "Error - Bad drive designation"
End If
Case Else
GetSerialNumber = "Error - Bad drive designation"
End Select
If Len(GetSerialNumber) = 0 Then
VolNameBuf = String$(255, Chr$(0))
FileSysNameBuf = String$(255, Chr$(0))
GetVolumeInformation DriveLetter, VolNameBuf, _
Len(VolNameBuf), SerialNum, 0, 0, _
FileSysNameBuf, Len(FileSysNameBuf)
GetSerialNumber = Right$("00000000" &amp; Hex$(SerialNum), <img src='http://s.wordpress.com/wp-includes/images/smilies/icon_cool.gif' alt='8)' class='wp-smiley' />
End If
End Function</pre>
<blockquote><p>This is good for security purpose. some time if you want to run your EXE file on some computer only then this is the best way.</p></blockquote>
  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/sqlhelp.wordpress.com/302/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/sqlhelp.wordpress.com/302/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/sqlhelp.wordpress.com/302/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/sqlhelp.wordpress.com/302/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/sqlhelp.wordpress.com/302/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/sqlhelp.wordpress.com/302/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/sqlhelp.wordpress.com/302/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/sqlhelp.wordpress.com/302/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/sqlhelp.wordpress.com/302/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/sqlhelp.wordpress.com/302/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=sqlhelp.wordpress.com&blog=5672629&post=302&subd=sqlhelp&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://sqlhelp.wordpress.com/2009/01/24/how-to-find-hard-disk-serial-number/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/344460fcb9807a37c97174a2edc9d970?s=96&#38;d=identicon" medium="image">
			<media:title type="html">Raghunath Bhandari</media:title>
		</media:content>
	</item>
		<item>
		<title>Send SMS using AT command</title>
		<link>http://sqlhelp.wordpress.com/2009/01/24/send-sms-using-at-command/</link>
		<comments>http://sqlhelp.wordpress.com/2009/01/24/send-sms-using-at-command/#comments</comments>
		<pubDate>Sat, 24 Jan 2009 06:47:38 +0000</pubDate>
		<dc:creator>Raghunath Bhandari</dc:creator>
				<category><![CDATA[Send SMS using AT command]]></category>
		<category><![CDATA[1]]></category>
		<category><![CDATA[8]]></category>
		<category><![CDATA[AT command]]></category>
		<category><![CDATA[AT command to send sms]]></category>
		<category><![CDATA[AT Commands]]></category>
		<category><![CDATA[AT+CMGF=1]]></category>
		<category><![CDATA[AT+CMGR]]></category>
		<category><![CDATA[GSM modem]]></category>
		<category><![CDATA[How to send SMS using AT commands]]></category>
		<category><![CDATA[MSComm1]]></category>
		<category><![CDATA[MSComm1.PortOpen = True]]></category>
		<category><![CDATA[MSComm1.Settings = "9600]]></category>
		<category><![CDATA[N]]></category>
		<category><![CDATA[send SMS]]></category>
		<category><![CDATA[SMS from GSM modem]]></category>
		<category><![CDATA[Use MScomm library]]></category>
		<category><![CDATA[VB code to send sms]]></category>
		<category><![CDATA[VB Tricks and Tips]]></category>
		<category><![CDATA[VB6 code to send sms]]></category>
		<category><![CDATA[Visual basic code to send sms]]></category>
		<category><![CDATA[Visual Basic Tips]]></category>
		<category><![CDATA[Visual Basic Tricks]]></category>

		<guid isPermaLink="false">http://sqlhelp.wordpress.com/?p=292</guid>
		<description><![CDATA[Send SMS using GSM modem from your computer. This Example shows you to use AT command to handle the GSM modem.
Try this to send SMS using this example.
1- Insert a form in VB project
2- Insert textbox (txtMsg,txtDestinationNumber)
3- Insert command button (Command1)
4- Insert a MSComm1
5- Connect your mobile phone in computer with datacable
Private Sub Command1_Click()
Call SENDSMS
End [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=sqlhelp.wordpress.com&blog=5672629&post=292&subd=sqlhelp&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p>Send SMS using GSM modem from your computer. This Example shows you to use AT command to handle the GSM modem.<br />
<strong>Try this to send SMS using this example.</strong></p>
<p>1- Insert a form in VB project<br />
2- Insert textbox (txtMsg,txtDestinationNumber)<br />
3- Insert command button (Command1)<br />
4- Insert a MSComm1<br />
5- Connect your mobile phone in computer with datacable</p>
<pre>Private Sub Command1_Click()
Call SENDSMS
End Sub

Sub SENDSMS()
On Error GoTo Errr:
If MsgBox("Are you sure to send SMS Message", vbYesNo) = vbNo Then
    Exit Sub
End If</pre>
<pre>' Set up the communications port
MSComm1.CommPort = 5 ' Com Port 5</pre>
<pre>' Set for 9600 baud, no parity, 8 data, and 1 stop bit.
MSComm1.Settings = "9600,N,8,1"
MSComm1.InputLen = 0
MSComm1.PortOpen = True
MSComm1.Output = "AT" &amp; Chr$(13)</pre>
<pre>' Set up the phone for a text message
MSComm1.Output = "AT+CMGF=1" &amp; Chr$(13)
MSComm1.Output = "AT+CMGS= " &amp; Chr(34) &amp; txtDestinationNumber.Text &amp; Chr(34) &amp; Chr$(13) &amp; Chr(10)
MSComm1.Output = txtMsg.Text &amp; Chr$(26)
MSComm1.PortOpen = False
MsgBox "Message Sent successfully"
Exit Sub</pre>
<pre>Errr:</pre>
<pre>MsgBox Err.Description &amp; Err.Number, vbExclamation

End Sub</pre>
  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/sqlhelp.wordpress.com/292/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/sqlhelp.wordpress.com/292/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/sqlhelp.wordpress.com/292/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/sqlhelp.wordpress.com/292/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/sqlhelp.wordpress.com/292/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/sqlhelp.wordpress.com/292/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/sqlhelp.wordpress.com/292/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/sqlhelp.wordpress.com/292/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/sqlhelp.wordpress.com/292/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/sqlhelp.wordpress.com/292/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=sqlhelp.wordpress.com&blog=5672629&post=292&subd=sqlhelp&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://sqlhelp.wordpress.com/2009/01/24/send-sms-using-at-command/feed/</wfw:commentRss>
		<slash:comments>6</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/344460fcb9807a37c97174a2edc9d970?s=96&#38;d=identicon" medium="image">
			<media:title type="html">Raghunath Bhandari</media:title>
		</media:content>
	</item>
		<item>
		<title>NULLIF (Transact-SQL)</title>
		<link>http://sqlhelp.wordpress.com/2009/01/23/nullif-transact-sql/</link>
		<comments>http://sqlhelp.wordpress.com/2009/01/23/nullif-transact-sql/#comments</comments>
		<pubDate>Fri, 23 Jan 2009 11:32:39 +0000</pubDate>
		<dc:creator>Raghunath Bhandari</dc:creator>
				<category><![CDATA[NULLIF (Transact-SQL)]]></category>
		<category><![CDATA[difference between nullif and case]]></category>
		<category><![CDATA[MS SQL tricks]]></category>
		<category><![CDATA[SQL help]]></category>
		<category><![CDATA[SQL Tips]]></category>
		<category><![CDATA[use of nullif]]></category>

		<guid isPermaLink="false">http://sqlhelp.wordpress.com/?p=284</guid>
		<description><![CDATA[How to use NULLIF (Transact-SQL)
NULLIF will Return a null value if the two specified expressions are equal. If you want to compare to fields and then this will work for you like :
Run these examples and you can see how to use it on your way.
Select NULLIF('aa','aa')
Select isnull( NULLIF('aa','aa'),'right')
MSDN is comparing NULLIF and CASE

To show [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=sqlhelp.wordpress.com&blog=5672629&post=284&subd=sqlhelp&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p><strong>How to use NULLIF (Transact-SQL)</strong></p>
<p>NULLIF will Return a null value if the two specified expressions are equal. If you want to compare to fields and then this will work for you like :</p>
<p>Run these examples and you can see how to use it on your way.<br />
<code>Select NULLIF('aa','aa')<br />
Select isnull( NULLIF('aa','aa'),'right')</code></p>
<h3 class="subHeading">MSDN is comparing NULLIF and CASE</h3>
<div class="subSection">
<p>To show the similarity between <code>NULLIF</code> and <code>CASE</code>, the following queries evaluate whether the values in the <code>MakeFlag</code> and <code>FinishedGoodsFlag</code> columns are the same. The first query uses <code>NULLIF</code>. The second query uses the <code>CASE</code> expression.</p>
<p><code><br />
USE AdventureWorks;<br />
GO<br />
SELECT ProductID, MakeFlag, FinishedGoodsFlag,<br />
NULLIF(MakeFlag,FinishedGoodsFlag)AS 'Null if Equal'<br />
FROM Production.Product<br />
WHERE ProductID &lt; 10;<br />
GO</code></p>
<pre>SELECT ProductID, MakeFlag, FinishedGoodsFlag,'Null if Equal' =
CASE
WHEN MakeFlag = FinishedGoodsFlag THEN NULL
ELSE MakeFlag
END
FROM Production.Product
WHERE ProductID &lt; 10;
GO</pre>
<p>So NULLIF and ISNULL functions can help you on different way.</p></div>
  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/sqlhelp.wordpress.com/284/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/sqlhelp.wordpress.com/284/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/sqlhelp.wordpress.com/284/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/sqlhelp.wordpress.com/284/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/sqlhelp.wordpress.com/284/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/sqlhelp.wordpress.com/284/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/sqlhelp.wordpress.com/284/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/sqlhelp.wordpress.com/284/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/sqlhelp.wordpress.com/284/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/sqlhelp.wordpress.com/284/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=sqlhelp.wordpress.com&blog=5672629&post=284&subd=sqlhelp&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://sqlhelp.wordpress.com/2009/01/23/nullif-transact-sql/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/344460fcb9807a37c97174a2edc9d970?s=96&#38;d=identicon" medium="image">
			<media:title type="html">Raghunath Bhandari</media:title>
		</media:content>
	</item>
		<item>
		<title>Format money/decimal with commas</title>
		<link>http://sqlhelp.wordpress.com/2009/01/14/format-moneydecimal-with-commas/</link>
		<comments>http://sqlhelp.wordpress.com/2009/01/14/format-moneydecimal-with-commas/#comments</comments>
		<pubDate>Wed, 14 Jan 2009 09:04:20 +0000</pubDate>
		<dc:creator>Raghunath Bhandari</dc:creator>
				<category><![CDATA[SQL Formating]]></category>
		<category><![CDATA[CONVERT function]]></category>
		<category><![CDATA[Microsoft SQL server]]></category>
		<category><![CDATA[MSSQL]]></category>
		<category><![CDATA[MSSQL server]]></category>
		<category><![CDATA[SQL format money/decimal with commas]]></category>
		<category><![CDATA[SQL formatting]]></category>
		<category><![CDATA[SQL Server]]></category>

		<guid isPermaLink="false">http://sqlhelp.wordpress.com/?p=245</guid>
		<description><![CDATA[SQL format money/decimal with commas: 
Sometimes you want to have your money fields properly formatted with commas like this: 13,243,543.57
You can use the CONVERT function and give a value between 0 and 2 to the style and the format will be displayed based on that
Below is an example:
DECLARE @v MONEY
SELECT @v = 1322323.6666

SELECT CONVERT(VARCHAR,@v,0)  --1322323.67
Rounded [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=sqlhelp.wordpress.com&blog=5672629&post=245&subd=sqlhelp&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p><span style="font-size:small;"><strong>SQL format money/decimal with commas: </strong></span></p>
<p><span>Sometimes you want to have your money fields properly formatted with commas like this: 13,243,543.57<br />
You can use the CONVERT function and give a value between 0 and 2 to the style and the format will be displayed based on that</span></p>
<p><strong>Below is an example:</strong></p>
<pre><span>DECLARE @v MONEY
SELECT @v = 1322323.6666</span>

<span>SELECT CONVERT(VARCHAR,@v,0)  --1322323.67
Rounded but no formatting</span>

<span>SELECT CONVERT(VARCHAR,@v,1)    --1,322,323.67
Formatted with commas

SELECT CONVERT(VARCHAR,@v,2)    --1322323.6666
No formatting
</span></pre>
<p><strong><span>If you have a decimal field it doesn&#8217;t work with the convert function<br />
The work around is to convert it to money:</span></strong></p>
<pre><span>DECLARE @v2 DECIMAL (36,10)
SELECT @v2 = 13243543.56565656

SELECT CONVERT(VARCHAR,CONVERT(MONEY,@v2),1) --13,243,543.57
Formatted with commas</span></pre>
<p><span><br />
</span></p>
  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/sqlhelp.wordpress.com/245/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/sqlhelp.wordpress.com/245/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/sqlhelp.wordpress.com/245/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/sqlhelp.wordpress.com/245/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/sqlhelp.wordpress.com/245/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/sqlhelp.wordpress.com/245/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/sqlhelp.wordpress.com/245/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/sqlhelp.wordpress.com/245/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/sqlhelp.wordpress.com/245/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/sqlhelp.wordpress.com/245/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=sqlhelp.wordpress.com&blog=5672629&post=245&subd=sqlhelp&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://sqlhelp.wordpress.com/2009/01/14/format-moneydecimal-with-commas/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/344460fcb9807a37c97174a2edc9d970?s=96&#38;d=identicon" medium="image">
			<media:title type="html">Raghunath Bhandari</media:title>
		</media:content>
	</item>
		<item>
		<title>Difference with (nolock) vs (nolock) as a SQL Table Hint</title>
		<link>http://sqlhelp.wordpress.com/2009/01/14/difference-with-nolock-vs-nolock-as-a-sql-table-hint/</link>
		<comments>http://sqlhelp.wordpress.com/2009/01/14/difference-with-nolock-vs-nolock-as-a-sql-table-hint/#comments</comments>
		<pubDate>Wed, 14 Jan 2009 06:07:20 +0000</pubDate>
		<dc:creator>Raghunath Bhandari</dc:creator>
				<category><![CDATA[with (nolock) vs (nolock)]]></category>
		<category><![CDATA[Difference with (nolock) vs (nolock)]]></category>
		<category><![CDATA[FASTFIRSTROW]]></category>
		<category><![CDATA[Microsoft SQL server]]></category>
		<category><![CDATA[MSSQL]]></category>
		<category><![CDATA[MSSQL server]]></category>
		<category><![CDATA[NOEXPAND]]></category>
		<category><![CDATA[NOLOCK]]></category>
		<category><![CDATA[NOWAIT]]></category>
		<category><![CDATA[PAGLOCK]]></category>
		<category><![CDATA[READCOMMITTED]]></category>
		<category><![CDATA[READPAST]]></category>
		<category><![CDATA[READUNCOMMITTED]]></category>
		<category><![CDATA[REPEATABLEREAD]]></category>
		<category><![CDATA[ROWLOCK]]></category>
		<category><![CDATA[SERIALIZABLE]]></category>
		<category><![CDATA[SQL help]]></category>
		<category><![CDATA[SQL Server]]></category>
		<category><![CDATA[SQL Tips]]></category>
		<category><![CDATA[SQL Tricks]]></category>
		<category><![CDATA[T-SQL best way]]></category>
		<category><![CDATA[Table Hints]]></category>
		<category><![CDATA[TABLOCK]]></category>
		<category><![CDATA[TABLOCKX]]></category>
		<category><![CDATA[UPDLOCK]]></category>
		<category><![CDATA[XLOCK]]></category>

		<guid isPermaLink="false">http://sqlhelp.wordpress.com/?p=239</guid>
		<description><![CDATA[Difference with (nolock) vs (nolock) as a SQL Table Hint:
select sum(amount) from reward_expired (nolock)
difference was between using the table hint (nolock) and the table hint with (nolock).
Look at MSDN under SQL 2005,
&#8220;In SQL Server 2005, with some exceptions, table hints are supported in the FROM clause only when the hints are specified with the WITH [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=sqlhelp.wordpress.com&blog=5672629&post=239&subd=sqlhelp&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p><strong>Difference with (nolock) vs (nolock) as a SQL Table Hint:</strong></p>
<pre>select sum(amount) from reward_expired (nolock)</pre>
<p>difference was between using the table hint (nolock) and the table hint with (nolock).<br />
<strong>Look at MSDN under SQL 2005,</strong></p>
<p>&#8220;In SQL Server 2005, with some exceptions, table hints are supported in the FROM clause only when the hints are specified with the WITH keyword. Table hints also must be specified with parentheses.</p>
<p>The following table hints are allowed with and without the WITH keyword: NOLOCK, READUNCOMMITTED, UPDLOCK, REPEATABLEREAD, SERIALIZABLE, READCOMMITTED, FASTFIRSTROW, TABLOCK, TABLOCKX, PAGLOCK, ROWLOCK, NOWAIT, READPAST, XLOCK, and NOEXPAND. When these table hints are specified without the WITH keyword, the hints should be specified alone.&#8221;<br />
<strong><br />
Micorosft plan to remove the ability to use just (nolock), and to future proof all SQL, users should write all table hints using the with keyword.</strong></p>
<blockquote><p>Omitting the WITH keyword is a deprecated feature: This feature will be removed in a future version of Microsoft SQL Server. Avoid using this feature in new development work, and plan to modify applications that currently use this feature.</p></blockquote>
  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/sqlhelp.wordpress.com/239/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/sqlhelp.wordpress.com/239/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/sqlhelp.wordpress.com/239/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/sqlhelp.wordpress.com/239/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/sqlhelp.wordpress.com/239/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/sqlhelp.wordpress.com/239/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/sqlhelp.wordpress.com/239/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/sqlhelp.wordpress.com/239/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/sqlhelp.wordpress.com/239/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/sqlhelp.wordpress.com/239/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=sqlhelp.wordpress.com&blog=5672629&post=239&subd=sqlhelp&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://sqlhelp.wordpress.com/2009/01/14/difference-with-nolock-vs-nolock-as-a-sql-table-hint/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/344460fcb9807a37c97174a2edc9d970?s=96&#38;d=identicon" medium="image">
			<media:title type="html">Raghunath Bhandari</media:title>
		</media:content>
	</item>
		<item>
		<title>Table Hints (Transact-SQL)</title>
		<link>http://sqlhelp.wordpress.com/2009/01/13/table-hints-transact-sql/</link>
		<comments>http://sqlhelp.wordpress.com/2009/01/13/table-hints-transact-sql/#comments</comments>
		<pubDate>Tue, 13 Jan 2009 12:20:46 +0000</pubDate>
		<dc:creator>Raghunath Bhandari</dc:creator>
				<category><![CDATA[Table Hints]]></category>
		<category><![CDATA[and NOEXPAND]]></category>
		<category><![CDATA[FASTFIRSTROW]]></category>
		<category><![CDATA[MSSQL Table Hints]]></category>
		<category><![CDATA[NOLOCK]]></category>
		<category><![CDATA[NOWAIT]]></category>
		<category><![CDATA[PAGLOCK]]></category>
		<category><![CDATA[READCOMMITTED]]></category>
		<category><![CDATA[READPAST]]></category>
		<category><![CDATA[READUNCOMMITTED]]></category>
		<category><![CDATA[REPEATABLEREAD]]></category>
		<category><![CDATA[ROWLOCK]]></category>
		<category><![CDATA[SERIALIZABLE]]></category>
		<category><![CDATA[SQL Locks]]></category>
		<category><![CDATA[SQL Tips]]></category>
		<category><![CDATA[SQL Tricks]]></category>
		<category><![CDATA[Table Hints (Transact-SQL)]]></category>
		<category><![CDATA[TABLOCK]]></category>
		<category><![CDATA[TABLOCKX]]></category>
		<category><![CDATA[UPDLOCK]]></category>
		<category><![CDATA[XLOCK]]></category>

		<guid isPermaLink="false">http://sqlhelp.wordpress.com/?p=236</guid>
		<description><![CDATA[Table Hints (Transact-SQL)
Table hints override the default behavior of the query optimizer for the duration of the data manipulation language (DML) statement by specifying a locking method, one or more indexes, a query processing operation such as a table scan or index seek, or other options.
WITH ( &#60;table_hint&#62; [ [ , ]...n ] )

&#60;table_hint&#62; ::=
[ [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=sqlhelp.wordpress.com&blog=5672629&post=236&subd=sqlhelp&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p><strong>Table Hints (Transact-SQL)</strong></p>
<p>Table hints override the default behavior of the query optimizer for the duration of the data manipulation language (DML) statement by specifying a locking method, one or more indexes, a query processing operation such as a table scan or index seek, or other options.</p>
<pre>WITH ( &lt;table_hint&gt; [ [ , ]...n ] )

&lt;table_hint&gt; ::=
[ NOEXPAND ] {
    INDEX ( index_value [ ,...n ] ) | INDEX = ( index_value )
  | FASTFIRSTROW
  | FORCESEEK
  | HOLDLOCK
  | NOLOCK
  | NOWAIT
  | PAGLOCK
  | READCOMMITTED
  | READCOMMITTEDLOCK
  | READPAST
  | READUNCOMMITTED
  | REPEATABLEREAD
  | ROWLOCK
  | SERIALIZABLE
  | TABLOCK
  | TABLOCKX
  | UPDLOCK
  | XLOCK
} 

&lt;table_hint_limited&gt; ::=
{
    KEEPIDENTITY
  | KEEPDEFAULTS
  | FASTFIRSTROW
  | HOLDLOCK
  | IGNORE_CONSTRAINTS
  | IGNORE_TRIGGERS
  | NOWAIT
  | PAGLOCK
  | READCOMMITTED
  | READCOMMITTEDLOCK
  | READPAST
  | REPEATABLEREAD
  | ROWLOCK
  | SERIALIZABLE
  | TABLOCK
  | TABLOCKX
  | UPDLOCK
  | XLOCK
}</pre>
<p>The following table hints are allowed with and without the WITH<br />
keyword: NOLOCK, READUNCOMMITTED, UPDLOCK, REPEATABLEREAD,<br />
SERIALIZABLE, READCOMMITTED, FASTFIRSTROW, TABLOCK, TABLOCKX, PAGLOCK,<br />
ROWLOCK, NOWAIT, READPAST, XLOCK, and NOEXPAND. When these table hints<br />
are specified without the WITH keyword, the hints should be specified<br />
alone.</p>
<p><strong>For example:</strong><br />
<code><br />
Select * FROM table1 (TABLOCK)</code></p>
<p><code>Select * FROM table1 WITH (TABLOCK, INDEX(myindex))</code></p>
  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/sqlhelp.wordpress.com/236/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/sqlhelp.wordpress.com/236/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/sqlhelp.wordpress.com/236/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/sqlhelp.wordpress.com/236/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/sqlhelp.wordpress.com/236/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/sqlhelp.wordpress.com/236/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/sqlhelp.wordpress.com/236/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/sqlhelp.wordpress.com/236/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/sqlhelp.wordpress.com/236/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/sqlhelp.wordpress.com/236/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=sqlhelp.wordpress.com&blog=5672629&post=236&subd=sqlhelp&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://sqlhelp.wordpress.com/2009/01/13/table-hints-transact-sql/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/344460fcb9807a37c97174a2edc9d970?s=96&#38;d=identicon" medium="image">
			<media:title type="html">Raghunath Bhandari</media:title>
		</media:content>
	</item>
		<item>
		<title>Reducing SQL Server Deadlocks</title>
		<link>http://sqlhelp.wordpress.com/2009/01/13/reducing-sql-server-deadlocks/</link>
		<comments>http://sqlhelp.wordpress.com/2009/01/13/reducing-sql-server-deadlocks/#comments</comments>
		<pubDate>Tue, 13 Jan 2009 11:00:18 +0000</pubDate>
		<dc:creator>Raghunath Bhandari</dc:creator>
				<category><![CDATA[SQL Deadlocking]]></category>
		<category><![CDATA[MS SQL Deadlocks]]></category>
		<category><![CDATA[NOLOCK]]></category>
		<category><![CDATA[PAGLOCK]]></category>
		<category><![CDATA[ROWLOCK]]></category>
		<category><![CDATA[Solve Deadlocks]]></category>
		<category><![CDATA[SQL Best practices and tips]]></category>
		<category><![CDATA[SQL Deadlocking refers to the condition]]></category>
		<category><![CDATA[SQL Deadlocks]]></category>
		<category><![CDATA[SQL Locks]]></category>
		<category><![CDATA[SQL Tips]]></category>
		<category><![CDATA[SQL Tricks]]></category>

		<guid isPermaLink="false">http://sqlhelp.wordpress.com/?p=230</guid>
		<description><![CDATA[Deadlocking and SQL best practices:
Deadlocking refers to the condition in which one resource is waiting on the action of a second, while that second action is waiting on the first. This is different from being blocked, or having to wait for a resource. Using the locks above, if a transaction had a shared lock, then [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=sqlhelp.wordpress.com&blog=5672629&post=230&subd=sqlhelp&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p><strong>Deadlocking and SQL best practices:</strong></p>
<p>Deadlocking refers to the condition in which one resource is waiting on the action of a second, while that second action is waiting on the first. This is different from being blocked, or having to wait for a resource. Using the locks above, if a transaction had a shared lock, then you issued a delete on those same records held by the first lock, you would not be deadlocked. Instead, you would be blocked. When the shared lock was released, your delete statement would complete. Blocking implies some performance hit, but the transaction will complete. It simply has to wait for something else to finish first. A deadlock on the other hand, means there is no way to finish. Your transaction is stuck in a loop with some other transaction. At this point, the database system will usually pick one transaction to be killed so the other can complete.</p>
<p><strong>Here are some tips on how to avoid deadlocking on your SQL Server:</strong></p>
<ul>
<li>Esure the database design is properly normalized.</li>
<li>Have the application access server objects in the same order each time.</li>
<li>During transactions, don&#8217;t allow any user input. Collect it before the transaction begins.</li>
<li>Avoid cursors.</li>
<li>Keep transactions as short as possible. One way to help accomplish this is to reduce the number of round trips between your application and SQL Server by using stored procedures or keeping transactions with a single batch. Another way of reducing the time a transaction takes to complete is to make sure you are not performing the same reads over and over again. If your application does need to read the same data more than once, cache it by storing it in a variable or an array, and then re-reading it from there, not from SQL Server.</li>
<li>Reduce lock time. Try to develop your application so that it grabs locks at the latest possible time, and then releases them at the very earliest time.</li>
<li>If appropriate, reduce lock escalation by using the ROWLOCK or PAGLOCK.</li>
<li>Consider using the NOLOCK hint to prevent locking if the data being locked is not modified often.</li>
<li>If appropriate, use as low of an isolation level as possible for the user connection running the transaction.</li>
<li>Consider using bound connections</li>
<li>Remember to SET NOCOUNT ON at the beginning of your SQL bataches, stored procedures, triggers to avoid network traffic. This will also reduct the chances of error on linked server.</li>
<li>Index should be created on highly selective columns, which are used in JOINS, WHERE and ORDER BY clause.</li>
<li>Use Column name in ORDER BY clause instead of numbers.</li>
<li>Do not use TEXT or NTEXT if possible. In SQL Server 2005 use VARCHAR(MAX) or NVARCHAR(MAX).</li>
<li>Do not use SELECT *, use proper column names to decrease network traffic and fewer locks on table.</li>
</ul>
<blockquote><p>
Use SQL Server Profiler to identify the cause of a deadlock. A deadlock occurs when there is a cyclic dependency between two or more threads, or processes, for some set of resources within SQL Server. Using SQL Server Profiler, you can create a trace that records, replays, and displays deadlock events for analysis.</p>
<p>To trace deadlock events, add the Deadlock graph event class to a trace. This event class populates the TextData data column in the trace with XML data about the process and objects that are involved in the deadlock. SQL Server Profiler can extract the XML document to a deadlock XML (.xdl) file which you can view later in SQL Server Management Studio. You can configure SQL Server Profiler to extract Deadlock graph events to a single file that contains all Deadlock graph events, or to separate files. This extraction can be done in any of the following ways:</p></blockquote>
<ul>
<li>At trace configuration time, using the Events Extraction Settings tab. Note that this tab does not appear until you select the Deadlock graph event on the Events Selection tab.</li>
<li>Using the Extract SQL Server Events option on the File menu.</li>
<li>Individual events can also be extracted and saved by right-clicking a specific event and choosing Extract Event Data.</li>
</ul>
  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/sqlhelp.wordpress.com/230/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/sqlhelp.wordpress.com/230/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/sqlhelp.wordpress.com/230/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/sqlhelp.wordpress.com/230/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/sqlhelp.wordpress.com/230/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/sqlhelp.wordpress.com/230/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/sqlhelp.wordpress.com/230/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/sqlhelp.wordpress.com/230/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/sqlhelp.wordpress.com/230/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/sqlhelp.wordpress.com/230/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=sqlhelp.wordpress.com&blog=5672629&post=230&subd=sqlhelp&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://sqlhelp.wordpress.com/2009/01/13/reducing-sql-server-deadlocks/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/344460fcb9807a37c97174a2edc9d970?s=96&#38;d=identicon" medium="image">
			<media:title type="html">Raghunath Bhandari</media:title>
		</media:content>
	</item>
		<item>
		<title>HOW TO USE  ROLLUP and CUBE</title>
		<link>http://sqlhelp.wordpress.com/2009/01/07/how-to-use-rollup/</link>
		<comments>http://sqlhelp.wordpress.com/2009/01/07/how-to-use-rollup/#comments</comments>
		<pubDate>Wed, 07 Jan 2009 08:42:51 +0000</pubDate>
		<dc:creator>Raghunath Bhandari</dc:creator>
				<category><![CDATA[SQL rollup/cube]]></category>
		<category><![CDATA[How to use Rollup in SQL]]></category>
		<category><![CDATA[Microsoft SQL server]]></category>
		<category><![CDATA[MSSQL]]></category>
		<category><![CDATA[MSSQL server]]></category>
		<category><![CDATA[Query sum option]]></category>
		<category><![CDATA[Running total generate]]></category>
		<category><![CDATA[SQL cube]]></category>
		<category><![CDATA[SQL Rollup]]></category>
		<category><![CDATA[SQL Server]]></category>
		<category><![CDATA[The differences between CUBE and ROLLUP]]></category>
		<category><![CDATA[What is CUBE]]></category>
		<category><![CDATA[What is Rollup]]></category>

		<guid isPermaLink="false">http://sqlhelp.wordpress.com/?p=224</guid>
		<description><![CDATA[HOW TO USE  CUBE:
The CUBE operator generates a result set that is a multidimensional cube. A multidimensional cube is an expansion of fact data, or data that records individual events. The expansion is based on columns that the user wants to analyze. These columns are called dimensions. The cube is a result set containing [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=sqlhelp.wordpress.com&blog=5672629&post=224&subd=sqlhelp&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p><strong>HOW TO USE  CUBE:</strong></p>
<p>The CUBE operator generates a result set that is a multidimensional cube. A multidimensional cube is an expansion of fact data, or data that records individual events. The expansion is based on columns that the user wants to analyze. These columns are called dimensions. The cube is a result set containing a cross tabulation of all the possible combinations of the dimensions.</p>
<p>The CUBE operator is specified in the GROUP BY clause of a SELECT statement. The select list contains the dimension columns and aggregate function expressions. The GROUP BY specifies the dimension columns and the keywords WITH CUBE. The result set contains all possible combinations of the values in the dimension columns, along with the aggregate values from the underlying rows that match that combination of dimension values.</p>
<p><strong>For example, a simple table Inventory contains:</strong></p>
<pre><code>Item                 Color                Quantity
-------------------- -------------------- --------------------------
Table                Blue                 124
Table                Red                  223
Chair                Blue                 101
Chair                Red                  210</code></pre>
<p>This query returns a result set that contains the Quantity subtotal for all possible combinations of Item and Color:</p>
<p><code>SELECT Item, Color, SUM(Quantity) AS QtySum<br />
FROM Inventory<br />
GROUP BY Item, Color WITH CUBE</code></p>
<p><strong>Here is the result set:</strong></p>
<pre><code>Item                 Color                QtySum
-------------------- -------------------- --------------------------
Chair                Blue                 101.00
Chair                Red                  210.00
Chair                (null)               311.00
Table                Blue                 124.00
Table                Red                  223.00
Table                (null)               347.00
(null)               (null)               658.00
(null)               Blue                 225.00
(null)               Red                  433.00</code></pre>
<p>The following rows from the result set are of special interest:</p>
<p>Chair                (null)               311.00</p>
<p>This row reports a subtotal for all rows having the value Chair in the Item dimension. The value NULL is returned for the Color dimension to show that aggregate reported by the row includes rows with any value of the Color dimension.</p>
<p><code>Table                (null)               347.00</code></p>
<p>This row is similar, but reports the subtotal for all rows having Table in the Item dimension.<br />
<code><br />
(null)               (null)               658.00</code></p>
<p>This row reports the grand total for the cube. Both the Item and Color dimensions have the value NULL showing that all values of both dimensions are summarized in the row.</p>
<p><code>(null)               Blue                 225.00<br />
(null)               Red                  433.00</code></p>
<p>These two rows report the subtotals for the Color dimension. Both have NULL in the Item dimension to show that the aggregate data came from rows having any value for the Item dimension.</p>
<p>Using GROUPING to Distinguish Null Values<br />
The null values generated by the CUBE operation present a problem: How can a NULL generated by the CUBE operation be distinguished from a NULL returned in the actual data? This is achieved using the GROUPING function. The GROUPING function returns 0, if the column value came from the fact data, and 1 if the column value is a NULL generated by the CUBE operation. In a CUBE operation, a generated NULL represents all values. The SELECT statement can be written to use the GROUPING function to substitute the string ALL in place of any generated NULL. Because a NULL from the fact data indicates the data value is unknown, the SELECT can also be coded to return the string UNKNOWN in place of any NULL from the fact data. For example:</p>
<p><code>SELECT CASE WHEN (GROUPING(Item) = 1) THEN 'ALL'<br />
ELSE ISNULL(Item, 'UNKNOWN')<br />
END AS Item,<br />
CASE WHEN (GROUPING(Color) = 1) THEN 'ALL'<br />
ELSE ISNULL(Color, 'UNKNOWN')<br />
END AS Color,<br />
SUM(Quantity) AS QtySum<br />
FROM Inventory<br />
GROUP BY Item, Color WITH CUBE</code></p>
<p>Multidimensional Cubes<br />
The CUBE operator can be used to generate n-dimensional cubes, or cubes with any number of dimensions. A single dimension cube can be used to generate a total, for example:</p>
<p><code>SELECT CASE WHEN (GROUPING(Item) = 1) THEN 'ALL'<br />
ELSE ISNULL(Item, 'UNKNOWN')<br />
END AS Item,<br />
SUM(Quantity) AS QtySum<br />
FROM Inventory<br />
GROUP BY Item WITH CUBE<br />
GO</code></p>
<p>This SELECT statement returns a result set showing both the subtotals for each value of Item and the grand total for all values of Item:</p>
<pre><code>Item                 QtySum
-------------------- --------------------------
Chair                311.00
Table                347.00
ALL                  658.00</code></pre>
<p>SELECT statements that contain a CUBE with many dimensions can generate large result sets, because these statements generate rows for all combinations of the values in all the dimensions. These large result sets may contain too much data to be easily read and understood. One solution to this problem is to put the SELECT statement into a view:<br />
<code><br />
CREATE VIEW InvCube AS<br />
SELECT CASE WHEN (GROUPING(Item) = 1) THEN 'ALL'<br />
ELSE ISNULL(Item, 'UNKNOWN')<br />
END AS Item,<br />
CASE WHEN (GROUPING(Color) = 1) THEN 'ALL'<br />
ELSE ISNULL(Color, 'UNKNOWN')<br />
END AS Color,<br />
SUM(Quantity) AS QtySum<br />
FROM Inventory<br />
GROUP BY Item, Color WITH CUBE</code></p>
<p>The view can then be used to query only the dimension values of interest:</p>
<p><code>SELECT *<br />
FROM InvCube<br />
WHERE Item = 'Chair'<br />
AND Color = 'ALL'</code></p>
<pre>Item                 Color                QtySum
-------------------- -------------------- --------------------------
Chair                ALL                  311.00</pre>
<p><strong>HOW TO USE  ROLLUP:</strong></p>
<p>The ROLLUP operator is useful in generating reports that contain subtotals and totals. The ROLLUP operator generates a result set that is similar to the result sets generated by the CUBE operator. For more information, see Summarizing Data Using CUBE.</p>
<p>The differences between CUBE and ROLLUP are:</p>
<p>CUBE generates a result set showing aggregates for all combinations of values in the selected columns.</p>
<p>ROLLUP generates a result set showing aggregates for a hierarchy of values in the selected columns.<br />
For example, a simple table Inventory contains:</p>
<pre><code>Item                 Color                Quantity</code>
<code>-------------------- -------------------- --------------------------</code>
<code>Table                Blue                 124</code>
<code>Table                Red                  223</code>
<code>Chair                Blue                 101</code>
<code>Chair                Red                  210</code></pre>
<p><strong>This query generates a subtotal report:</strong></p>
<p><code>SELECT CASE WHEN (GROUPING(Item) = 1) THEN 'ALL'<br />
ELSE ISNULL(Item, 'UNKNOWN')<br />
END AS Item,<br />
CASE WHEN (GROUPING(Color) = 1) THEN 'ALL'<br />
ELSE ISNULL(Color, 'UNKNOWN')<br />
END AS Color,<br />
SUM(Quantity) AS QtySum<br />
FROM Inventory<br />
GROUP BY Item, Color WITH ROLLUP</code></p>
<pre><code>Item                 Color                QtySum
-------------------- -------------------- --------------------------
Chair                Blue                 101.00
Chair                Red                  210.00
Chair                ALL                  311.00
Table                Blue                 124.00
Table                Red                  223.00
Table                ALL                  347.00
ALL                  ALL                  658.00</code></pre>
<pre>(7 row(s) affected)</pre>
<p>If the ROLLUP keyword in the query is changed to CUBE, the CUBE result set is the same, except these two additional rows are returned at the end:</p>
<p><code>ALL                  Blue                 225.00<br />
ALL                  Red                  433.00</code></p>
<p>The CUBE operation generated rows for possible combinations of values from both Item and Color. For example, not only does CUBE report all possible combinations of Color values combined with the Item value Chair (Red, Blue, and Red + Blue), it also reports all possible combinations of Item values combined with the Color value Red (Chair, Table, and Chair + Table).</p>
<p>For each value in the columns on the right in the GROUP BY clause, the ROLLUP operation does not report all possible combinations of values from the column (or columns) on the left. For example, ROLLUP does not report all the possible combinations of Item values for each Color value.</p>
<p>The result set of a ROLLUP operation has functionality similar to that returned by a COMPUTE BY; however, ROLLUP has these advantages:</p>
<p>ROLLUP returns a single result set; COMPUTE BY returns multiple result sets that increase the complexity of application code.</p>
<p>ROLLUP can be used in a server cursor; COMPUTE BY cannot.</p>
<p>The query optimizer can sometimes generate more efficient execution plans for ROLLUP than it can for COMPUTE BY.</p>
  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/sqlhelp.wordpress.com/224/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/sqlhelp.wordpress.com/224/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/sqlhelp.wordpress.com/224/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/sqlhelp.wordpress.com/224/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/sqlhelp.wordpress.com/224/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/sqlhelp.wordpress.com/224/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/sqlhelp.wordpress.com/224/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/sqlhelp.wordpress.com/224/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/sqlhelp.wordpress.com/224/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/sqlhelp.wordpress.com/224/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=sqlhelp.wordpress.com&blog=5672629&post=224&subd=sqlhelp&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://sqlhelp.wordpress.com/2009/01/07/how-to-use-rollup/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/344460fcb9807a37c97174a2edc9d970?s=96&#38;d=identicon" medium="image">
			<media:title type="html">Raghunath Bhandari</media:title>
		</media:content>
	</item>
		<item>
		<title>SQL running serial generating tips</title>
		<link>http://sqlhelp.wordpress.com/2008/12/31/sql-running-serial-generating-tips/</link>
		<comments>http://sqlhelp.wordpress.com/2008/12/31/sql-running-serial-generating-tips/#comments</comments>
		<pubDate>Wed, 31 Dec 2008 07:48:41 +0000</pubDate>
		<dc:creator>Raghunath Bhandari</dc:creator>
				<category><![CDATA[SQL ROW_NUMBER]]></category>
		<category><![CDATA[Generate Row number]]></category>
		<category><![CDATA[Microsoft SQL server]]></category>
		<category><![CDATA[MSSQL]]></category>
		<category><![CDATA[MSSQL server]]></category>
		<category><![CDATA[ROW_NUMBER()]]></category>
		<category><![CDATA[SQL help]]></category>
		<category><![CDATA[SQL running serial]]></category>
		<category><![CDATA[SQL running serial generating]]></category>
		<category><![CDATA[SQL Server]]></category>
		<category><![CDATA[SQL Tricks]]></category>
		<category><![CDATA[sqlhelp]]></category>
		<category><![CDATA[SQLtips]]></category>

		<guid isPermaLink="false">http://sqlhelp.wordpress.com/?p=221</guid>
		<description><![CDATA[SQL running serial generating tips:
Traditionally developers and Database administrators used temporary tables and co-related sub-queries to generate calculated row numbers in a query. Now SQL Server 2005 provides a function, which replaces all of the additional resources we used to generate row numbers.
Returns the sequential number of a row within a partition of a result [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=sqlhelp.wordpress.com&blog=5672629&post=221&subd=sqlhelp&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p><strong>SQL running serial generating tips</strong>:</p>
<p><span style="font-family:Verdana,Arial,Helvetica,sans-serif;"><span style="font-family:Verdana,Arial,Helvetica,sans-serif;">Traditionally developers and Database administrators used temporary tables and co-related sub-queries to generate calculated row numbers in a query. Now SQL Server 2005 provides a function, which replaces all of the additional resources we used to generate row numbers.</span></span></p>
<blockquote><p>Returns the sequential number of a row within a partition of a result set, starting at 1 for the first row in each partition.</p></blockquote>
<p><strong>Example:</strong></p>
<p><code>select ROW_NUMBER() OVER(ORDER BY CLM1),* from Table1</code></p>
<p><strong>Remark: </strong></p>
<div id="ctl00_rs1_mainContentContainer_cpe52969_c" class="MTPS_CollapsibleSection" style="overflow:visible;display:block;height:auto;width:982.7px;">
<div class="MTPS_CollapsibleSection" style="display:block;"><a id="remarksToggle"></a>The ORDER BY clause determines the sequence in which the rows are assigned their unique<br />
ROW_NUMBER within a specified partition.</div>
</div>
  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/sqlhelp.wordpress.com/221/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/sqlhelp.wordpress.com/221/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/sqlhelp.wordpress.com/221/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/sqlhelp.wordpress.com/221/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/sqlhelp.wordpress.com/221/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/sqlhelp.wordpress.com/221/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/sqlhelp.wordpress.com/221/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/sqlhelp.wordpress.com/221/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/sqlhelp.wordpress.com/221/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/sqlhelp.wordpress.com/221/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=sqlhelp.wordpress.com&blog=5672629&post=221&subd=sqlhelp&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://sqlhelp.wordpress.com/2008/12/31/sql-running-serial-generating-tips/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/344460fcb9807a37c97174a2edc9d970?s=96&#38;d=identicon" medium="image">
			<media:title type="html">Raghunath Bhandari</media:title>
		</media:content>
	</item>
		<item>
		<title>Enable remote connection SQL Server</title>
		<link>http://sqlhelp.wordpress.com/2008/12/26/enable-remote-connection-sql-server/</link>
		<comments>http://sqlhelp.wordpress.com/2008/12/26/enable-remote-connection-sql-server/#comments</comments>
		<pubDate>Fri, 26 Dec 2008 11:50:30 +0000</pubDate>
		<dc:creator>Raghunath Bhandari</dc:creator>
				<category><![CDATA[SQL remote connection]]></category>
		<category><![CDATA[An error has occurred while establishing a connection to the server]]></category>
		<category><![CDATA[connection SQL Server]]></category>
		<category><![CDATA[Enable remote connection SQL Server]]></category>
		<category><![CDATA[Microsoft SQL server]]></category>
		<category><![CDATA[MSSQL]]></category>
		<category><![CDATA[MSSQL server]]></category>
		<category><![CDATA[problem in remote connection SQL Server]]></category>
		<category><![CDATA[SQL help]]></category>
		<category><![CDATA[SQL Server]]></category>
		<category><![CDATA[SQL Tips]]></category>
		<category><![CDATA[SQL Tricks]]></category>

		<guid isPermaLink="false">http://sqlhelp.wordpress.com/?p=217</guid>
		<description><![CDATA[
Error Description ::
An error has occurred while establishing a connection to the server. When connecting to SQL Server 2005, this failure may be caused by the fact that under the default settings SQL Server does not allow remote connections. (provider: Named Pipes Provider, error: 40 &#8211; Could not open a connection to SQL Server)
Enable remote [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=sqlhelp.wordpress.com&blog=5672629&post=217&subd=sqlhelp&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><blockquote>
<h3><strong>Error Description ::</strong></h3>
<p>An error has occurred while establishing a connection to the server. When connecting to SQL Server 2005, this failure may be caused by the fact that under the default settings SQL Server does not allow remote connections. (provider: Named Pipes Provider, error: 40 &#8211; Could not open a connection to SQL Server)</p></blockquote>
<h3>Enable remote connections for SQL Server 2005 Express or SQL Server 2005 Developer Edition</h3>
<p>You must enable remote connections for each instance of SQL Server 2005 that you want to connect to from a remote computer. To do this, follow these steps:</p>
<ol>
<li>Click <strong class="uiterm">Start</strong>, point to <strong class="uiterm">Programs</strong>, point to <strong class="uiterm">Microsoft SQL Server 2005</strong>, point to <strong class="uiterm">Configuration Tools</strong>, and then click <strong class="uiterm">SQL Server Surface Area Configuration</strong>.</li>
<li>On the <strong class="uiterm">SQL Server 2005 Surface Area Configuration</strong> page, click <strong class="uiterm">Surface Area Configuration for Services and Connections</strong>.</li>
<li>On the <strong class="uiterm">Surface Area Configuration for Services and Connections</strong> page, expand <strong class="uiterm">Database Engine</strong>,  click <strong class="uiterm">Remote Connections</strong>, click <strong class="uiterm">Local and remote connections</strong>, click the appropriate protocol to enable for your environment, and then click <strong class="uiterm">Apply</strong>.<strong>Note</strong> Click <strong class="uiterm">OK</strong> when you receive the following message:
<div class="message">Changes to Connection Settings will not take effect until you restart the Database Engine service.</div>
</li>
<li>On the <strong class="uiterm">Surface Area Configuration for Services and Connections</strong> page, expand <strong class="uiterm">Database Engine</strong>,  click <strong class="uiterm">Service</strong>, click <strong class="uiterm">Stop</strong>, wait until the MSSQLSERVER service stops, and then click <strong class="uiterm">Start</strong> to restart the MSSQLSERVER service.</li>
</ol>
<h3>Enable the SQL Server Browser service:</h3>
<ol>
<li>Click <strong class="uiterm">Start</strong>, point to <strong class="uiterm">Programs</strong>, point to <strong class="uiterm">Microsoft SQL Server 2005</strong>, point to <strong class="uiterm">Configuration Tools</strong>, and then click <strong class="uiterm">SQL Server Surface Area Configuration</strong>.</li>
<li>On the <strong class="uiterm">SQL Server 2005 Surface Area Configuration</strong> page, click <strong class="uiterm">Surface Area Configuration for Services and Connections</strong>.</li>
<li>On the <strong class="uiterm">Surface Area Configuration for Services and Connections</strong> page, click <strong class="uiterm">SQL Server Browser</strong>, click <strong class="uiterm">Automatic</strong> for <strong class="uiterm">Startup type</strong>, and then click <strong class="uiterm">Apply</strong>.<strong>Note</strong> When you click the <strong class="uiterm">Automatic</strong> option, the SQL Server Browser service starts automatically every time that you start Microsoft Windows.</li>
<li>Click <strong class="uiterm">Start</strong>, and then click <strong class="uiterm">OK</strong>.</li>
</ol>
<h3>Create exceptions in Windows Firewall:</h3>
<ol>
<li>Click <strong class="uiterm">Start</strong>, point to <strong class="uiterm">Programs</strong>, point to <strong class="uiterm">Microsoft SQL Server 2005</strong>, point to <strong class="uiterm">Configuration Tools</strong>, and then click <strong class="uiterm">SQL Server Configuration Manager</strong>.</li>
<li>In SQL Server Configuration Manager, click the SQL Server Browser service in the right pane, right-click the instance name in the main window, and then click <strong class="uiterm">Properties</strong>.</li>
<li>On the <strong class="uiterm">SQL Server Browser Properties</strong> page, click the <strong class="uiterm">Advanced</strong> tab, locate the instance ID in the property list, and then click <strong class="uiterm">OK</strong>.</li>
</ol>
<p>To open Windows Firewall, click <strong class="uiterm">Start</strong>, click <strong class="uiterm">Run</strong>, type <span class="userInput">firewall.cpl</span>, and then click <strong class="uiterm">OK</strong></p>
<h4>Create an exception for SQL Server 2005 in Windows Firewall</h4>
<p>To create an exception for SQL Server 2005 in Windows Firewall, follow these steps:</p>
<ol>
<li>In Windows Firewall, click the <strong class="uiterm">Exceptions</strong> tab, and then click <strong class="uiterm">Add Program</strong>.</li>
<li>In the Add a Program window, click <strong class="uiterm">Browse</strong>.</li>
<li> Click the C:Program FilesMicrosoft SQL Server<var>MSSQL.1</var>MSSQLBinnsqlservr.exe executable program, click <strong class="uiterm">Open</strong>, and then click <strong class="uiterm">OK</strong>.<strong>Note</strong> The path may be different depending on where SQL Server 2005 is installed. <var>MSSQL.1</var> is a placeholder for the instance ID that you obtained in step 3  of the previous procedure.</li>
<li>Repeat steps 1 through 3 for each instance of SQL Server 2005 that needs an exception.</li>
</ol>
<h4>Create an exception for the SQL Server Browser service in Windows Firewall</h4>
<p>To create an exception for the SQL Server Browser service in Windows Firewall, follow these steps:</p>
<ol>
<li>In Windows Firewall, click the <strong class="uiterm">Exceptions</strong> tab, and then click <strong class="uiterm">Add Program</strong>.</li>
<li>In the Add a Program window, click <strong class="uiterm">Browse</strong>.</li>
<li>Click the C:Program FilesMicrosoft SQL Server90Sharedsqlbrowser.exe executable program, click <strong class="uiterm">Open</strong>, and then click <strong class="uiterm">OK</strong>.</li>
</ol>
  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/sqlhelp.wordpress.com/217/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/sqlhelp.wordpress.com/217/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/sqlhelp.wordpress.com/217/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/sqlhelp.wordpress.com/217/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/sqlhelp.wordpress.com/217/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/sqlhelp.wordpress.com/217/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/sqlhelp.wordpress.com/217/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/sqlhelp.wordpress.com/217/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/sqlhelp.wordpress.com/217/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/sqlhelp.wordpress.com/217/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=sqlhelp.wordpress.com&blog=5672629&post=217&subd=sqlhelp&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://sqlhelp.wordpress.com/2008/12/26/enable-remote-connection-sql-server/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/344460fcb9807a37c97174a2edc9d970?s=96&#38;d=identicon" medium="image">
			<media:title type="html">Raghunath Bhandari</media:title>
		</media:content>
	</item>
		<item>
		<title>Case sensitive comparisons in SQL</title>
		<link>http://sqlhelp.wordpress.com/2008/12/24/case-sensitive-comparisons-in-sql/</link>
		<comments>http://sqlhelp.wordpress.com/2008/12/24/case-sensitive-comparisons-in-sql/#comments</comments>
		<pubDate>Wed, 24 Dec 2008 08:52:53 +0000</pubDate>
		<dc:creator>Raghunath Bhandari</dc:creator>
				<category><![CDATA[SQL String comparisons]]></category>
		<category><![CDATA[BINARY_CHECKSUM]]></category>
		<category><![CDATA[Case sensitive comparisons in SQL]]></category>
		<category><![CDATA[comparisons in SQL]]></category>
		<category><![CDATA[Microsoft SQL server]]></category>
		<category><![CDATA[MSSQL]]></category>
		<category><![CDATA[MSSQL BINARY_CHECKSUM]]></category>
		<category><![CDATA[MSSQL server]]></category>
		<category><![CDATA[MSSQL string compare]]></category>
		<category><![CDATA[MSSQL String comparisons tips]]></category>
		<category><![CDATA[SQL  best way to compare string]]></category>
		<category><![CDATA[SQL help]]></category>
		<category><![CDATA[SQL Server]]></category>
		<category><![CDATA[SQL varbinary method]]></category>

		<guid isPermaLink="false">http://sqlhelp.wordpress.com/?p=211</guid>
		<description><![CDATA[Case sensitive comparisons in SQL Server
Some time we need to compare some data in binary see the examples:
SELECT *  FROM TABLE1 WITH (NOLOCK) WHERE convert(varbinary(255), PASS) = convert(varbinary(255), 'RAGHU')
Normal comparison:
SELECT *  FROM TABLE1 WITH (NOLOCK) WHERE convert(varbinary(255), PASS) = convert(varbinary(255), 'Raghu') AND PASS= 'TEST'
Uuse the BINARY_CHECKSUM function:

SELECT *  FROM TABLE1 WITH (NOLOCK) WHERE BINARY_CHECKSUM(answer) = [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=sqlhelp.wordpress.com&blog=5672629&post=211&subd=sqlhelp&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p><strong>Case sensitive comparisons in SQL Server</strong></p>
<p>Some time we need to compare some data in binary see the examples:</p>
<p><code>SELECT *  FROM TABLE1 WITH (NOLOCK) WHERE convert(varbinary(255), PASS) = convert(varbinary(255), 'RAGHU')</code></p>
<p><strong>Normal comparison:</strong></p>
<p><code>SELECT *  FROM TABLE1 WITH (NOLOCK)</code><code> WHERE convert(varbinary(255), </code><code>PASS</code><code>) = convert(varbinary(255), 'Raghu</code><code>') AND </code><code>PASS</code><code>= '</code><code>TEST</code><code>'</code></p>
<p><strong>Uuse the BINARY_CHECKSUM function:<br />
</strong></p>
<p><code>SELECT *  FROM TABLE1 WITH (NOLOCK)</code><code> WHERE BINARY_CHECKSUM(answer) = BINARY_CHECKSUM('</code><code>TEST</code><code>')</code><strong><br />
</strong></p>
<p><strong>Use SQL Server case insensitive collation:</strong></p>
<p><code>SELECT *  FROM TABLE1 WITH (NOLOCK)</code><code> WHERE PASSWORD COLLATE SQL_Latin1_General_CP1_CS_AS = 'RAGHU</code><code>' COLLATE SQL_Latin1_General_CP1_CS_AS</code></p>
  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/sqlhelp.wordpress.com/211/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/sqlhelp.wordpress.com/211/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/sqlhelp.wordpress.com/211/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/sqlhelp.wordpress.com/211/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/sqlhelp.wordpress.com/211/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/sqlhelp.wordpress.com/211/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/sqlhelp.wordpress.com/211/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/sqlhelp.wordpress.com/211/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/sqlhelp.wordpress.com/211/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/sqlhelp.wordpress.com/211/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=sqlhelp.wordpress.com&blog=5672629&post=211&subd=sqlhelp&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://sqlhelp.wordpress.com/2008/12/24/case-sensitive-comparisons-in-sql/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/344460fcb9807a37c97174a2edc9d970?s=96&#38;d=identicon" medium="image">
			<media:title type="html">Raghunath Bhandari</media:title>
		</media:content>
	</item>
		<item>
		<title>Sub Query Update</title>
		<link>http://sqlhelp.wordpress.com/2008/12/19/sub-query-update/</link>
		<comments>http://sqlhelp.wordpress.com/2008/12/19/sub-query-update/#comments</comments>
		<pubDate>Fri, 19 Dec 2008 10:33:48 +0000</pubDate>
		<dc:creator>Raghunath Bhandari</dc:creator>
				<category><![CDATA[SQL Subquery]]></category>
		<category><![CDATA[Stored Procedures]]></category>
		<category><![CDATA[Microsoft SQL server]]></category>
		<category><![CDATA[MSSQL]]></category>
		<category><![CDATA[MSSQL server]]></category>
		<category><![CDATA[SQL Server]]></category>
		<category><![CDATA[SQL update with join]]></category>
		<category><![CDATA[Sub Query Update]]></category>
		<category><![CDATA[tow table update]]></category>
		<category><![CDATA[UPDATE statement using a join]]></category>

		<guid isPermaLink="false">http://sqlhelp.wordpress.com/?p=208</guid>
		<description><![CDATA[Sub Query Update:
if you want to run update query in join or by comparing other table then here is the example.
UPDATE Table1
SET Price = Price * 2
WHERE ProductID IN
    (SELECT ID
     FROM Table2
     WHERE ID= 51);
GO
Here is an equivalent UPDATE statement using a join:
USE [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=sqlhelp.wordpress.com&blog=5672629&post=208&subd=sqlhelp&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p><strong>Sub Query Update:</strong><br />
if you want to run update query in join or by comparing other table then here is the example.</p>
<pre class="libCScode" style="white-space:pre-wrap;">UPDATE Table1
SET Price = Price * 2
WHERE ProductID IN
    (SELECT ID
     FROM Table2
     WHERE ID= 51);
GO</pre>
<p><strong>Here is an equivalent UPDATE statement using a join:</strong></p>
<pre class="libCScode" style="white-space:pre-wrap;">USE AdventureWorks;
GO
UPDATE Table1
SET Price = Price * 2
FROM Table1 AS t1
INNER JOIN Table2 AS t2
    ON t1.ProductID = t2.ProductID AND t2.ID= 51;
GO</pre>
  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/sqlhelp.wordpress.com/208/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/sqlhelp.wordpress.com/208/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/sqlhelp.wordpress.com/208/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/sqlhelp.wordpress.com/208/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/sqlhelp.wordpress.com/208/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/sqlhelp.wordpress.com/208/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/sqlhelp.wordpress.com/208/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/sqlhelp.wordpress.com/208/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/sqlhelp.wordpress.com/208/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/sqlhelp.wordpress.com/208/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=sqlhelp.wordpress.com&blog=5672629&post=208&subd=sqlhelp&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://sqlhelp.wordpress.com/2008/12/19/sub-query-update/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/344460fcb9807a37c97174a2edc9d970?s=96&#38;d=identicon" medium="image">
			<media:title type="html">Raghunath Bhandari</media:title>
		</media:content>
	</item>
		<item>
		<title>BEGIN TRANSACTION (Transact-SQL)</title>
		<link>http://sqlhelp.wordpress.com/2008/12/19/begin-transaction-transact-sql/</link>
		<comments>http://sqlhelp.wordpress.com/2008/12/19/begin-transaction-transact-sql/#comments</comments>
		<pubDate>Fri, 19 Dec 2008 06:23:57 +0000</pubDate>
		<dc:creator>Raghunath Bhandari</dc:creator>
				<category><![CDATA[BEGIN TRANSACTION]]></category>
		<category><![CDATA[Author Raghunath Bhandari]]></category>
		<category><![CDATA[COMMIT TRANSACTION]]></category>
		<category><![CDATA[Microsoft SQL server]]></category>
		<category><![CDATA[MSSQL]]></category>
		<category><![CDATA[MSSQL server]]></category>
		<category><![CDATA[SQL help]]></category>
		<category><![CDATA[SQL roll back]]></category>
		<category><![CDATA[SQL Server]]></category>
		<category><![CDATA[SQL Tips and Tricks]]></category>

		<guid isPermaLink="false">http://sqlhelp.wordpress.com/?p=203</guid>
		<description><![CDATA[BEGIN TRANSACTION represents a point at which the data referenced by a connection is logically and physically consistent. If errors are encountered, all data modifications made after the BEGIN TRANSACTION can be rolled back to return the data to this known state of consistency. Each transaction lasts until either it completes without errors and COMMIT [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=sqlhelp.wordpress.com&blog=5672629&post=203&subd=sqlhelp&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p>BEGIN TRANSACTION represents a point at which the data referenced by a connection is logically and physically consistent. If errors are encountered, all data modifications made after the BEGIN TRANSACTION can be rolled back to return the data to this known state of consistency. Each transaction lasts until either it completes without errors and COMMIT TRANSACTION is issued to make the modifications a permanent part of the database, or errors are encountered and all modifications are erased with a ROLLBACK TRANSACTION statement.</p>
<p><strong>Syntax:</strong></p>
<pre class="libCScode">BEGIN { TRAN | TRANSACTION }
    [ { transaction_name | @tran_name_variable }
      [ WITH MARK [ 'description' ] ]
    ]
[ ; ]</pre>
<p><strong>Example:</strong></p>
<p>You can catch your error in T-SQL as per my experience</p>
<pre>-- Exec spa_begintrnExample 'a'

<code>Create Proc spa_begintrnExample
@flag char(1)

AS
if @flag='a'
begin

BEGIN TRANSACTION

Update table set clm1='test'
IF (@@ERROR &lt;&gt; 0) GOTO QuitWithRollback 

Update table2 set clm12='test'
IF (@@ERROR &lt;&gt; 0) GOTO QuitWithRollback 

Delete from table3 where clm1='test'
IF (@@ERROR &lt;&gt; 0) GOTO QuitWithRollback 

Delete from table4 set clm1='test'
IF (@@ERROR &lt;&gt; 0) GOTO QuitWithRollback 

COMMIT TRANSACTION

GOTO  EndSave

QuitWithRollback:
  IF (@@TRANCOUNT &gt; 0) ROLLBACK TRANSACTION
EndSave: 

end</code></pre>
<p><strong>Remarks:<br />
</strong><br />
The local transaction started by the BEGIN TRANSACTION statement is escalated to a distributed transaction if the following actions are performed before the statement is committed or rolled back:</p>
<ul>
<li> An INSERT, DELETE, or UPDATE statement that references a remote table on a linked server is executed. The INSERT, UPDATE, or DELETE statement fails if the OLE DB provider used to access the linked server does not support the <strong>ITransactionJoin</strong> interface.</li>
<li> A call is made to a remote stored procedure when the REMOTE_PROC_TRANSACTIONS option is set to ON.</li>
</ul>
  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/sqlhelp.wordpress.com/203/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/sqlhelp.wordpress.com/203/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/sqlhelp.wordpress.com/203/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/sqlhelp.wordpress.com/203/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/sqlhelp.wordpress.com/203/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/sqlhelp.wordpress.com/203/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/sqlhelp.wordpress.com/203/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/sqlhelp.wordpress.com/203/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/sqlhelp.wordpress.com/203/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/sqlhelp.wordpress.com/203/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=sqlhelp.wordpress.com&blog=5672629&post=203&subd=sqlhelp&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://sqlhelp.wordpress.com/2008/12/19/begin-transaction-transact-sql/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/344460fcb9807a37c97174a2edc9d970?s=96&#38;d=identicon" medium="image">
			<media:title type="html">Raghunath Bhandari</media:title>
		</media:content>
	</item>
		<item>
		<title>SQL RAND Function</title>
		<link>http://sqlhelp.wordpress.com/2008/12/14/sql-rand-function/</link>
		<comments>http://sqlhelp.wordpress.com/2008/12/14/sql-rand-function/#comments</comments>
		<pubDate>Sun, 14 Dec 2008 05:12:02 +0000</pubDate>
		<dc:creator>Raghunath Bhandari</dc:creator>
				<category><![CDATA[SQL RAND Function]]></category>
		<category><![CDATA[Advance SQL tips and tricks]]></category>
		<category><![CDATA[Database]]></category>
		<category><![CDATA[Database Optimization Tips]]></category>
		<category><![CDATA[dba]]></category>
		<category><![CDATA[Introduction to SQL]]></category>
		<category><![CDATA[Microsoft SQL server]]></category>
		<category><![CDATA[MSSQL]]></category>
		<category><![CDATA[MSSQL server]]></category>
		<category><![CDATA[SQL]]></category>
		<category><![CDATA[SQL Database Optimization Tricks]]></category>
		<category><![CDATA[SQL help]]></category>
		<category><![CDATA[SQL Optimization]]></category>
		<category><![CDATA[SQL Optimization Tips]]></category>
		<category><![CDATA[SQL Programming]]></category>
		<category><![CDATA[SQL Query]]></category>
		<category><![CDATA[SQL Server]]></category>
		<category><![CDATA[SQL server tips]]></category>
		<category><![CDATA[SQL technology]]></category>
		<category><![CDATA[SQL Tips]]></category>
		<category><![CDATA[SQL Tips and Tricks]]></category>
		<category><![CDATA[SQL tips for programmer]]></category>
		<category><![CDATA[sqlhelp]]></category>
		<category><![CDATA[T-SQL]]></category>
		<category><![CDATA[what is SQL]]></category>

		<guid isPermaLink="false">http://sqlhelp.wordpress.com/?p=196</guid>
		<description><![CDATA[ SQL RAND Function
The SQL RAND() function is used to generate some random numbers at run time. Here is the syntax:
Syntax
RAND ( [ seed ] )
Repetitive calls of RAND() with the same seed value return the same results.
For one connection, if RAND() is called with a specified seed value, all   subsequent calls of [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=sqlhelp.wordpress.com&blog=5672629&post=196&subd=sqlhelp&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p><strong> SQL RAND Function</strong></p>
<p>The SQL RAND() function is used to generate some random numbers at run time. Here is the syntax:</p>
<p><strong>Syntax</strong></p>
<pre>RAND <strong>(</strong> [ <em>seed </em>] <strong>)</strong></pre>
<p>Repetitive calls of RAND() with the same seed value return the same results.</p>
<p>For one connection, if RAND() is called with a specified seed value, all   subsequent calls of RAND() produce results based on the seeded RAND() call. For example,   the following query will always return the same sequence of numbers.</p>
<pre>SELECT RAND(100), RAND(), RAND()</pre>
<p><strong>Examples</strong>:</p>
<p>The following example produces four different random numbers that   are generated by the RAND function.</p>
<pre>DECLARE @counter smallint
SET @counter = 1
WHILE @counter &lt; 5
BEGIN
SELECT RAND() Random_Number
SET @counter = @counter + 1
END
GO</pre>
<p>The following example returns random float numbers based on three   different seed values.</p>
<pre>CREATE TABLE Random (Seed1 float, Seed5 float, Seed10 float)
INSERT INTO Random Values (RAND(1), RAND(5), RAND(10))
SELECT * FROM Random</pre>
<p>The RAND   function is a pseudorandom number generator that operates in a manner similar to   the C run-time library <strong>rand</strong> function. If no seed is provided, the system   generates its own variable seed numbers. If you call RAND with a seed value,   you must use variable seed values to generate random numbers. If you call RAND multiple times with   the same seed value, it returns the same generated value. The following script   returns the same value for the calls to RAND because they all use the same seed value:</p>
<pre>SELECT RAND(159784)
SELECT RAND(159784)
SELECT RAND(159784)</pre>
<p>A common way to generate random numbers from RAND is to include   something relatively variable as the seed value, such as adding several parts of   a GETDATE:</p>
<pre>SELECT RAND( (DATEPART(mm, GETDATE()) * 100000 )
+ (DATEPART(ss, GETDATE()) * 1000 )
+ DATEPART(ms, GETDATE()) )</pre>
<blockquote><p>When you use an algorithm based on GETDATE to generate seed values, RAND can still generate   duplicate values if the calls to RAND are made within the interval of the smallest datepart   used in the algorithm. This is especially likely when the calls to RAND are included in a   single batch. Multiple calls to RAND in a single batch can be executed within the same   millisecond. This is the smallest increment of DATEPART. In this case,   incorporate a value based on something other than time to generate the seed   values.</p></blockquote>
  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/sqlhelp.wordpress.com/196/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/sqlhelp.wordpress.com/196/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/sqlhelp.wordpress.com/196/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/sqlhelp.wordpress.com/196/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/sqlhelp.wordpress.com/196/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/sqlhelp.wordpress.com/196/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/sqlhelp.wordpress.com/196/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/sqlhelp.wordpress.com/196/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/sqlhelp.wordpress.com/196/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/sqlhelp.wordpress.com/196/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=sqlhelp.wordpress.com&blog=5672629&post=196&subd=sqlhelp&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://sqlhelp.wordpress.com/2008/12/14/sql-rand-function/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/344460fcb9807a37c97174a2edc9d970?s=96&#38;d=identicon" medium="image">
			<media:title type="html">Raghunath Bhandari</media:title>
		</media:content>
	</item>
		<item>
		<title>How to use Bulk Insert</title>
		<link>http://sqlhelp.wordpress.com/2008/12/12/how-to-use-bulk-insert/</link>
		<comments>http://sqlhelp.wordpress.com/2008/12/12/how-to-use-bulk-insert/#comments</comments>
		<pubDate>Fri, 12 Dec 2008 05:14:38 +0000</pubDate>
		<dc:creator>Raghunath Bhandari</dc:creator>
				<category><![CDATA[Bulk Insert]]></category>
		<category><![CDATA[Advance SQL tips and tricks]]></category>
		<category><![CDATA[BCP T-SQL]]></category>
		<category><![CDATA[BCP Utility in SQL server]]></category>
		<category><![CDATA[Bulk Insert in SQL]]></category>
		<category><![CDATA[DBA help]]></category>
		<category><![CDATA[How to use BCP in SQL]]></category>
		<category><![CDATA[Microsoft SQL server]]></category>
		<category><![CDATA[MSSQL]]></category>
		<category><![CDATA[MSSQL server]]></category>
		<category><![CDATA[SQL Database Settings Optimization Tips]]></category>
		<category><![CDATA[SQL developer tips]]></category>
		<category><![CDATA[SQL help]]></category>
		<category><![CDATA[SQL Indexing Service]]></category>
		<category><![CDATA[SQL Optimization]]></category>
		<category><![CDATA[SQL Server]]></category>
		<category><![CDATA[SQL server tips]]></category>
		<category><![CDATA[SQL Tips]]></category>
		<category><![CDATA[sqlhelp]]></category>
		<category><![CDATA[upload CSV file in SQL]]></category>
		<category><![CDATA[upload text file in SQL]]></category>

		<guid isPermaLink="false">http://sqlhelp.wordpress.com/?p=192</guid>
		<description><![CDATA[Introduction Bulk Insert:

The Bulk Insert task provides the quickest way to copy large amounts of data   into a SQL Server table or view. For example, suppose your company stores its   million-row product list on a mainframe system, but the company&#8217;s e-commerce   system uses SQL Server 2005 to populate Web [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=sqlhelp.wordpress.com&blog=5672629&post=192&subd=sqlhelp&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p><strong><span>Introduction Bulk Insert:<br />
</span></strong><br />
The Bulk Insert task provides the quickest way to copy large amounts of data   into a SQL Server table or view. For example, suppose your company stores its   million-row product list on a mainframe system, but the company&#8217;s e-commerce   system uses SQL Server 2005 to populate Web pages. You must update the SQL   Server product table nightly with the master product list from the mainframe. To   update the table, you save the product list in a tab-delimited format and use   the Bulk Insert task to copy the data directly into the SQL Server table.</p>
<p>To ensure high-speed data copying, transformations cannot be performed on the   data while it is moving from the source file to the table or view.</p>
<p>You can configure the Bulk Insert task in the following ways:</p>
<ul>
<li>Specify the OLE DB connection manager to connect to the destination SQL   Server database and the table or view into which data is inserted.</li>
<li>Specify the File or Flat File connection manager to access the source file   and provide information about the source data file, such as the code page and   file type.</li>
<li>Define the format used by the Bulk Insert task, either by using a format   file or by defining the column and row delimiters of the source data. If using a   format file, specify the File connection manager to access the format   file.</li>
<li>Specify actions to perform on the destination table or view when inserting   the data. The options include whether to check constraints, enable identity   inserts, keep nulls, fire triggers, or lock the table.</li>
<li>Provide information about the batch of data to insert, such as the batch   size, the first and last row from the file to insert, the number of insert   errors that can occur before the task stops inserting rows, and the names of the   columns that will be sorted.</li>
</ul>
<blockquote><p>If the Bulk Insert task uses a Flat File connection manager to access the   source file, the task does not use the format specified in the Flat File   connection manager. Instead, the Bulk Insert task uses either the format   specified in a format file, or the values of the <strong>RowDelimiter</strong> and <strong>ColumnDelimiter</strong> properties of the task.</p></blockquote>
<p><strong>BULK INSERT (Transact-SQL)</strong></p>
<pre>BULK INSERT
   [ database_name . [ schema_name ] . | schema_name . ] [ table_name | view_name ]
      FROM 'data_file'
     [ WITH
    (
   [ [ , ] BATCHSIZE = batch_size ]
   [ [ , ] CHECK_CONSTRAINTS ]
   [ [ , ] CODEPAGE = { 'ACP' | 'OEM' | 'RAW' | 'code_page' } ]
   [ [ , ] DATAFILETYPE  =
      { 'char' | 'native'| 'widechar' | 'widenative' } ]
   [ [ , ] FIELDTERMINATOR = 'field_terminator' ]
   [ [ , ] FIRSTROW  =first_row ]
   [ [ , ] FIRE_TRIGGERS ]
   [ [ , ] FORMATFILE = 'format_file_path' ]
   [ [ , ] KEEPIDENTITY ]
   [ [ , ] KEEPNULLS ]
   [ [ , ] KILOBYTES_PER_BATCH =kilobytes_per_batch ]
   [ [ , ] LASTROW = last_row ]
   [ [ , ] MAXERRORS = max_errors ]
   [ [ , ] ORDER ( { column [ ASC | DESC ] } [ ,...n ] ) ]
   [ [ , ] ROWS_PER_BATCH = rows_per_batch ]
   [ [ , ] ROWTERMINATOR = 'row_terminator' ]
   [ [ , ] TABLOCK ]
   [ [ , ] ERRORFILE = 'file_name' ]
    )]</pre>
<p><strong>Examples</strong></p>
<p><strong> A. Using pipes to import data from a file</strong>:</p>
<p>This example imports order detail information into the   AdventureWorks.Sales.SalesOrderDetail table from the specified data   file by using a pipe (|) as the field terminator and |n as the row terminator.</p>
<pre>BULK INSERT AdventureWorks.Sales.SalesOrderDetail
FROM 'f:orderslineitem.txt'
WITH
(
FIELDTERMINATOR =' |',
ROWTERMINATOR =' |n'
)</pre>
<p><strong>B. Using the FIRE_TRIGGERS argument</p>
<p></strong>This example specifies the FIRE_TRIGGERS argument.</p>
<pre>BULK INSERT AdventureWorks.Sales.SalesOrderDetail
FROM 'f:orderslineitem.txt'
WITH
(
FIELDTERMINATOR =' |',
ROWTERMINATOR = ':n',
FIRE_TRIGGERS        )</pre>
<p><strong>C. Using line feed as a row terminator </strong></p>
<p>This example loads a file that uses the line feed as a row terminator such as a UNIX output:</p>
<pre>DECLARE @bulk_cmd varchar(1000)
SET @bulk_cmd = 'BULK INSERT AdventureWorks.Sales.SalesOrderDetail
FROM ''&lt;drive&gt;:&lt;path&gt;&lt;filename&gt;''
WITH (ROWTERMINATOR = '''+CHAR(10)+''')'
EXEC(@bulk_cmd)</pre>
  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/sqlhelp.wordpress.com/192/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/sqlhelp.wordpress.com/192/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/sqlhelp.wordpress.com/192/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/sqlhelp.wordpress.com/192/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/sqlhelp.wordpress.com/192/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/sqlhelp.wordpress.com/192/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/sqlhelp.wordpress.com/192/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/sqlhelp.wordpress.com/192/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/sqlhelp.wordpress.com/192/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/sqlhelp.wordpress.com/192/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=sqlhelp.wordpress.com&blog=5672629&post=192&subd=sqlhelp&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://sqlhelp.wordpress.com/2008/12/12/how-to-use-bulk-insert/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/344460fcb9807a37c97174a2edc9d970?s=96&#38;d=identicon" medium="image">
			<media:title type="html">Raghunath Bhandari</media:title>
		</media:content>
	</item>
		<item>
		<title>What is BCP Utility in SQL server?</title>
		<link>http://sqlhelp.wordpress.com/2008/12/12/what-is-bcp-utility-in-sql-server/</link>
		<comments>http://sqlhelp.wordpress.com/2008/12/12/what-is-bcp-utility-in-sql-server/#comments</comments>
		<pubDate>Fri, 12 Dec 2008 05:09:12 +0000</pubDate>
		<dc:creator>Raghunath Bhandari</dc:creator>
				<category><![CDATA[BCP Utility]]></category>
		<category><![CDATA[Advance SQL tips and tricks]]></category>
		<category><![CDATA[BCP T-SQL]]></category>
		<category><![CDATA[BCP Utility in SQL server]]></category>
		<category><![CDATA[DBA help]]></category>
		<category><![CDATA[How to use BCP in SQL]]></category>
		<category><![CDATA[Microsoft SQL server]]></category>
		<category><![CDATA[MSSQL]]></category>
		<category><![CDATA[MSSQL server]]></category>
		<category><![CDATA[SQL Database Settings Optimization Tips]]></category>
		<category><![CDATA[SQL developer tips]]></category>
		<category><![CDATA[SQL help]]></category>
		<category><![CDATA[SQL Indexing Service]]></category>
		<category><![CDATA[SQL Optimization]]></category>
		<category><![CDATA[SQL Server]]></category>
		<category><![CDATA[SQL server tips]]></category>
		<category><![CDATA[SQL Tips]]></category>
		<category><![CDATA[sqlhelp]]></category>

		<guid isPermaLink="false">http://sqlhelp.wordpress.com/?p=188</guid>
		<description><![CDATA[Introduction BCP Utility:
The bcp utility bulk copies data between an instance of Microsoft SQL Server 2005 and a   data file in a user-specified format. The bcp utility can be   used to import large numbers of new rows into SQL Server tables or to export   data out of tables into [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=sqlhelp.wordpress.com&blog=5672629&post=188&subd=sqlhelp&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p><strong>Introduction BCP Utility:</strong></p>
<p>The bcp utility bulk copies data between an instance of Microsoft SQL Server 2005 and a   data file in a user-specified format. The bcp utility can be   used to import large numbers of new rows into SQL Server tables or to export   data out of tables into data files. Except when used with the queryout option, the utility requires no knowledge of Transact-SQL. To import data into a   table, you must either use a format file created for that table or understand   the structure of the table and the types of data that are valid for its columns.</p>
<p><strong>Syntax</strong>:</p>
<pre>bcp {[[database_name.][owner].]{table_name | view_name} | "query"}
    {in | out | queryout | format} data_file
    [-mmax_errors] [-fformat_file] [-x] [-eerr_file]
    [-Ffirst_row] [-Llast_row] [-bbatch_size]
    [-n] [-c] [-w] [-N] [-V (60 | 65 | 70 | 80)] [-6]
    [-q] [-C { ACP | OEM | RAW | code_page } ] [-tfield_term]
    [-rrow_term] [-iinput_file] [-ooutput_file] [-apacket_size]
    [-Sserver_name[instance_name]] [-Ulogin_id] [-Ppassword]
    [-T] [-v] [-R] [-k] [-E] [-h"hint [,...n]"]</pre>
<p><strong>Examples</strong>:</p>
<p><strong>Copying Table Rows into a Data File (with a   Trusted Connection)</strong></p>
<p>The following example illustrates the out option on the   AdventureWorks.Sales.Currency table. This example creates a data   file named Currency.dat and copies the table data into it using   character format. The example assumes that you are using Windows Authentication   and have a trusted connection to the server instance on which you are running   the bcp command.</p>
<p>At a command prompt, enter the following command:</p>
<pre>bcp AdventureWorks.Sales.Currency out Currency.dat -T -c</pre>
<p><strong><br />
Copying Table Rows into a Data File (with   Mixed-Mode Authentication)</strong></p>
<p>The following example illustrates the out option on the   AdventureWorks.Sales.Currency table. This example creates a data   file named Currency.dat and copies the table data into it using   character format.</p>
<blockquote><p>he example assumes that you are using mixed-mode authentication, you   must use the -U switch to specify your login ID. Also, unless you are   connecting to the default instance of SQL Server on the local computer, use the -S switch to specify the system name and, optionally, an instance   name.</p></blockquote>
<pre>bcp AdventureWorks.Sales.Currency out
Currency.dat -c -U<em>&lt;login_id&gt; -S&lt;server_nameinstance_name&gt;</em></pre>
<p>The system will prompt you for your password.</p>
<p><strong>Copying Data from a File to a Table</strong></p>
<p>The following example illustrates the in option by using the   file created in the preceding example (Currency.dat). First,   however, this example creates an empty copy of the AdventureWorks   Sales.Currency table, Sales.Currency2, into which the data   is copied. The example assumes that you are using Windows Authentication and   have a trusted connection to the server instance on which you are running the bcp command.</p>
<p>To create the empty table, in Query Editor, enter the following   command:</p>
<pre>USE AdventureWorks;
GO
SELECT * INTO AdventureWorks.Sales.Currency2
FROM AdventureWorks.Sales.Currency WHERE 1=2</pre>
<p>To bulk copy the character data into the new table&#8211;that is, to   import the data&#8211;enter the following command at a command prompt:</p>
<pre>bcp AdventureWorks.Sales.Currency2
in Currency.dat -T -c</pre>
<p>To verify that the command succeeded, display the contents of the   table in Query Editor, and enter</p>
<pre>USE AdventureWorks;
GO
SELECT * FROM Sales.Currency2</pre>
<p><strong><br />
Copying a Specific Column into a Data File</strong></p>
<p>To copy a specific column, you can use the queryout option.   The following example copies only the Name column of the   Sales.Currency table into a data file. The example assumes that you   are using Windows Authentication and have a trusted connection to the server   instance on which you are running the bcp command.</p>
<p>At the Windows command prompt, enter:</p>
<pre>bcp "SELECT Name FROM AdventureWorks.Sales.Currency"
queryout Currency.Name.dat -T -c</pre>
<p><strong><br />
</strong></p>
<p><strong>Copying Data From a Query to a Data File</strong></p>
<p>To copy the result set from a Transact-SQL statement to a data file,   use the queryout option. The following example copies the names from the   AdventureWorks.Person.Contact table, ordered by last name then   first name, into the Contacts.txt data file. The example assumes   that you are using Windows Authentication and have a trusted connection to the   server instance on which you are running the bcp command.</p>
<p>At the Windows command prompt, enter:</p>
<pre>bcp "SELECT FirstName, LastName FROM
AdventureWorks.Person.Contact
ORDER BY LastName, Firstname"
queryout Contacts.txt -c -T</pre>
<p><strong><br />
Creating a Non-XML Format File</strong></p>
<p>a non-XML format file, Currency.fmt, for the   Sales.Currency table in the AdventureWorks database.   The example assumes that you are using Windows Authentication and have a trusted   connection to the server instance on which you are running the bcp command.</p>
<p>At the Windows command prompt, enter:</p>
<pre>bcp AdventureWorks.Sales.Currency
format nul -T -c  -f Currency.fmt</pre>
<p><strong></strong></p>
<p><strong>Creating an XML Format File</strong></p>
<p>The following example creates an XML format file named   Currency.xml for the Sales.Currency table in the   AdventureWorks database. The example assumes that you are using   Windows Authentication and have a trusted connection to the server instance on   which you are running the bcp command.</p>
<p>At the Windows command prompt, enter:</p>
<pre>bcp AdventureWorks.Sales.Currency
format nul -T -c -x -f Currency.xml</pre>
<p><strong></strong></p>
<p><strong>Using a Format File to Bulk Import with bcp</strong></p>
<p>To use a previously created format file when importing data into an   instance of SQL Server, use the -f switch with the in option. For   example, the following command bulk copies the contents of a data file,   Currency.dat, into a copy of the Sales.Currency table   (Sales.Currency2) by using the previously created format file   (Currency.xml). The example assumes that you are using Windows   Authentication and have a trusted connection to the server instance on which you   are running the bcp command.</p>
<p>At the Windows command prompt, enter:</p>
<pre>bcp AdventureWorks.Sales.Currency2
in Currency.dat -T -f Currency.xml</pre>
  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/sqlhelp.wordpress.com/188/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/sqlhelp.wordpress.com/188/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/sqlhelp.wordpress.com/188/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/sqlhelp.wordpress.com/188/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/sqlhelp.wordpress.com/188/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/sqlhelp.wordpress.com/188/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/sqlhelp.wordpress.com/188/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/sqlhelp.wordpress.com/188/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/sqlhelp.wordpress.com/188/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/sqlhelp.wordpress.com/188/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=sqlhelp.wordpress.com&blog=5672629&post=188&subd=sqlhelp&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://sqlhelp.wordpress.com/2008/12/12/what-is-bcp-utility-in-sql-server/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/344460fcb9807a37c97174a2edc9d970?s=96&#38;d=identicon" medium="image">
			<media:title type="html">Raghunath Bhandari</media:title>
		</media:content>
	</item>
		<item>
		<title>Tips And Tricks For Advanced MS SQL Server Developers</title>
		<link>http://sqlhelp.wordpress.com/2008/12/01/tips-and-tricks-for-advanced-ms-sql-server-developers/</link>
		<comments>http://sqlhelp.wordpress.com/2008/12/01/tips-and-tricks-for-advanced-ms-sql-server-developers/#comments</comments>
		<pubDate>Mon, 01 Dec 2008 10:03:28 +0000</pubDate>
		<dc:creator>Raghunath Bhandari</dc:creator>
				<category><![CDATA[SQL Tricks]]></category>
		<category><![CDATA[Advance SQL tips and tricks]]></category>
		<category><![CDATA[Author Raghunath Bhandari]]></category>
		<category><![CDATA[Database]]></category>
		<category><![CDATA[Database Optimization Tips]]></category>
		<category><![CDATA[dba]]></category>
		<category><![CDATA[DBA help]]></category>
		<category><![CDATA[MCP]]></category>
		<category><![CDATA[Microsoft Certified Professional]]></category>
		<category><![CDATA[Microsoft SQL server]]></category>
		<category><![CDATA[MSDN Help]]></category>
		<category><![CDATA[MSDN SQL News]]></category>
		<category><![CDATA[MSSQL]]></category>
		<category><![CDATA[MSSQL server]]></category>
		<category><![CDATA[SQL]]></category>
		<category><![CDATA[SQL Database Optimization Tricks]]></category>
		<category><![CDATA[SQL Database Settings Optimization Tips]]></category>
		<category><![CDATA[SQL developer tips]]></category>
		<category><![CDATA[SQL Documentation]]></category>
		<category><![CDATA[SQL help]]></category>
		<category><![CDATA[SQL Indexing Service]]></category>
		<category><![CDATA[SQL Optimization]]></category>
		<category><![CDATA[SQL Optimization Tips]]></category>
		<category><![CDATA[SQL Query]]></category>
		<category><![CDATA[SQL Server]]></category>
		<category><![CDATA[SQL server tips]]></category>
		<category><![CDATA[SQL technology]]></category>
		<category><![CDATA[SQL Tips]]></category>
		<category><![CDATA[SQL Tips and Tricks]]></category>
		<category><![CDATA[SQL tips for programmer]]></category>
		<category><![CDATA[sqlhelp]]></category>
		<category><![CDATA[sqlhelp news]]></category>
		<category><![CDATA[sqlhelp WebSite Review]]></category>
		<category><![CDATA[T-SQL]]></category>
		<category><![CDATA[Technology News]]></category>
		<category><![CDATA[Tips And Tricks For Advanced MS SQL Server Developers]]></category>

		<guid isPermaLink="false">http://sqlhelp.wordpress.com/?p=114</guid>
		<description><![CDATA[Tips And Tricks For Advanced MS SQL Server Developers:

 Use “TRUNCATE TABLE” statement instead of “DELETE” clause if you  want to delete all rows from a table. It is much faster then “DELETE”  statement without any conditions. “TRUNCATE TABLE” frees all the space  occupied by that table&#8217;s data and indexes, without logging [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=sqlhelp.wordpress.com&blog=5672629&post=114&subd=sqlhelp&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p><strong>Tips And Tricks For Advanced MS SQL Server Developers:</strong></p>
<ol>
<li> Use “TRUNCATE TABLE” statement instead of “DELETE” clause if you  want to delete all rows from a table. It is much faster then “DELETE”  statement without any conditions. “TRUNCATE TABLE” frees all the space  occupied by that table&#8217;s data and indexes, without logging the  individual row deletes.</li>
<li>Always use owner prefix in T-SQL  queries:<code><br />
</code></p>
<pre>SELECT mycolumn FROM dbo.mytable</pre>
<p>In this case query optimizer does not have to decide whether to  retrieve from dbo.mytable or other owner’s table and avoids  recompilation.  Recompilation results in no performance advantages of  stored procedures usage.</li>
<li> Don&#8217;t use “sp_“ as your prefix for stored procedures – it is a  reserved prefix in MS SQL server! MS SQL server searches for a stored  procedure with “sp_” prefix in the system procedures first, and only  after that looks for them in client procedures.</li>
<li> If you are unable to install MSDE at home because of unknown error –  check that you did not stop “Server” system service on you PC…</li>
<li> There are thousands of examples, when developers use “SELECT  COUNT(*)” statement. But there is another, much faster way to  accomplish the task:<code> </code>
<pre>SELECT rows FROM sysindexes WHERE id = OBJECT_ID('Table_Name') AND indid &lt; 2</pre>
</li>
<li> Include &#8220;SET NOCOUNT ON” statement in your stored procedures to greatly reduce network traffic.</li>
<li> Use the “BETWEEN” clause instead of “IN” for greater performance:<code><br />
SELECT productId FROM customer<br />
WHERE productId BETWEEN 1 AND 9</code></p>
<p>Instead of:</p>
<pre>SELECT productId
FROM customer
WHERE productId IN (1, 2, 3, 4,5,6,7,8,9)</pre>
</li>
<li>
<blockquote><p>Use Table variables &#8211; new feature of MS SQL 2000 instead of temp  tables. Table variables are created in memory, not written to the  tempdb database, and therefore they are much faster. However, be  careful to use them only with not very huge amount of data that you  want to allocate in temp tables, otherwise you can easily get the  server down.</p></blockquote>
</li>
</ol>
  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/sqlhelp.wordpress.com/114/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/sqlhelp.wordpress.com/114/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/sqlhelp.wordpress.com/114/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/sqlhelp.wordpress.com/114/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/sqlhelp.wordpress.com/114/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/sqlhelp.wordpress.com/114/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/sqlhelp.wordpress.com/114/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/sqlhelp.wordpress.com/114/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/sqlhelp.wordpress.com/114/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/sqlhelp.wordpress.com/114/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=sqlhelp.wordpress.com&blog=5672629&post=114&subd=sqlhelp&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://sqlhelp.wordpress.com/2008/12/01/tips-and-tricks-for-advanced-ms-sql-server-developers/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/344460fcb9807a37c97174a2edc9d970?s=96&#38;d=identicon" medium="image">
			<media:title type="html">Raghunath Bhandari</media:title>
		</media:content>
	</item>
		<item>
		<title>Database Settings Optimization Tips</title>
		<link>http://sqlhelp.wordpress.com/2008/12/01/90/</link>
		<comments>http://sqlhelp.wordpress.com/2008/12/01/90/#comments</comments>
		<pubDate>Mon, 01 Dec 2008 06:18:19 +0000</pubDate>
		<dc:creator>Raghunath Bhandari</dc:creator>
				<category><![CDATA[Database Settings]]></category>
		<category><![CDATA[Advance SQL tips and tricks]]></category>
		<category><![CDATA[Database Optimization Tips]]></category>
		<category><![CDATA[Microsoft SQL server]]></category>
		<category><![CDATA[MSSQL]]></category>
		<category><![CDATA[MSSQL server]]></category>
		<category><![CDATA[SQL Database Optimization Tricks]]></category>
		<category><![CDATA[SQL Database Settings Optimization Tips]]></category>
		<category><![CDATA[SQL help]]></category>
		<category><![CDATA[SQL Optimization Tips]]></category>
		<category><![CDATA[SQL Server]]></category>
		<category><![CDATA[SQL server tips]]></category>
		<category><![CDATA[SQL Tips]]></category>
		<category><![CDATA[SQL tips for programmer]]></category>
		<category><![CDATA[sqlhelp]]></category>

		<guid isPermaLink="false">http://sqlhelp.wordpress.com/2008/12/01/90/</guid>
		<description><![CDATA[Database Settings Optimization Tips

You can turn off the &#8216;auto create statistics&#8217; database option.When this database option is set to true, statistics are automatically created on columns used in a predicate. By default, this database option is set to true. Because auto creation statistics results in some performance degradation, you can turn off this database option [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=sqlhelp.wordpress.com&blog=5672629&post=90&subd=sqlhelp&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p><span style="color:#008000;"><strong>Database Settings Optimization Tips</strong></span></p>
<ul>
<li><strong>You can turn off the &#8216;auto create statistics&#8217; database option.</strong>When this database option is set to true, statistics are automatically created on columns used in a predicate. By default, this database option is set to true. Because auto creation statistics results in some performance degradation, you can turn off this database option and create statistics manually during off-peak times by using the CREATE STATISTICS statement. By the way, in most cases, it will not provide some performance benefits.</li>
<li><strong>You can turn off the &#8216;auto update statistics&#8217; database option.</strong>When this database option is set to true, existing statistics are automatically updated when the statistics become out-of-date. By default, this database option is set to true. Because auto update statistics results in some performance degradation, you can turn off this database option and update statistics manually during off-peak times by using the UPDATE STATISTICS statement. By the way, in most cases, it will not provide some performance benefits.</li>
<li><strong>Turn off the &#8216;autoclose&#8217; database option.</strong>When this option is turned on, the database&#8217;s resources are freed after the last user exits. When the new user will connect to database, the database should be reopened, which takes some time. So, do hot set this database option to true on your production server. By default, this database option is set to true when using SQL Server Desktop Edition, and set to false for all other editions.</li>
<li><strong>Turn off the &#8216;autoshrink&#8217; database option.</strong>When this database option is set to true, the database files will be periodically shrink. Autoshrinking results in some performance degradation, therefore you should shrink the database manually or create a scheduled task to shrink the database periodically during off-peak times, rather than set Autoshrink feature to on. By default, this database option is set to true when using SQL Server Desktop Edition, and set to false for all other editions.</li>
<li><strong>You can turn on the &#8216;read-only&#8217; database option to prevent users to modify the database&#8217;s data.</strong>By default, this database option is set to false. If you have data that should not be modified, you can place it into another database and set for this database the &#8216;read-only&#8217; option to true. It can increase the speed of your queries. If you need to allow permissions management (for example, prevent some users to select data from some tables), you should create another filegroup and make only this filegroup read-only, because when the &#8216;read-only&#8217; database option is set to true, the database&#8217;s system tables will be also read-only and this will prevent the permissions management.</li>
<li><strong>You can turn on the &#8217;select into/bulkcopy&#8217; database option to allow SELECT INTO statements and nonlogged bulk copies.</strong>The nonlogged bulk copy is		 	much faster than logged one, but to use it you must provide all the following conditions:1. The database option &#8217;select into/bulkcopy&#8217; is set to true.<br />
<blockquote><p>2. The target table is not being replicated.<br />
3. The TABLOCK hint is specified.<br />
4. The target table has no indexes, or if the table has indexes, it is empty when the bulk copy starts.<br />
By default, this database option is set to false.</p></blockquote>
</li>
<li><strong>You can turn off the &#8216;trunc. log on chkpt.&#8217; database option to prevent the transaction log from truncating on checkpoint.</strong>This option can be set if the transaction log grows very quickly to prevent the transaction log from filling rapidly and running out of disk space. If you set the &#8216;trunc. log on chkpt.&#8217; database option to true, the transaction log cannot be backed up, so you cannot restore your data to the point of failure (only to the time when the last full backup was made). So, the general recommendation about this option is allow it to be turned off, and make the transaction log backup periodically to truncate the log. By default, this database option is set to true when using SQL Server Desktop Edition, and set to false for all other editions.</li>
</ul>
<blockquote><p><strong> Note. You can set the above database options by using the sp_dboption system stored procedure or Enterprise Manager. If you want to set the above database options for the newly created database, you should set these options for the model database.</strong></p></blockquote>
  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/sqlhelp.wordpress.com/90/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/sqlhelp.wordpress.com/90/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/sqlhelp.wordpress.com/90/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/sqlhelp.wordpress.com/90/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/sqlhelp.wordpress.com/90/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/sqlhelp.wordpress.com/90/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/sqlhelp.wordpress.com/90/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/sqlhelp.wordpress.com/90/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/sqlhelp.wordpress.com/90/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/sqlhelp.wordpress.com/90/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=sqlhelp.wordpress.com&blog=5672629&post=90&subd=sqlhelp&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://sqlhelp.wordpress.com/2008/12/01/90/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/344460fcb9807a37c97174a2edc9d970?s=96&#38;d=identicon" medium="image">
			<media:title type="html">Raghunath Bhandari</media:title>
		</media:content>
	</item>
		<item>
		<title>SQL Server Settings Optimization Tips</title>
		<link>http://sqlhelp.wordpress.com/2008/12/01/sql-server-settings-optimization-tips/</link>
		<comments>http://sqlhelp.wordpress.com/2008/12/01/sql-server-settings-optimization-tips/#comments</comments>
		<pubDate>Mon, 01 Dec 2008 05:27:26 +0000</pubDate>
		<dc:creator>Raghunath Bhandari</dc:creator>
				<category><![CDATA[SQL Optimization]]></category>
		<category><![CDATA[Advance SQL tips and tricks]]></category>
		<category><![CDATA[Database Optimization Tips]]></category>
		<category><![CDATA[Microsoft SQL server]]></category>
		<category><![CDATA[MSSQL]]></category>
		<category><![CDATA[MSSQL server]]></category>
		<category><![CDATA[SQL Database Optimization Tricks]]></category>
		<category><![CDATA[SQL Database Settings Optimization Tips]]></category>
		<category><![CDATA[SQL help]]></category>
		<category><![CDATA[SQL Optimization Tips]]></category>
		<category><![CDATA[SQL Server]]></category>
		<category><![CDATA[SQL server tips]]></category>
		<category><![CDATA[SQL Tips]]></category>
		<category><![CDATA[SQL tips for programmer]]></category>
		<category><![CDATA[sqlhelp]]></category>

		<guid isPermaLink="false">http://sqlhelp.wordpress.com/?p=75</guid>
		<description><![CDATA[SQL Server Settings Optimization Tips:

 You can increase the &#8216;min memory per query&#8217; option to improve the performance of queries that use hashing or sorting operations, if your SQL Server has a lot of memory available and there are many queries running concurrently on the server.
The SQL Server will automatically allocate, at a minimum, the [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=sqlhelp.wordpress.com&blog=5672629&post=75&subd=sqlhelp&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p><span style="color:#008000;"><strong>SQL Server Settings Optimization Tips:</strong></span></p>
<ol>
<li> <strong>You can increase the &#8216;min memory per query&#8217; option to improve the performance of queries that use hashing or sorting operations, if your SQL Server has a lot of memory available and there are many queries running concurrently on the server.</strong><br />
The SQL Server will automatically allocate, at a minimum, the amount of memory set in this configuration setting. The default &#8216;min memory per query&#8217; option is equal to 1024 Kb.</li>
<li><strong>You can increase the &#8216;max async IO&#8217; option if your SQL Server works on a high performance server with high-speed intelligent disk subsystem (such as hardware-based RAID with more than 10 disks).</strong><br />
This option specifies the maximum number of outstanding asynchronous disk I/O requests that the entire server can issue against a file. By the way, the &#8216;max async IO&#8217; SQL Server option is no longer supported in SQL Server 2000.</li>
<li><strong>You can change the &#8216;network packet size&#8217; option to the appropriate value.</strong><br />
This option can improve performance on networks whose base topology supports larger packets than TCP/IP&#8217;s default of 4096 bytes. For example, if client sends or receives large amounts of data, a larger packet size can improve performance, because it results in fewer network reads and writes. The default value for the &#8216;network packet size&#8217; option is 4096 bytes. Microsoft does not recommend changing this option, because for most applications, the default packet size of 4096 bytes is best.</li>
<li><strong>You can change the &#8216;fill factor&#8217; option to the appropriate value.</strong><br />
<blockquote><p>The &#8216;fill factor&#8217; option specifies how full SQL Server will make each index page. When there is no free space to insert new row on the index page, SQL Server will create new index page and transfer some rows from the previous page to the new one. This operation is called page splits. You can reduce the number of page splits by setting the appropriate fill factor option to reserve free space on each index page. The fill factor is a value from 1 through 100 that specifies the percentage of the index page to be left empty. The default value for fill factor is 0. It is treated similarly to a fill factor value of 100, the difference in that SQL Server leaves some space within the upper level of the index tree for FILLFACTOR = 0. The fill factor percentage is used only at the time the index is created. If the table contains read-only data (or data that very rarely changed), you can set the &#8216;fill factor&#8217; option to 100. When the table&#8217;s data modified very often, you can decrease the &#8216;fill factor&#8217; option to 70 percent, for example.</p></blockquote>
</li>
<li><strong>You can increase the &#8216;recovery interval&#8217; value.</strong><br />
The &#8216;recovery interval&#8217; option specifies the maximum number of minutes per database that SQL Server needs to complete its recovery procedures. The default value of this option is 0. It means that SQL Server will automatically configure this option. SQL Server issues a checkpoint using the &#8216;recovery interval&#8217; option. Microsoft does not recommend changing this option in general case, but sometimes you can improve performance by changing this option. You can monitor disk-write activity on the data files, and if you see periodic spikes that send disk utilization to 100 percent, you can increase the recovery interval. In this case, Microsoft suggests setting the &#8216;recovery interval&#8217; option to 5 and continuing monitoring.<br />
<strong></strong></li>
<li><strong>You can set the &#8216;priority boost&#8217; SQL Server options to 1.</strong><br />
You can set this option to 1, if you want from SQL Server to work with a higher priority than other processes on the same computer. The default value is 0. Setting &#8216;priority boost&#8217; to 1 can degrade the performance of other applications running on the same computer with SQL Server. So, you should set the &#8216;priority boost&#8217; SQL Server options to 1 only if you have dedicated server to SQL Server. In other case, do not change this option.</li>
<li><strong>Set the &#8216;max worker threads&#8217; options to the maximum number of the user connections to your SQL Server box.</strong><br />
The default setting for the &#8216;max worker threads&#8217; option is 255. If the number of user connections will be less than the &#8216;max worker threads&#8217; value, a separate operating system thread will be created for each client connection, but if the number of user connections will exceed this value the thread pooling will be used. For example, if the maximum number of the user connections to your SQL Server box is equal to 50, you can set the &#8216;max worker threads&#8217; options to 50, this frees up resources for SQL Server to use elsewhere. If the maximum number of the user connections to your SQL Server box is equal to 500, you can set the &#8216;max worker threads&#8217; options to 500, this can improve SQL Server performance because thread pooling will not be used.</li>
<li><strong>You can specify the &#8216;min server memory&#8217; and &#8216;max server memory&#8217; options.</strong><br />
These options can be used to specify the fixed amount of memory to allocate to SQL Server. In this case, you should set the &#8216;min server memory&#8217; and &#8216;max server memory&#8217; to the same value (equal to the maximum amount of physical memory that SQL Server will use), and set the &#8217;set working set size&#8217; SQL Server option to 1. This can improve performance because SQL Server will not dynamically allocate memory. You can also change these options when SQL Server works on the same computer with other applications. In this case, the &#8216;min server memory&#8217; options is used to allow SQL Server works when other applications pretend to use all available memory, and the &#8216;max server memory&#8217; options is used to allow other applications work when SQL Server tried to use all available resources.</li>
<li><strong>You can specify the &#8217;set working set size&#8217; SQL Server option to reserve the amount of physical memory space for SQL Server.</strong><br />
Unlike SQL Server 6.5, SQL Server 7.0/2000 can automatically allocate memory (can take more memory if SQL Server need it, and can give memory back to operation system). This is one of the main advantages in comparison with previous versions, but dynamic memory allocation takes some time. If you know the maximum amount of physical memory that SQL Server will use, you can specify this amount by setting &#8216;min server memory&#8217; and &#8216;max server memory&#8217; to the same value (equal to the maximum amount of physical memory that SQL Server will use) and set the &#8217;set working set size&#8217;</li>
</ol>
  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/sqlhelp.wordpress.com/75/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/sqlhelp.wordpress.com/75/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/sqlhelp.wordpress.com/75/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/sqlhelp.wordpress.com/75/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/sqlhelp.wordpress.com/75/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/sqlhelp.wordpress.com/75/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/sqlhelp.wordpress.com/75/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/sqlhelp.wordpress.com/75/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/sqlhelp.wordpress.com/75/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/sqlhelp.wordpress.com/75/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=sqlhelp.wordpress.com&blog=5672629&post=75&subd=sqlhelp&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://sqlhelp.wordpress.com/2008/12/01/sql-server-settings-optimization-tips/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/344460fcb9807a37c97174a2edc9d970?s=96&#38;d=identicon" medium="image">
			<media:title type="html">Raghunath Bhandari</media:title>
		</media:content>
	</item>
		<item>
		<title>Basic Definitions</title>
		<link>http://sqlhelp.wordpress.com/2008/11/30/basic-definitions/</link>
		<comments>http://sqlhelp.wordpress.com/2008/11/30/basic-definitions/#comments</comments>
		<pubDate>Sun, 30 Nov 2008 07:05:24 +0000</pubDate>
		<dc:creator>Raghunath Bhandari</dc:creator>
				<category><![CDATA[Basic Definitions]]></category>
		<category><![CDATA[Advance SQL tips and tricks]]></category>
		<category><![CDATA[Database]]></category>
		<category><![CDATA[Database Optimization Tips]]></category>
		<category><![CDATA[dba]]></category>
		<category><![CDATA[Microsoft SQL server]]></category>
		<category><![CDATA[MSSQL]]></category>
		<category><![CDATA[MSSQL server]]></category>
		<category><![CDATA[SQL]]></category>
		<category><![CDATA[SQL Basic Definitions]]></category>
		<category><![CDATA[SQL Database Optimization Tricks]]></category>
		<category><![CDATA[SQL Database Settings Optimization Tips]]></category>
		<category><![CDATA[SQL Documentation]]></category>
		<category><![CDATA[SQL help]]></category>
		<category><![CDATA[SQL Optimization]]></category>
		<category><![CDATA[SQL Optimization Tips]]></category>
		<category><![CDATA[SQL Query]]></category>
		<category><![CDATA[SQL Server]]></category>
		<category><![CDATA[SQL server tips]]></category>
		<category><![CDATA[SQL technology]]></category>
		<category><![CDATA[SQL Tips]]></category>
		<category><![CDATA[SQL Tips and Tricks]]></category>
		<category><![CDATA[SQL tips for programmer]]></category>
		<category><![CDATA[sqlhelp]]></category>
		<category><![CDATA[T-SQL]]></category>

		<guid isPermaLink="false">http://sqlhelp.wordpress.com/?p=59</guid>
		<description><![CDATA[Definition of a Database
A database is a collection of related information, accessed and managed by its DBMS. After experimenting with hierarchical and networked DBMSs during the 1970’s, the IT industry became dominated by relational DBMSs (Or Object-Relational Database Management System) such as Informix database, Oracle, Sybase, and, later on, Microsoft SQL Server and the like.
In [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=sqlhelp.wordpress.com&blog=5672629&post=59&subd=sqlhelp&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p><strong>Definition of a Database</strong></p>
<p>A database is a collection of related information, accessed and managed by its DBMS. After experimenting with hierarchical and networked DBMSs during the 1970’s, the IT industry became dominated by relational DBMSs (Or Object-Relational Database Management System) such as Informix database, Oracle, Sybase, and, later on, Microsoft SQL Server and the like.</p>
<p>In a strictly technical sense, for any database to be defined as a &#8220;Truly Relational Model Database Management System,&#8221; it should, ideally, adhere to the twelve rules defined by Edgar F. Codd, pioneer in the field of relational databases. To date, while many come close, it is admitted that nothing on the market adheres 100% to those rules, any more than they are 100% ANSI-SQL compliant.</p>
<blockquote><p>While IBM and Oracle technically were the earliest on the RDBMS scene, many others have followed, and while it is unlikely that miniSQL still exist in their original form, Monty&#8217;s MySQL is still extant and thriving, along with the Ingres-descended PostgreSQL. Microsoft Access &#8211; the 1995+ versions, not the prior versions &#8211; were, despite various limitations, technically the closest thing to being &#8216;Truly Relational&#8217; DBMS&#8217;s for the desktop PC, with Visual FoxPro, and many other desktop products marketed at that time far less compliant with Codd&#8217;s Rules.</p></blockquote>
<p>A relational DBMS manages information about types of real-world things (entities) in the form of tables that represent the entities. A table is like a spreadsheet; each row represents a particular entity (instance&#8212;), and each column represents a type of information about the entity (domain). Sometimes entities are made up of smaller related entities, such as orders and order lines; and so one of the challenges of a multi-user DBMS is provide data about related entities from the standpoint of an instant of logical consistency.</p>
<p>Properly managed relational databases minimize the need for application programs to contain information about the physical storage of the data they access. To maximize the isolation of programs from data structures, relational DBMSs restrict data access to the messaging protocol SQL, a nonprocedural language that limits the programmer to specifying desired results. This message-based interface was a building block for the decentralization of computer hardware, because a program and data structure with such a minimal point of contact become feasible to reside on separate computers.</p>
<p><strong>Recoverability</strong></p>
<p>Recoverability means that, if a data entry error, program bug or hardware failure (Vista) occurs, the DBA can bring the database backward in time to its state at an instant of logical consistency before the damage was done. Recoverability activities include making database backups and storing them in ways that minimize the risk that they will be damaged or lost, such as placing multiple copies on removable media and storing them outside the affected area of an anticipated disaster. Recoverability is the DBA’s most important concern.</p>
<p>The backup of the database consists of data with timestamps combined with database logs to change the data to be consistent to a particular moment in time. It is possible to make a backup of the database containing only data without timestamps or logs, but the DBA must take the database offline to do such a backup.</p>
<p>The recovery tests of the database consist of restoring the data, then applying logs against that data to bring the database backup to consistency at a particular point in time up to the last transaction in the logs. Alternatively, an offline database backup can be restored simply by placing the data in-place on another copy of the database.</p>
<blockquote><p>If a DBA (or any administrator) attempts to implement a recoverability plan without the recovery tests, there is no guarantee that the backups are at all valid. In practice, in all but the most mature RDBMS packages, backups rarely are valid without extensive testing to be sure that no bugs or human error have corrupted the backups.</p></blockquote>
<p><strong>Security</strong><br />
Security means that users’ ability to access and change data conforms to the policies of the business and the delegation decisions of its managers. Like other metadata, a relational DBMS manages security information in the form of tables. These tables are the “keys to the kingdom” and so it is important to protect them from intruders.<br />
<strong><br />
Performance</strong></p>
<p>Performance means that the database does not cause unreasonable online response times, and it does not cause unattended programs to run for an unworkable period of time. In complex client/server and three-tier systems, the database is just one of many elements that determine the performance that online users and unattended programs experience. Performance is a major motivation for the DBA to become a generalist and coordinate with specialists in other parts of the system outside of traditional bureaucratic reporting lines.</p>
<p>Techniques for database performance tuning have changed as DBA&#8217;s have become more sophisticated in their understanding of what causes performance problems and their ability to diagnose the problem.</p>
<p>In the 1990s, DBAs often focused on the database as a whole, and looked at database-wide statistics for clues that might help them find out why the system was slow. Also, the actions DBAs took in their attempts to solve performance problems were often at the global, database level, such as changing the amount of computer memory available to the database, or changing the amount of memory available to any database program that needed to sort data.</p>
<blockquote><p>DBA&#8217;s now understand that performance problems initially must be diagnosed, and this is best done by examining individual SQL statements, table process, and system architecture, not the database as a whole. Various tools, some included with the database and some available from third parties, provide a behind the scenes look at how the database is handling the SQL statements, shedding light on what&#8217;s taking so long.Having identified the problem, the individual SQL statement can be clarify</p></blockquote>
<p><strong>Development/Testing Support</strong></p>
<p>Development and testing support is typically what the database administrator regards as his or her least important duty, while results-oriented managers consider it the DBA’s most important duty. Support activities include collecting sample production data for testing new and changed programs and loading it into test databases; consulting with programmers about performance tuning; and making table design changes to provide new kinds of storage for new program functions.</p>
  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/sqlhelp.wordpress.com/59/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/sqlhelp.wordpress.com/59/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/sqlhelp.wordpress.com/59/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/sqlhelp.wordpress.com/59/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/sqlhelp.wordpress.com/59/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/sqlhelp.wordpress.com/59/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/sqlhelp.wordpress.com/59/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/sqlhelp.wordpress.com/59/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/sqlhelp.wordpress.com/59/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/sqlhelp.wordpress.com/59/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=sqlhelp.wordpress.com&blog=5672629&post=59&subd=sqlhelp&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://sqlhelp.wordpress.com/2008/11/30/basic-definitions/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/344460fcb9807a37c97174a2edc9d970?s=96&#38;d=identicon" medium="image">
			<media:title type="html">Raghunath Bhandari</media:title>
		</media:content>
	</item>
		<item>
		<title>Indexing Service</title>
		<link>http://sqlhelp.wordpress.com/2008/11/30/indexing-service/</link>
		<comments>http://sqlhelp.wordpress.com/2008/11/30/indexing-service/#comments</comments>
		<pubDate>Sun, 30 Nov 2008 06:35:48 +0000</pubDate>
		<dc:creator>Raghunath Bhandari</dc:creator>
				<category><![CDATA[Indexing Service]]></category>
		<category><![CDATA[Advance SQL tips and tricks]]></category>
		<category><![CDATA[Author Raghunath Bhandari]]></category>
		<category><![CDATA[Database]]></category>
		<category><![CDATA[Database Optimization Tips]]></category>
		<category><![CDATA[dba]]></category>
		<category><![CDATA[MCP]]></category>
		<category><![CDATA[Microsoft Certified Professional]]></category>
		<category><![CDATA[Microsoft SQL server]]></category>
		<category><![CDATA[MSDN Help]]></category>
		<category><![CDATA[MSDN SQL News]]></category>
		<category><![CDATA[MSSQL]]></category>
		<category><![CDATA[MSSQL server]]></category>
		<category><![CDATA[SQL]]></category>
		<category><![CDATA[SQL Database Optimization Tricks]]></category>
		<category><![CDATA[SQL Database Settings Optimization Tips]]></category>
		<category><![CDATA[SQL Documentation]]></category>
		<category><![CDATA[SQL help]]></category>
		<category><![CDATA[SQL Indexing Service]]></category>
		<category><![CDATA[SQL Optimization]]></category>
		<category><![CDATA[SQL Optimization Tips]]></category>
		<category><![CDATA[SQL Query]]></category>
		<category><![CDATA[SQL Server]]></category>
		<category><![CDATA[SQL server tips]]></category>
		<category><![CDATA[SQL technology]]></category>
		<category><![CDATA[SQL Tips]]></category>
		<category><![CDATA[SQL Tips and Tricks]]></category>
		<category><![CDATA[SQL tips for programmer]]></category>
		<category><![CDATA[sqlhelp]]></category>
		<category><![CDATA[sqlhelp news]]></category>
		<category><![CDATA[sqlhelp WebSite Review]]></category>
		<category><![CDATA[T-SQL]]></category>
		<category><![CDATA[Technology News]]></category>

		<guid isPermaLink="false">http://sqlhelp.wordpress.com/?p=52</guid>
		<description><![CDATA[What is Indexing Service?
Indexing Service is a base service for Microsoft® Windows® 2000 or later that extracts content from files and constructs an indexed catalog to facilitate efficient and rapid searching.
Indexing Service can extract both text and property information from files on the local host and on remote, networked hosts. The files can be simply [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=sqlhelp.wordpress.com&blog=5672629&post=52&subd=sqlhelp&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p><strong>What is Indexing Service?</strong></p>
<p>Indexing Service is a base service for Microsoft® Windows® 2000 or later that extracts content from files and constructs an indexed catalog to facilitate efficient and rapid searching.</p>
<p>Indexing Service can extract both text and property information from files on the local host and on remote, networked hosts. The files can be simply members of a selected file system or part of a virtual Web hosted by, for example, Internet Information Services (IIS).</p>
<p>Indexing Service extracts the content by filtering—using filter components that understand a file&#8217;s format. The format could include multi-language features such as international languages and locales. A filter component implements the IFilter interface, which supplies methods to read a file to extract text and properties. Windows 2000 and Microsoft Windows XP supply filters for Microsoft Office files, Hypertext Markup Language (HTML) files, Multipurpose Internet Mail Extension (MIME) messages, and plain-text files.</p>
<p>Indexing Service then merges the extracted information into catalogs of indexes for efficient searches. Indexing is the overall process of filtering, creating index entries, and merging them into catalogs.</p>
<p>The final step in the indexing process is creation of a catalog that contains a master index (and any temporary word lists and shadow indexes) storing words and their locations within a set of indexed documents. Subsequently, searching, or querying, the catalogs for particular word combinations uses the master index as well as word lists and shadow indexes to execute queries quickly and efficiently.</p>
<p><strong>Windows 2000 and Windows XP include basic facilities for querying the Indexing Service catalog and for managing the state and properties of Indexing Service itself. These facilities include:</strong></p>
<ul>
<li> When Indexing Service is running, Start/Search/For Files or Folders uses the Indexing Service catalog.</li>
<li>The Indexing Service snap-in for the Microsoft Management Console (MMC) provides the means to start, stop, and pause Indexing Service, and to administer many of its properties, such as those defining its catalogs.</li>
<li>The Platform Software Development Kit (SDK) provides additional versatile and flexible facilities for programmatically interacting with Indexing Service. These facilities include:</li>
<li> Admin and Query Helper objects and ActiveX® Data Object (ADO) methods for use with Microsoft Visual Basic®, Microsoft Visual Basic Scripting Edition (VBScript), Microsoft Visual J++® and Microsoft JScript® development software.</li>
<li>ISAPI Extensions for use in .idq, .ida, and .htx files.</li>
<li>OLE DB Helper functions for use with Microsoft Visual C++® development system.</li>
<li>OLE DB Provider for Indexing Service interfaces for use with Visual C++.</li>
<li>IFilter interface for use with Visual C++</li>
</ul>
<p><strong>Source: MSDN</strong></p>
  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/sqlhelp.wordpress.com/52/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/sqlhelp.wordpress.com/52/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/sqlhelp.wordpress.com/52/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/sqlhelp.wordpress.com/52/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/sqlhelp.wordpress.com/52/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/sqlhelp.wordpress.com/52/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/sqlhelp.wordpress.com/52/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/sqlhelp.wordpress.com/52/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/sqlhelp.wordpress.com/52/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/sqlhelp.wordpress.com/52/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=sqlhelp.wordpress.com&blog=5672629&post=52&subd=sqlhelp&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://sqlhelp.wordpress.com/2008/11/30/indexing-service/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/344460fcb9807a37c97174a2edc9d970?s=96&#38;d=identicon" medium="image">
			<media:title type="html">Raghunath Bhandari</media:title>
		</media:content>
	</item>
		<item>
		<title>SQL Performance Tuning using Indexes</title>
		<link>http://sqlhelp.wordpress.com/2008/11/28/sql-performance-tuning-using-indexes/</link>
		<comments>http://sqlhelp.wordpress.com/2008/11/28/sql-performance-tuning-using-indexes/#comments</comments>
		<pubDate>Fri, 28 Nov 2008 10:37:25 +0000</pubDate>
		<dc:creator>Raghunath Bhandari</dc:creator>
				<category><![CDATA[SQL Performance]]></category>
		<category><![CDATA[Advance SQL tips and tricks]]></category>
		<category><![CDATA[Author Raghunath Bhandari]]></category>
		<category><![CDATA[Database]]></category>
		<category><![CDATA[Database Optimization Tips]]></category>
		<category><![CDATA[dba]]></category>
		<category><![CDATA[MCP]]></category>
		<category><![CDATA[Microsoft Certified Professional]]></category>
		<category><![CDATA[Microsoft SQL server]]></category>
		<category><![CDATA[MSDN Help]]></category>
		<category><![CDATA[MSDN SQL News]]></category>
		<category><![CDATA[MSSQL]]></category>
		<category><![CDATA[MSSQL server]]></category>
		<category><![CDATA[SQL]]></category>
		<category><![CDATA[SQL Database Optimization Tricks]]></category>
		<category><![CDATA[SQL Database Settings Optimization Tips]]></category>
		<category><![CDATA[SQL Documentation]]></category>
		<category><![CDATA[SQL help]]></category>
		<category><![CDATA[SQL Optimization]]></category>
		<category><![CDATA[SQL Optimization Tips]]></category>
		<category><![CDATA[SQL Performance Tuning using Indexes]]></category>
		<category><![CDATA[SQL Query]]></category>
		<category><![CDATA[SQL Server]]></category>
		<category><![CDATA[SQL server tips]]></category>
		<category><![CDATA[SQL technology]]></category>
		<category><![CDATA[SQL Tips]]></category>
		<category><![CDATA[SQL Tips and Tricks]]></category>
		<category><![CDATA[SQL tips for programmer]]></category>
		<category><![CDATA[sqlhelp]]></category>
		<category><![CDATA[sqlhelp news]]></category>
		<category><![CDATA[sqlhelp WebSite Review]]></category>
		<category><![CDATA[T-SQL]]></category>
		<category><![CDATA[Technology News]]></category>

		<guid isPermaLink="false">http://sqlhelp.wordpress.com/?p=44</guid>
		<description><![CDATA[SQL Performance Tuning using Indexes
This article looks at general guidelines to creating effective indexes using short keys, distinct keys, covering indexes and clustered indexes.

Effective indexes are one of the best ways to improve performance in a database application. Without an index, the SQL Server engine is like a reader trying to find a word in [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=sqlhelp.wordpress.com&blog=5672629&post=44&subd=sqlhelp&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p><strong>SQL Performance Tuning using Indexes</strong></p>
<p><em>This article looks at general guidelines to creating effective indexes using short keys, distinct keys, covering indexes and clustered indexes.<br />
</em></p>
<p><span style="color:#ff0000;">Effective indexes are one of the best ways to improve performance in a database application. Without an index, the SQL Server engine is like a reader trying to find a word in a book by examining each page. By using the index in the back of a book, a reader can complete the task in a much shorter time. In database terms, a table scan happens when there is no index available to help a query. In a table scan SQL Server examines every row in the table to satisfy the query results. Table scans are sometimes unavoidable, but on large tables, scans have a terrific impact on performance.</span></p>
<p><span style="color:#ff0000;">One of the most important jobs for the database is finding the best index to use when generating an execution plan. Most major databases ship with tools to show you execution plans for a query and help in optimizing and tuning indexes. This article outlines several good rules of thumb to apply when creating and modifying indexes for your database. First, let’s cover the scenarios where indexes help performance, and when indexes can hurt performance.</span></p>
<p><strong>Useful Index Queries</strong></p>
<p>Just like the reader searching for a word in a book, an index helps when you are looking for a specific record or set of records with a WHERE clause. This includes queries looking for a range of values, queries designed to match a specific value, and queries performing a join on two tables. For example, both of the queries against the Northwind database below will benefit from an index on the UnitPrice column.</p>
<p><code>DELETE FROM Products WHERE UnitPrice = 1</code></p>
<p>SELECT * FROM PRODUCTS<br />
WHERE UnitPrice BETWEEN 14 AND 16</p>
<p>Since index entries are stored in sorted order, indexes also help when processing ORDER BY clauses. Without an index the database has to load the records and sort them during execution. An index on UnitPrice will allow the database to process the following query by simply scanning the index and fetching rows as they are referenced. To order the records in descending order, the database can simply scan the index in reverse.</p>
<p><code>SELECT * FROM Products ORDER BY UnitPrice ASC</code></p>
<p>Grouping records with a GROUP BY clause will often require sorting, so a UnitPrice index will also help the following query to count the number of products at each price.<br />
<code><br />
SELECT Count(*), UnitPrice FROM Products<br />
GROUP BY UnitPrice</code></p>
<p>By retrieving the records in sorted order through the UnitPrice index, the database sees matching prices appear in consecutive index entries, and can easily keep a count of products at each price. Indexes are also useful for maintaining unique values in a column, since the database can easily search the index to see if an incoming value already exists. Primary keys are always indexed for this reason.</p>
<p><strong>Index Drawbacks</strong></p>
<p>Indexes are a performance drag when the time comes to modify records. Any time a query modifies the data in a table the indexes on the data must change also. Achieving the right number of indexes will require testing and monitoring of your database to see where the best balance lies. Static systems, where databases are used heavily for reporting, can afford more indexes to support the read only queries. A database with a heavy number of transactions to modify data will need fewer indexes to allow for higher throughput. Indexes also use disk space. The exact size will depends on the number of records in the table as well as the number and size of the columns in the index. Generally this is not a major concern as disk space is easy to trade for better performance.</p>
<p><strong>Building The Best Index</strong></p>
<p>There are a number of guidelines to building the most effective indexes for your application. From the columns you select to the data values inside them, consider the following points when selecting the indexes for your tables.</p>
<p><strong>Short Keys</strong></p>
<p>Having short index is beneficial for two reasons. First, database work is inherently disk intensive. Larger index keys will cause the database to perform more disk reads, which limits throughput. Secondly, since index entries are often involved in comparisons, smaller entries are easier to compare. A single integer column makes the absolute best index key because an integer is small and easy for the database to compare. Character strings, on the other hand, require a character by character comparison and attention to collation settings.</p>
<p><strong>Distinct Keys</strong></p>
<p>The most effective indexes are the indexes with a small percentage of duplicated values. As an analogy, think of a phone book for a town where almost everyone has the last name of Smith. A phone book in this town is not very useful if sorted in order of last name, because you can only discount a small number of records when you are looking for a Smith.</p>
<p>An index with a high percentage of unique values is a selective index. Obviously, a unique index is highly selective since there are no duplicate entries. Many databases will track statistics about each index so they know how selective each index is. The database uses these statistics when generating an execution plan for a query.</p>
<p><strong><br />
Covering Queries</strong></p>
<p>Indexes generally contain only the data values for the columns they index and a pointer back to the row with the rest of the data. This is similar to the index in a book: the index contains only the key word and then a page reference you can turn to for the rest of the information. Generally the database will have to follow pointers from an index back to a row to gather all the information required for a query. However, if the index contains all of he columns needed for a query, the database can save a disk read by not returning to the table for more information.</p>
<p>Take the index on UnitPrice we discussed earlier. The database could use just the index entries to satisfy the following query.</p>
<p><code>SELECT Count(*), UnitPrice FROM Products<br />
GROUP BY UnitPrice<br />
</code></p>
<p>We call these types of queries covered queries, because all of the columns requested in the output are covered by a single index. For your most crucial queries, you might consider creating a covering index to give the query the best performance possible. Such an index would probably be a composite index (using more than one column), which appears to go against our first guideline of keeping index entries as short as possible. Obviously this is another tradeoff you can only evaluate with performance testing and monitoring.</p>
<p><strong>Clustered Indexes</strong></p>
<p>Many databases have one special index per table where all of the data from a row exists in the index. SQL Server calls this index a clustered index. Instead of an index at the back of a book, a clustered index is closer in similarity to a phone book because each index entry contains all the information you need, there are no references to follow to pick up additional data values.</p>
<p>As a general rule of thumb, every non-trivial table should have a clustered index. If you only create one index for a table, make the index a clustered index. In SQL Server, creating a primary key will automatically create a clustered index (if none exists) using the primary key column as the index key. Clustered indexes are the most effective indexes (when used, they always cover a query), and in many databases systems will help the database efficiently manage the space required to store the table.</p>
<p>When choosing the column or columns for a clustered index, be careful to choose a column with static data. If you modify a record and change the value of a column in a clustered index, the database might need to move the index entry (to keep the entries in sorted order). Remember, index entries for a clustered index contain all of the column values, so moving an entry is comparable to executing a DELETE statement followed by an INSERT, which can obviously cause performance problems if done often. For this reason, clustered indexes are often found on primary or foreign key columns. Key values will rarely, if ever, change.</p>
<p><strong>Conclusion<br />
</strong></p>
<p>Determining the correct indexes to use in a database requires careful analysis, benchmarking, and testing. The rules of thumb presented in this article are general guidelines. After applying these principals you need to retest your specific application in your specific environment of hardware, memory, and concurrent activity. See my previous article: SQL Server Indexes, for a more thorough introduction.</p>
  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/sqlhelp.wordpress.com/44/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/sqlhelp.wordpress.com/44/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/sqlhelp.wordpress.com/44/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/sqlhelp.wordpress.com/44/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/sqlhelp.wordpress.com/44/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/sqlhelp.wordpress.com/44/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/sqlhelp.wordpress.com/44/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/sqlhelp.wordpress.com/44/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/sqlhelp.wordpress.com/44/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/sqlhelp.wordpress.com/44/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=sqlhelp.wordpress.com&blog=5672629&post=44&subd=sqlhelp&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://sqlhelp.wordpress.com/2008/11/28/sql-performance-tuning-using-indexes/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/344460fcb9807a37c97174a2edc9d970?s=96&#38;d=identicon" medium="image">
			<media:title type="html">Raghunath Bhandari</media:title>
		</media:content>
	</item>
		<item>
		<title>CREATE PARTITION FUNCTION</title>
		<link>http://sqlhelp.wordpress.com/2008/11/28/create-partition-function/</link>
		<comments>http://sqlhelp.wordpress.com/2008/11/28/create-partition-function/#comments</comments>
		<pubDate>Fri, 28 Nov 2008 08:46:44 +0000</pubDate>
		<dc:creator>Raghunath Bhandari</dc:creator>
				<category><![CDATA[Partitioning a Table]]></category>
		<category><![CDATA[Advance SQL tips and tricks]]></category>
		<category><![CDATA[Author Raghunath Bhandari]]></category>
		<category><![CDATA[Database]]></category>
		<category><![CDATA[Database Optimization Tips]]></category>
		<category><![CDATA[dba]]></category>
		<category><![CDATA[MCP]]></category>
		<category><![CDATA[Microsoft Certified Professional]]></category>
		<category><![CDATA[Microsoft SQL server]]></category>
		<category><![CDATA[MSDN Help]]></category>
		<category><![CDATA[MSDN SQL News]]></category>
		<category><![CDATA[MSSQL]]></category>
		<category><![CDATA[MSSQL server]]></category>
		<category><![CDATA[PARTITION]]></category>
		<category><![CDATA[SQL]]></category>
		<category><![CDATA[SQL Database Optimization Tricks]]></category>
		<category><![CDATA[SQL Database Settings Optimization Tips]]></category>
		<category><![CDATA[SQL Documentation]]></category>
		<category><![CDATA[SQL help]]></category>
		<category><![CDATA[SQL Optimization]]></category>
		<category><![CDATA[SQL Optimization Tips]]></category>
		<category><![CDATA[SQL Query]]></category>
		<category><![CDATA[SQL Server]]></category>
		<category><![CDATA[SQL server tips]]></category>
		<category><![CDATA[SQL technology]]></category>
		<category><![CDATA[SQL Tips]]></category>
		<category><![CDATA[SQL Tips and Tricks]]></category>
		<category><![CDATA[SQL tips for programmer]]></category>
		<category><![CDATA[sqlhelp]]></category>
		<category><![CDATA[sqlhelp news]]></category>
		<category><![CDATA[sqlhelp WebSite Review]]></category>
		<category><![CDATA[T-SQL]]></category>
		<category><![CDATA[Technology News]]></category>

		<guid isPermaLink="false">http://sqlhelp.wordpress.com/?p=34</guid>
		<description><![CDATA[CREATE PARTITION FUNCTION (Transact-SQL)

Creates a function in the current database that maps the rows of a table or index into partitions based on the values of a specified column. Using CREATE PARTITION FUNCTION is the first step in creating a partitioned table or index.


Syntax




CREATE PARTITION FUNCTION partition_function_name ( input_parameter_type )
AS RANGE [ LEFT &#124; RIGHT [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=sqlhelp.wordpress.com&blog=5672629&post=34&subd=sqlhelp&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><div class="title"><strong>CREATE PARTITION FUNCTION (Transact-SQL)</strong></div>
<p><!--Content type: DocStudio. Transform: devdiv2mtps.xslt.--></p>
<p>Creates a function in the current database that maps the rows of a table or index into partitions based on the values of a specified column. Using CREATE PARTITION FUNCTION is the first step in creating a partitioned table or index.</p>
<p><!--src=[..local5b1d166-d807-482c-891f-30b3b6b58046.gif]--><a id="ctl00_rs1_mainContentContainer_ctl02" href="http://msdn.microsoft.com/en-us/library/ms177563.aspx"></a></p>
<div id="ctl00_rs1_mainContentContainer_cpe437425" class="MTPS_CollapsibleRegion">
<div id="ctl00_rs1_mainContentContainer_cpe437425_h" class="CollapseRegionLink"><strong>Syntax</strong></div>
<div id="ctl00_rs1_mainContentContainer_cpe437425_c" class="MTPS_CollapsibleSection" style="overflow:visible;display:block;height:auto;width:1044.7px;">
<div class="MTPS_CollapsibleSection" style="display:block;"><a id="syntaxToggle"></a></p>
<div id="ctl00_rs1_mainContentContainer_ctl06_other">
<div dir="ltr">
<pre class="libCScode" style="white-space:pre-wrap;">CREATE PARTITION FUNCTION partition_function_name ( input_parameter_type )
AS RANGE [ LEFT | RIGHT ]
FOR VALUES ( [ boundary_value [ ,...n ] ] )
[ ; ]</pre>
</div>
</div>
</div>
</div>
</div>
<div id="ctl00_rs1_mainContentContainer_cpe437426" class="MTPS_CollapsibleRegion">
<div id="ctl00_rs1_mainContentContainer_cpe437426_h" class="CollapseRegionLink"><img class="LibC_o" style="vertical-align:middle;border-width:0;" src="http://i.msdn.microsoft.com/Global/Images/clear.gif" alt="" /> Arguments</div>
<div id="ctl00_rs1_mainContentContainer_cpe437426_c" class="MTPS_CollapsibleSection" style="overflow:visible;display:block;height:auto;width:1044.7px;">
<div class="MTPS_CollapsibleSection" style="display:block;"><a id="sectionToggle0"></a>
<dl>
<dt> <em>partition_function_name </em> </dt>
<dd>Is the name of the partition function. Partition function names must be unique within the database and comply with the rules for <a id="ctl00_rs1_mainContentContainer_ctl12" href="http://msdn.microsoft.com/en-us/library/ms175874.aspx">identifiers</a>. </dd>
</dl>
<dl>
<dt> <em>input_parameter_type </em> </dt>
<dd>Is the data type of the column used for partitioning. All data types are valid for use as partitioning columns, except <strong>text</strong>, <strong>ntext</strong>, <strong>image</strong>, <strong>xml</strong>, <strong>timestamp</strong>, <strong>varchar(max)</strong>, <strong>nvarchar(max)</strong>, <strong>varbinary(max)</strong>, alias data types, or CLR user-defined data types.The actual column, known as a partitioning column, is specified in the CREATE TABLE or CREATE INDEX statement. </dd>
</dl>
<dl>
<dt> <em>boundary_value</em> </dt>
<dd>Specifies the boundary values for each partition of a partitioned table or index that uses <em>partition_function_name</em>. If <em>boundary_value</em> is empty, the partition function maps the whole table or index using <em>partition_function_name</em> into a single partition. Only one partitioning column, specified in a CREATE TABLE or CREATE INDEX statement, can be used.<em>boundary_value</em> is a constant expression that can reference variables. This includes user-defined type variables, or functions and user-defined functions. It cannot reference Transact-SQL expressions. <em>boundary_value</em> must either match or be implicitly convertible to the data type supplied in <em>input_parameter_type</em>, and cannot be truncated during implicit conversion in a way that the size and scale of the value does not match that of its corresponding <em>input_parameter_type</em>.</p>
<blockquote><p>If <em>boundary</em><em>_value</em> consists of <strong>datetime</strong> or <strong>smalldatetime</strong> literals, these literals are evaluated assuming that us_english is the session language. This behavior is deprecated. To make sure the partition function definition behaves as expected for all session languages, we recommend that you use constants that are interpreted the same way for all language settings, such as the yyyymmdd format; or explicitly convert literals to a specific style. For more information, see <a id="ctl00_rs1_mainContentContainer_ctl14" href="http://msdn.microsoft.com/en-us/library/ms191307.aspx">Writing International Transact-SQL Statements</a>. To determine the language session of your server, run <code>SELECT @@LANGUAGE</code>.</p></blockquote>
</dd>
</dl>
<dl>
<dt> <em>&#8230;n </em> </dt>
<dd>Specifies the number of values supplied by <em>boundary_value</em>, not to exceed 999. The number of partitions created is equal to <em>n</em> + 1. The values do not have to be listed in order. If the values are not in order, the Database Engine sorts them, creates the function, and returns a warning that the values are not provided in order. The Database Engine returns an error if <em>n</em> includes any duplicate values. </dd>
</dl>
<dl>
<dt> LEFT | RIGHT </dt>
<dd>Specifies to which side of each boundary value interval, left or right, the <em>boundary_value</em> [ <strong>,</strong><em>...n </em>] belongs, when interval values are sorted by the Database Engine in ascending order from left to right. If not specified, LEFT is the default. For more information, see <a href="http://msdn.microsoft.com/en-us/library/ms187802.aspx#BKMK_examples">Examples</a>. </dd>
</dl>
</div>
</div>
</div>
<div id="ctl00_rs1_mainContentContainer_cpe437427" class="MTPS_CollapsibleRegion">
<div id="ctl00_rs1_mainContentContainer_cpe437427_h" class="CollapseRegionLink"><img class="LibC_o" style="vertical-align:middle;border-width:0;" src="http://i.msdn.microsoft.com/Global/Images/clear.gif" alt="" /> Remarks</div>
<div id="ctl00_rs1_mainContentContainer_cpe437427_c" class="MTPS_CollapsibleSection" style="overflow:visible;display:block;height:auto;width:1044.7px;">
<div class="MTPS_CollapsibleSection" style="display:block;"><a id="remarksToggle"></a>The scope of a partition function is limited to the database that it is created in. Within the database, partition functions reside in a separate namespace from the other functions.Any rows whose partitioning column has null values are placed in the left-most partition, unless NULL is specified as a boundary value and RIGHT is indicated. In this case, the left-most partition is an empty partition, and NULL values are placed in the following partition.</div>
</div>
</div>
<div id="ctl00_rs1_mainContentContainer_cpe437428" class="MTPS_CollapsibleRegion">
<div id="ctl00_rs1_mainContentContainer_cpe437428_h" class="CollapseRegionLink"><img class="LibC_o" style="vertical-align:middle;border-width:0;" src="http://i.msdn.microsoft.com/Global/Images/clear.gif" alt="" /> Permissions</div>
<div id="ctl00_rs1_mainContentContainer_cpe437428_c" class="MTPS_CollapsibleSection" style="overflow:visible;display:block;height:auto;width:1044.7px;">
<div class="MTPS_CollapsibleSection" style="display:block;"><a id="sectionToggle1"></a>Any one of the following permissions can be used to execute CREATE PARTITION FUNCTION:</p>
<ul>
<li> ALTER ANY DATASPACE permission. This permission defaults to members of the <strong>sysadmin</strong> fixed server role and the <strong>db_owner</strong> and <strong>db_ddladmin</strong> fixed database roles.</li>
<li> CONTROL or ALTER permission on the database in which the partition function is being created.</li>
<li> CONTROL SERVER or ALTER ANY DATABASE permission on the server of the database in which the partition function is being created.</li>
</ul>
</div>
</div>
</div>
<p><a id="BKMK_examples"></a></p>
<div id="ctl00_rs1_mainContentContainer_cpe437429_h" class="CollapseRegionLink"><img class="LibC_o" style="vertical-align:middle;border-width:0;" src="http://i.msdn.microsoft.com/Global/Images/clear.gif" alt="" /> Examples</div>
<p><a id="sectionToggle2"></a></p>
<h3 class="subHeading">A. Creating a RANGE LEFT partition function on an int column</h3>
<div class="subSection">
<p>The following partition function will partition a table or index into four partitions.</p></div>
<div dir="ltr">
<pre class="libCScode" style="white-space:pre-wrap;">CREATE PARTITION FUNCTION myRangePF1 (int)
AS RANGE LEFT FOR VALUES (1, 100, 1000);</pre>
</div>
<p>The following table shows how a table that uses this partition function on partitioning column <strong>col1</strong> would be partitioned.</p>
<table border="0">
<tbody>
<tr>
<th> Partition</th>
<th> 1</th>
<th> 2</th>
<th> 3</th>
<th> 4</th>
</tr>
<tr>
<td><strong>Values</strong></td>
<td><strong>col1</strong> &lt;= <code>1</code></td>
<td><strong>col1</strong> &gt; <code>1</code> AND <strong>col1</strong> &lt;= <code>100</code></td>
<td><strong>col1 </strong>&gt; <code>100</code> AND <strong>col1 </strong>&lt;=<strong> </strong><code>1000</code></td>
<td><strong>col1 </strong>&gt; <code>1000</code></td>
</tr>
</tbody>
</table>
<h3 class="subHeading">B. Creating a RANGE RIGHT partition function on an int column</h3>
<div class="subSection">
<p>The following partition function uses the same values for <em>boundary_value</em> [ <strong>,</strong><em>...n</em> ] as the previous example, except it specifies RANGE RIGHT.</p>
<div id="ctl00_rs1_mainContentContainer_ctl26_other">
<div dir="ltr">
<pre class="libCScode" style="white-space:pre-wrap;">CREATE PARTITION FUNCTION myRangePF2 (int)
AS RANGE RIGHT FOR VALUES (1, 100, 1000);</pre>
</div>
</div>
<p>The following table shows how a table that uses this partition function on partitioning column <strong>col1</strong> would be partitioned.</p>
<table border="0">
<tbody>
<tr>
<th> Partition</th>
<th> 1</th>
<th> 2</th>
<th> 3</th>
<th> 4</th>
</tr>
<tr>
<td><strong>Values</strong></td>
<td><strong>col1</strong> &lt; <code>1</code></td>
<td><strong>col1</strong> &gt;= <code>1</code> AND <strong>col1</strong> &lt; <code>100</code></td>
<td><strong>col1</strong> &gt;= <code>100</code> AND <strong>col1</strong> &lt; <code>1000</code></td>
<td><strong>col1</strong> &gt;= <code>1000</code></td>
</tr>
</tbody>
</table>
</div>
<h3 class="subHeading">C. Creating a RANGE RIGHT partition function on a datetime column</h3>
<div class="subSection">
<p>The following partition function partitions a table or index into 12 partitions, one for each month of a year&#8217;s worth of values in a <strong>datetime</strong> column.</p>
<div id="ctl00_rs1_mainContentContainer_ctl27_other">
<div class="CodeSnippetTitleBar">
<div class="CopyCodeButton"><a class="copyCode" href="CopyCode('ctl00_rs1_mainContentContainer_ctl27other');"></a></div>
</div>
<div dir="ltr">
<pre class="libCScode" style="white-space:pre-wrap;">CREATE PARTITION FUNCTION [myDateRangePF1] (datetime)
AS RANGE RIGHT FOR VALUES ('20030201', '20030301', '20030401',
               '20030501', '20030601', '20030701', '20030801',
               '20030901', '20031001', '20031101', '20031201');</pre>
</div>
</div>
<p>The following table shows how a table or index that uses this partition function on partitioning column <strong>datecol</strong> would be partitioned.</p>
<table border="0">
<tbody>
<tr>
<th> Partition</th>
<th> 1</th>
<th> 2</th>
<th> &#8230;</th>
<th> 11</th>
<th> 12</th>
</tr>
<tr>
<td><strong>Values</strong></td>
<td><strong>datecol</strong> &lt; <code>February 1, 2003</code></td>
<td><strong>datecol</strong> &gt;= <code>February 1, 2003</code> AND <strong>datecol</strong> &lt; <code>March 1, 2003</code></td>
<td></td>
<td><strong>datecol</strong> &gt;= <code>November 1, 2003</code> AND <strong>col1</strong> &lt; <code>December 1, 2003</code></td>
<td><strong>col1</strong> &gt;= <code>December 1, 2003</code></td>
</tr>
</tbody>
</table>
</div>
<h3 class="subHeading">D. Creating a partition function on a char column</h3>
<p>The following partition function partitions a table or index into four partitions.</p>
<div id="ctl00_rs1_mainContentContainer_ctl28_other">
<div class="CodeSnippetTitleBar">
<div class="CopyCodeButton"><a class="copyCode" href="CopyCode('ctl00_rs1_mainContentContainer_ctl28other');"></a></div>
</div>
<div dir="ltr">
<pre class="libCScode" style="white-space:pre-wrap;">CREATE PARTITION FUNCTION myRangePF3 (char(20))
AS RANGE RIGHT FOR VALUES ('EX', 'RXE', 'XR');</pre>
</div>
</div>
<p>The following table shows how a table that uses this partition function on partitioning column <strong>col1</strong> would be partitioned.</p>
<table border="0">
<tbody>
<tr>
<th> Partition</th>
<th> 1</th>
<th> 2</th>
<th> 3</th>
<th> 4</th>
</tr>
<tr>
<td><strong>Values</strong></td>
<td><strong>col1</strong> &lt; <code>EX</code>&#8230;</td>
<td><strong>col1</strong> &gt;= <code>EX</code> AND <strong>col1</strong> &lt; <code>RXE</code>&#8230;</td>
<td><strong>col1</strong> &gt;= <code>RXE</code> AND <strong>col1</strong> &lt; <code>XR</code>&#8230;</td>
<td><strong>col1</strong> &gt;= <code>XR</code></td>
</tr>
</tbody>
</table>
  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/sqlhelp.wordpress.com/34/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/sqlhelp.wordpress.com/34/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/sqlhelp.wordpress.com/34/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/sqlhelp.wordpress.com/34/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/sqlhelp.wordpress.com/34/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/sqlhelp.wordpress.com/34/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/sqlhelp.wordpress.com/34/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/sqlhelp.wordpress.com/34/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/sqlhelp.wordpress.com/34/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/sqlhelp.wordpress.com/34/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=sqlhelp.wordpress.com&blog=5672629&post=34&subd=sqlhelp&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://sqlhelp.wordpress.com/2008/11/28/create-partition-function/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/344460fcb9807a37c97174a2edc9d970?s=96&#38;d=identicon" medium="image">
			<media:title type="html">Raghunath Bhandari</media:title>
		</media:content>

		<media:content url="http://i.msdn.microsoft.com/Global/Images/clear.gif" medium="image" />

		<media:content url="http://i.msdn.microsoft.com/Global/Images/clear.gif" medium="image" />

		<media:content url="http://i.msdn.microsoft.com/Global/Images/clear.gif" medium="image" />

		<media:content url="http://i.msdn.microsoft.com/Global/Images/clear.gif" medium="image" />
	</item>
		<item>
		<title>Partitioning the Data in a Table</title>
		<link>http://sqlhelp.wordpress.com/2008/11/28/partitioning-the-data-in-a-table/</link>
		<comments>http://sqlhelp.wordpress.com/2008/11/28/partitioning-the-data-in-a-table/#comments</comments>
		<pubDate>Fri, 28 Nov 2008 07:40:44 +0000</pubDate>
		<dc:creator>Raghunath Bhandari</dc:creator>
				<category><![CDATA[Partitioning a Table]]></category>
		<category><![CDATA[Advance SQL tips and tricks]]></category>
		<category><![CDATA[Author Raghunath Bhandari]]></category>
		<category><![CDATA[Database]]></category>
		<category><![CDATA[Database Optimization Tips]]></category>
		<category><![CDATA[dba]]></category>
		<category><![CDATA[MCP]]></category>
		<category><![CDATA[Microsoft Certified Professional]]></category>
		<category><![CDATA[Microsoft SQL server]]></category>
		<category><![CDATA[MSDN Help]]></category>
		<category><![CDATA[MSDN SQL News]]></category>
		<category><![CDATA[MSSQL]]></category>
		<category><![CDATA[MSSQL server]]></category>
		<category><![CDATA[Partitioning]]></category>
		<category><![CDATA[SQL]]></category>
		<category><![CDATA[SQL Database Optimization Tricks]]></category>
		<category><![CDATA[SQL Database Settings Optimization Tips]]></category>
		<category><![CDATA[SQL Documentation]]></category>
		<category><![CDATA[SQL help]]></category>
		<category><![CDATA[SQL Optimization]]></category>
		<category><![CDATA[SQL Optimization Tips]]></category>
		<category><![CDATA[SQL Query]]></category>
		<category><![CDATA[SQL Server]]></category>
		<category><![CDATA[SQL server tips]]></category>
		<category><![CDATA[SQL technology]]></category>
		<category><![CDATA[SQL Tips]]></category>
		<category><![CDATA[SQL Tips and Tricks]]></category>
		<category><![CDATA[SQL tips for programmer]]></category>
		<category><![CDATA[sqlhelp]]></category>
		<category><![CDATA[sqlhelp news]]></category>
		<category><![CDATA[sqlhelp WebSite Review]]></category>
		<category><![CDATA[T-SQL]]></category>
		<category><![CDATA[Technology News]]></category>

		<guid isPermaLink="false">http://sqlhelp.wordpress.com/?p=23</guid>
		<description><![CDATA[Is it ever good database design practice (for speed sake, etc.) to essentially make copies of tables to hold a certain group of data?
For example, I have come across a database table that stores information for a housing subdivision; ie. lot number, lot size, lot price, etc. And the database to which this table belongs [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=sqlhelp.wordpress.com&blog=5672629&post=23&subd=sqlhelp&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p><span style="color:#ff0000;"><strong><em>Is it ever good database design practice (for speed sake, etc.) to essentially make copies of tables to hold a certain group of data?</em></strong></span></p>
<p>For example, I have come across a database table that stores information for a housing subdivision; ie. lot number, lot size, lot price, etc. And the database to which this table belongs stores this data for many subdivisions. However, instead of having one table that stores the subdivision information for ALL subdivisions (and having some ID that represents the specific subdivision), this database has one table for each subdivision. For example, &#8216;Clair Ridge Estates Subdivision Info&#8217; and another table &#8216;Possum Bend Subdivision Info&#8217;, etc, with each table having the exact same fields. And, if they needed another subdivision, they would make yet another copy and give it a unique name.&#8221;</p>
<blockquote><p>Yes, there are times this is a good idea. I like this question because it reminded me of one of my favorite features of SQL Server &#8211; partitioned views.</p></blockquote>
<p>What you&#8217;re referring to is an optimization method called horizontal partitioning. That is, a table is split up into multiple smaller tables containing the same number of columns, but fewer rows. Compare this to vertical partitioning, in which the table is split into multiple smaller tables with the same number of rows, but fewer columns.</p>
<p>And yes, this design decision is often made to improve performance. Horizontally partitioning a table gives us some advantages:</p>
<ul>
<li> Each partition table will have fewer rows; if you have to (heaven forbid) table-scan the data, it will take less time.</li>
<li> Indexes on each partition table will be smaller (=faster seeks) than a corresponding index on the unpartitioned table.</li>
<li> If you need to, you can put each partition table on a different filegroup and partition the data among multiple disks/RAID volumes/drive controllers.</li>
<li> If you&#8217;re trying to whomp Oracle&#8217;s TPC-C benchmark, then you may want to consider partitioning the data among multiple federated servers in SQL Server 2000. (Although for storing information about housing subdivisions, this may be a bit over the top.)</li>
<li> If you create a partitioned view on the partitioned tables, you can treat the view like it is the whole table, and the QP (query processor) will only touch the tables it needs to fulfill the query. You get the benefits of horizontal partitioning without the query headache.</li>
</ul>
<blockquote><p>So, as you can see, horizontal partitioning is all about splitting up the workload &#8211; spreading out data access among tables, indexes, disks, and servers.</p></blockquote>
<p>Why would you want to do this? Well, maybe you have a big table &#8211; hundreds of millions of rows, for instance. Or maybe not so many rows, but large rows. Or maybe you have a table in a data warehouse that contains frequently and infrequently accessed rows. All of these situations are candidates for partitioning.</p>
<p>Now, there are two big downsides to all of this:</p>
<ul>
<li> Unless you use a partitioned view to access the data, you&#8217;ll have to build logic into your application to access the correct table, and that has a high suck factor. Please, please, use the partitioned view instead.</li>
<li> You actually have to partition the data. And maintain it. And create the partitioned view. And balance the amount of data in each partitioned table, if needed. In other words, the dreaded &#8220;administrative overhead&#8221;.</li>
</ul>
<p>Okay, since I&#8217;m touting the partitioned view, let me quickly explain how to create one. I&#8217;ll use the information from this question as an example.First, the tables:</p>
<p><code><br />
CREATE TABLE Subdiv_ClaireRidgeEstates (SubdivID int, LotID int /*, etc.*/)<br />
CREATE TABLE Subdiv_TibetianYakFarms (SubdivID int, LotID int /*, etc.*/)<br />
</code></p>
<p>You may notice that I included the Subdivision ID in each table. This is important; for the partitioned view to work most effectively, the QP must be able to know that each partition table will only contain a certain type of data. To do this, you need to build CHECK constraints on each table on the ID that you&#8217;re partitioning on. Since you&#8217;re partitioning the data by subdivision, you will build CHECK constraints on SubdivID:</p>
<p><code><br />
ALTER TABLE Subdiv_ClaireRidgeEstates ADD CONSTRAINT CK_CRE_SubdivID CHECK (SubdivID = 42)<br />
ALTER TABLE Subdiv_TibetianYakFarms ADD CONSTRAINT CK_TYF_SubdivID CHECK (SubdivID = 9538)<br />
</code></p>
<p>You could just as easily partition by using a surrogate key field and assigning a range of key values to each partition table. Or by partitioning on a date and using a range of dates for each partition value. Regardless, you still need those CHECK constraints in place on each table.</p>
<p>After actually creating the partition tables, distributing the data, and building the CHECK constraints, building the view is pretty easy. You just SELECT * from each partition table and use UNION ALL to combine the results of the query:</p>
<p><code><br />
CREATE VIEW Subdivision<br />
AS<br />
SELECT * FROM Subdiv_ClaireRidgeEstates<br />
UNION ALL<br />
SELECT * FROM Subdiv_TibetianYakFarms<br />
</code></p>
<p>Now, if you&#8217;ve been following along with the example, try inserting some sample rows into each table:</p>
<p><code><br />
INSERT Subdiv_ClaireRidgeEstates VALUES (42,9999)<br />
INSERT Subdiv_TibetianYakFarms VALUES (9538,1234)<br />
</code></p>
<p>Now, turn on the &#8220;Show Execution Plan&#8221; option in query analyzer, and run the following queries:</p>
<p><code>SELECT * FROM Subdivision WHERE SubdivID = 42<br />
SELECT * FROM Subdivision WHERE SubdivID = 9538<br />
SELECT * FROM Subdivision</code></p>
<blockquote><p><strong><br />
You&#8217;ll notice that for the first two queries, SQL Server only pulls information from the required partition table. Only in the last query, where we don&#8217;t filter by SubdivID, does the QP pull data from each partition table.</strong></p></blockquote>
<p>In SQL Server 7.0, you unfortunately cannot update data in a partitioned view. However, this IS possible in SQL Server 2000. Check out SQL Server Books Online (especially if you&#8217;re going to use distributed partitioned views) for the do&#8217;s and don&#8217;ts of partitioning data.</p>
  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/sqlhelp.wordpress.com/23/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/sqlhelp.wordpress.com/23/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/sqlhelp.wordpress.com/23/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/sqlhelp.wordpress.com/23/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/sqlhelp.wordpress.com/23/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/sqlhelp.wordpress.com/23/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/sqlhelp.wordpress.com/23/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/sqlhelp.wordpress.com/23/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/sqlhelp.wordpress.com/23/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/sqlhelp.wordpress.com/23/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=sqlhelp.wordpress.com&blog=5672629&post=23&subd=sqlhelp&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://sqlhelp.wordpress.com/2008/11/28/partitioning-the-data-in-a-table/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/344460fcb9807a37c97174a2edc9d970?s=96&#38;d=identicon" medium="image">
			<media:title type="html">Raghunath Bhandari</media:title>
		</media:content>
	</item>
		<item>
		<title>Basic SQL Language</title>
		<link>http://sqlhelp.wordpress.com/2008/11/28/basic-sql-language/</link>
		<comments>http://sqlhelp.wordpress.com/2008/11/28/basic-sql-language/#comments</comments>
		<pubDate>Fri, 28 Nov 2008 05:27:19 +0000</pubDate>
		<dc:creator>Raghunath Bhandari</dc:creator>
				<category><![CDATA[Basic SQL Language]]></category>
		<category><![CDATA[alter syntax]]></category>
		<category><![CDATA[Basic SQL syntax]]></category>
		<category><![CDATA[Create syntax]]></category>
		<category><![CDATA[Data Definition Language (DDL)]]></category>
		<category><![CDATA[Data Manipulation Language (DML)]]></category>
		<category><![CDATA[DDL]]></category>
		<category><![CDATA[DML]]></category>
		<category><![CDATA[Drop syntax]]></category>
		<category><![CDATA[most important DDL syntax in SQL]]></category>
		<category><![CDATA[most important DML syntax in SQL]]></category>
		<category><![CDATA[MSSQL Data Definition Language example]]></category>
		<category><![CDATA[MSSQL syntax]]></category>
		<category><![CDATA[SQL Server]]></category>
		<category><![CDATA[SQL syntax]]></category>

		<guid isPermaLink="false">http://sqlhelp.wordpress.com/?p=313</guid>
		<description><![CDATA[SQL DML and DDL
SQL Language can be divided into two parts: The Data Manipulation Language (DML) and  the Data Definition Language (DDL).
The query and update commands form the DML  part of SQL:

SELECT &#8211; extracts data from a database
UPDATE &#8211; updates data in a database
DELETE &#8211; deletes data from a database
INSERT INTO &#8211; inserts [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=sqlhelp.wordpress.com&blog=5672629&post=313&subd=sqlhelp&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><h2>SQL DML and DDL</h2>
<p>SQL Language can be divided into two parts: The Data Manipulation Language (DML) and  the Data Definition Language (DDL).</p>
<p>The query and update commands form the DML  part of SQL:</p>
<ul>
<li><strong>SELECT</strong> &#8211; extracts data from a database</li>
<li><strong>UPDATE</strong> &#8211; updates data in a database</li>
<li><strong>DELETE</strong> &#8211; deletes data from a database</li>
<li><strong>INSERT INTO</strong> &#8211; inserts new data into a database</li>
</ul>
<p>The DDL part of SQL permits database tables to be created or deleted. It also define indexes (keys), specify links between tables, and impose constraints between tables. The most important DDL statements in SQL are:</p>
<ul>
<li><strong>CREATE DATABASE </strong>- creates a new database</li>
<li><strong>ALTER DATABASE</strong> &#8211; modifies a database</li>
<li><strong>CREATE TABLE</strong> &#8211; creates a new table</li>
<li><strong>ALTER TABLE </strong>- modifies a table</li>
<li><strong>DROP TABLE</strong> &#8211; deletes a table</li>
<li><strong>CREATE INDEX</strong> &#8211; creates an index (search key)</li>
<li><strong>DROP INDEX</strong> &#8211; deletes an index</li>
</ul>
<p><strong>Example:</strong></p>
<p><strong>The most important DML syntax in SQL are:</strong></p>
<pre>-- SQL Select Syntax
SELECT <strong>* from tablename

</strong>-- SQL Update Syntax
UPDATE <strong><strong>tablename</strong></strong> set columnname='value' where rowid=1

-- SQL Delete Syntax
DELETE from <strong><strong>tablename</strong></strong> where rowid=1

-- SQL Insert into Syntax
INSERT INTO <strong><strong>tablename</strong></strong>(column1,column2) values('value1','values2')</pre>
<p><strong>The most important DDL syntax in SQL are:</strong></p>
<pre>-- SQL Create Database Syntax
CREATE DATABASE database_name

-- SQL Create Table Syntax
CREATE TABLE <em>Table1
</em>(
rowid int,<em>
</em>LastName varchar(255),<em>
</em>FirstName varchar(255),
Address varchar(255),
City varchar(255)
)

-- Alter Table Syntax
<code>ALTER TABLE table1 DROP COLUMN colum1
</code><code>ALTER TABLE </code><code>table1</code><code> ADD column1 VARCHAR(20) NULL </code></pre>
<pre>-- Drop Table Syntax
<code>Drop TABLE table1
</code>ALTER TABLE table1 DROP INDEX index1
TRUNCATE TABLE table1</pre>
<pre>-- Create Index Syntax
CREATE UNIQUE INDEX AK_Index ON Table1 (Column1) WITH (IGNORE_DUP_KEY = OFF)

-- Drop Index Syntax
DROP INDEX AK_Index ON Table1</pre>
  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/sqlhelp.wordpress.com/313/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/sqlhelp.wordpress.com/313/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/sqlhelp.wordpress.com/313/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/sqlhelp.wordpress.com/313/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/sqlhelp.wordpress.com/313/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/sqlhelp.wordpress.com/313/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/sqlhelp.wordpress.com/313/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/sqlhelp.wordpress.com/313/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/sqlhelp.wordpress.com/313/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/sqlhelp.wordpress.com/313/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=sqlhelp.wordpress.com&blog=5672629&post=313&subd=sqlhelp&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://sqlhelp.wordpress.com/2008/11/28/basic-sql-language/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/344460fcb9807a37c97174a2edc9d970?s=96&#38;d=identicon" medium="image">
			<media:title type="html">Raghunath Bhandari</media:title>
		</media:content>
	</item>
		<item>
		<title>Backup/Restore Optimization Tips</title>
		<link>http://sqlhelp.wordpress.com/2008/11/23/backuprestore-optimization-tips/</link>
		<comments>http://sqlhelp.wordpress.com/2008/11/23/backuprestore-optimization-tips/#comments</comments>
		<pubDate>Sun, 23 Nov 2008 05:52:23 +0000</pubDate>
		<dc:creator>Raghunath Bhandari</dc:creator>
				<category><![CDATA[Backup/Restore Tips]]></category>
		<category><![CDATA[Advance SQL tips and tricks]]></category>
		<category><![CDATA[Author Raghunath Bhandari]]></category>
		<category><![CDATA[Database]]></category>
		<category><![CDATA[Database Optimization Tips]]></category>
		<category><![CDATA[dba]]></category>
		<category><![CDATA[MCP]]></category>
		<category><![CDATA[Microsoft Certified Professional]]></category>
		<category><![CDATA[Microsoft SQL server]]></category>
		<category><![CDATA[MSDN Help]]></category>
		<category><![CDATA[MSDN SQL News]]></category>
		<category><![CDATA[MSSQL]]></category>
		<category><![CDATA[MSSQL Resources]]></category>
		<category><![CDATA[MSSQL server]]></category>
		<category><![CDATA[MSSQL Server help]]></category>
		<category><![CDATA[SQL]]></category>
		<category><![CDATA[SQL Backup/Restore]]></category>
		<category><![CDATA[SQL Best practices and tips]]></category>
		<category><![CDATA[SQL Coding Standards]]></category>
		<category><![CDATA[SQL Database Optimization Tricks]]></category>
		<category><![CDATA[SQL Database Settings Optimization Tips]]></category>
		<category><![CDATA[SQL Documentation]]></category>
		<category><![CDATA[SQL help]]></category>
		<category><![CDATA[SQL Optimization]]></category>
		<category><![CDATA[SQL Optimization Tips]]></category>
		<category><![CDATA[SQL Query]]></category>
		<category><![CDATA[SQL Server]]></category>
		<category><![CDATA[SQL server tips]]></category>
		<category><![CDATA[SQL technology]]></category>
		<category><![CDATA[SQL Tips]]></category>
		<category><![CDATA[SQL Tips and Tricks]]></category>
		<category><![CDATA[SQL tips for programmer]]></category>
		<category><![CDATA[sqlhelp]]></category>
		<category><![CDATA[sqlhelp news]]></category>
		<category><![CDATA[sqlhelp WebSite Review]]></category>
		<category><![CDATA[T-SQL]]></category>
		<category><![CDATA[Technology News]]></category>

		<guid isPermaLink="false">http://sqlhelp.wordpress.com/?p=84</guid>
		<description><![CDATA[Backup/Restore Optimization Tips:


Try to perform backup to the local hard disk first, and copy backup file(s) to the tape later.
When you perform backup, some SQL Server commands cannot be made, for example: during backup you cannot run ALTER DATABASE statement with either the ADD FILE or REMOVE FILE options, you cannot shrink database, you cannot [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=sqlhelp.wordpress.com&blog=5672629&post=84&subd=sqlhelp&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p><span style="color:#008000;"><strong>Backup/Restore Optimization Tips:<br />
</strong></span></p>
<ol>
<li><strong>Try to perform backup to the local hard disk first, and copy backup file(s) to the tape later.</strong><br />
<blockquote><p>When you perform backup, some SQL Server commands cannot be made, for example: during backup you cannot run ALTER DATABASE statement with either the ADD FILE or REMOVE FILE options, you cannot shrink database, you cannot run CREATE INDEX statement and so on. So, to decrease the backup operation&#8217;s time, you can perform backup to the local hard disk first, and then copy backup file(s) to the tape, because tape device usually much more slow than hard disks. The smaller backup<br />
operation&#8217;s time is, the less impact there will be on the server when the backup occurs.</p></blockquote>
</li>
<li><strong>Perform backup on multiple backup devices.</strong><br />
Using multiple backup devices forces SQL Server to create a separate backup thread for each backup device, so the backups will be written to all backup devices in parallel.</li>
<li><strong>Perform backup on a physical disk array, so the more disks in array the more quickly the backup will be made.</strong>This can improve performance because a separate thread will be created for each backup device on each disk in order to write the backup&#8217;s data in parallel.</li>
<li><strong>Perform backups during periods of low database access.</strong><br />
Because backup is very resource effective, try to schedule it during CPU idle time and slow production periods.</li>
<li><strong>Use full backup to minimize the time to restore databases.</strong><br />
The full backups take the longest to perform in comparison with differential and incremental backups, but are the fastest to restore.</li>
<li><strong>Use incremental backup to minimize the time to backup databases.</strong><br />
The incremental backups take the fastest to perform in comparison with full and differential backups, but are the longest to restore.</li>
<li><strong>Use differential backup instead of incremental backup when the users update the same data many times.</strong><br />
Because a differential backup captures only those data pages that have changed after the last database backup, you can eliminate much of the time the server spends rolling transactions forward when recovering transaction logs from the incremental backups. Using differential backup, in this case, can improve the recovery process in several times.</li>
<li><strong>Try to separate your database to different files and filegroups to backing up only appropriate file/filegroup.</strong><br />
This can results in smaller backup operation&#8217;s time. The smaller backup operation&#8217;s time is, the less impact there will be on the server when the backup occurs.</li>
<li><strong>Use Windows NT Performance Monitor or Windows 2000 System Monitor to check a backup impact on the total system performance.</strong><br />
You can verify the following counters: SQL Server Backup Device: Device Throughput Bytes/sec to determine the throughput of specific backup devices, rather than the entire database backup or restore operation; SQL Server Databases: Backup/Restore Throughput/sec to monitor the throughput of the entire database backup or restore operation; PhysicalDisk: % Disk Time to monitors the percentage of time that the disk is busy with read/write activity; Physical Disk Object: Avg. Disk Queue Length to determine how many system requests on average are waiting for disk access.</li>
<li><strong>To decrease the backup operation&#8217;s time consider backing up more often.</strong><br />
The more often you will make backup, the smaller they will be, and the less impact there will be on the server when the backup occurs. So, to avoid locking users for a long time during everyday work, you can perform backup more often.<strong> Note. The more often you will make backup, the less data you will lost if the database becomes corrupt.</strong></li>
<li><strong>Place a tape drive on another SCSI bus as disks or a CD-ROM drive.</strong><br />
The tape drives perform better if they have a dedicated SCSI bus for each tape drive used. Using separate SCSI bus for a tape drive can results in maximum backup performance and prevents conflicts with other drive array access. Microsoft recommends using dedicated SCSI bus for the tape drives whose native transfer rate exceeds 50 percent of the SCSI bus speed.</li>
<li><strong>Use SQL Server 2000 snapshot backups for the very large databases.</strong><br />
The SQL Server 2000 snapshot backup and restore technologies work in conjunction with third party hardware and software vendors. The main advantages of snapshot backups and restores are that they can be done in a very short time, typically measured in seconds, not hours, and reduce the backup/restore impact on the overall server performance. The snapshot backups accomplished by splitting a mirrored set of disks or creating a copy of a disk block when it is written and required the special hardware and software.</li>
</ol>
  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/sqlhelp.wordpress.com/84/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/sqlhelp.wordpress.com/84/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/sqlhelp.wordpress.com/84/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/sqlhelp.wordpress.com/84/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/sqlhelp.wordpress.com/84/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/sqlhelp.wordpress.com/84/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/sqlhelp.wordpress.com/84/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/sqlhelp.wordpress.com/84/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/sqlhelp.wordpress.com/84/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/sqlhelp.wordpress.com/84/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=sqlhelp.wordpress.com&blog=5672629&post=84&subd=sqlhelp&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://sqlhelp.wordpress.com/2008/11/23/backuprestore-optimization-tips/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/344460fcb9807a37c97174a2edc9d970?s=96&#38;d=identicon" medium="image">
			<media:title type="html">Raghunath Bhandari</media:title>
		</media:content>
	</item>
		<item>
		<title>Analyze and Fix Index Fragmentation in SQL Server 2008</title>
		<link>http://sqlhelp.wordpress.com/2008/11/05/analyze-and-fix-index-fragmentation-in-sql-server-2008/</link>
		<comments>http://sqlhelp.wordpress.com/2008/11/05/analyze-and-fix-index-fragmentation-in-sql-server-2008/#comments</comments>
		<pubDate>Wed, 05 Nov 2008 05:39:22 +0000</pubDate>
		<dc:creator>Raghunath Bhandari</dc:creator>
				<category><![CDATA[Fragmentation in SQL]]></category>
		<category><![CDATA[SQL Performance]]></category>
		<category><![CDATA[Advance SQL tips and tricks]]></category>
		<category><![CDATA[Author Raghunath Bhandari]]></category>
		<category><![CDATA[Database]]></category>
		<category><![CDATA[Database Optimization Tips]]></category>
		<category><![CDATA[dba]]></category>
		<category><![CDATA[MCP]]></category>
		<category><![CDATA[Microsoft Certified Professional]]></category>
		<category><![CDATA[Microsoft SQL server]]></category>
		<category><![CDATA[MSDN Help]]></category>
		<category><![CDATA[MSDN SQL News]]></category>
		<category><![CDATA[MSSQL]]></category>
		<category><![CDATA[MSSQL Resources]]></category>
		<category><![CDATA[MSSQL server]]></category>
		<category><![CDATA[MSSQL Server help]]></category>
		<category><![CDATA[SQL]]></category>
		<category><![CDATA[SQL Best practices and tips]]></category>
		<category><![CDATA[SQL Coding Standards]]></category>
		<category><![CDATA[SQL Database Optimization Tricks]]></category>
		<category><![CDATA[SQL Database Settings Optimization Tips]]></category>
		<category><![CDATA[SQL Documentation]]></category>
		<category><![CDATA[SQL Fragmentation]]></category>
		<category><![CDATA[SQL help]]></category>
		<category><![CDATA[SQL Optimization]]></category>
		<category><![CDATA[SQL Optimization Tips]]></category>
		<category><![CDATA[SQL Query]]></category>
		<category><![CDATA[SQL Server]]></category>
		<category><![CDATA[SQL server tips]]></category>
		<category><![CDATA[SQL technology]]></category>
		<category><![CDATA[SQL Tips]]></category>
		<category><![CDATA[SQL Tips and Tricks]]></category>
		<category><![CDATA[SQL tips for programmer]]></category>
		<category><![CDATA[sqlhelp]]></category>
		<category><![CDATA[sqlhelp news]]></category>
		<category><![CDATA[sqlhelp WebSite Review]]></category>
		<category><![CDATA[T-SQL]]></category>
		<category><![CDATA[Technology News]]></category>

		<guid isPermaLink="false">http://sqlhelp.wordpress.com/?p=77</guid>
		<description><![CDATA[Analyze and Fix Index Fragmentation in SQL Server 2008
It is very common that over time SQL Server tables and indexes tend to become fragmented. The fragmentation generally happens when data within the underlying tables on which an index exists is modified. The data modification basically can be an insert, update or a delete operation. The [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=sqlhelp.wordpress.com&blog=5672629&post=77&subd=sqlhelp&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p><strong>Analyze and Fix Index Fragmentation in SQL Server 2008</strong></p>
<p>It is very common that over time SQL Server tables and indexes tend to become fragmented. The fragmentation generally happens when data within the underlying tables on which an index exists is modified. The data modification basically can be an insert, update or a delete operation. The indexes over time become ineffective because they get fragmented. In this article you will see an example of how an index gets fragmented and the steps which database administrator needs to take to fix index fragmentations.</p>
<p><strong>Example to Analyze and Fix Index Fragmentation in SQL Server 2008</strong></p>
<p>Follow the below mentioned steps to see how an index fragmentation occurs on a table which has indexes defined on it. And finally you will see the steps which you need to take to fix index fragmentation issues.</p>
<p><strong>Create AnalyzeFragmentation Database</strong></p>
<p>First let us create a new database named AnalyzeFragmentation for this example. Database can be created by executing the below mentioned TSQL Query.<br />
<code><br />
Use master<br />
GO<br />
IF EXISTS (SELECT name FROM sys.databases WHERE name = N'AnalyzeFragmentation')<br />
DROP DATABASE [AnalyzeFragmentation]<br />
GO<br />
CREATE DATABASE AnalyzeFragmentation<br />
GO</code></p>
<p><strong>Create FindAndFixFragmentation Table in AnalyzeFragmentation Database </strong></p>
<p>The next step will be to create a new table named FindAndFixFragmentation within the AnalyzeFragmentation database.</p>
<p><code><br />
USE AnalyzeFragmentation<br />
GO<br />
IF OBJECT_ID (N'dbo.FindAndFixFragmentation', N'U') IS NOT NULL<br />
DROP TABLE dbo.FindAndFixFragmentation;<br />
GO</code></p>
<p>&#8211; Create FindAndFixFragmentation Table&#8211;<br />
CREATE TABLE [dbo].[FindAndFixFragmentation]<br />
(</p>
<p>[AddressID] [int] NOT NULL,<br />
[AddressLine1] [nvarchar](60) NOT NULL,<br />
[City] [nvarchar](30) NOT NULL,<br />
[PostalCode] [nvarchar](15) NOT NULL,<br />
[ModifiedDate] [datetime] NOT NULL,<br />
[RowGUID] [UNIQUEIDENTIFIER] NOT NULL</p>
<p>)<br />
ON [PRIMARY]</p>
<p>GO</p>
<p><strong>Populate the FindAndFixFragmentation Table using the below TSQL code</strong></p>
<p>The next step will be to populate the FindAndFixFragmentation table which you have created earlier by executing the below mentioned TSQL code. For this example we will be using the data which is available in Person.Address table available in AdventureWorks database.</p>
<p><code><br />
USE AnalyzeFragmentation<br />
GO</code></p>
<p>&#8211; Populate FindAndFixFragmentation table with data from AdventureWorks.Person.Address &#8211;</p>
<p>INSERT INTO FindAndFixFragmentation<br />
SELECT<br />
AddressID,<br />
AddressLine1,<br />
City,<br />
PostalCode,<br />
ModifiedDate,<br />
RowGUID<br />
FROM AdventureWorks.Person.Address<br />
GO</p>
<p><strong>Create a Clustered Index on FindAndFixFragmentation Table using the below TSQL code</strong></p>
<p>The next step will be to create a clustered index named CL_FindAndFixFragmentation_Index on FindAndFixFragmentation table using the below mentioned TSQL code.<br />
<code><br />
-- Drop the index if it is already existing--<br />
IF  EXISTS (SELECT * FROM sys.indexes WHERE object_id = OBJECT_ID(N'[dbo].[FindAndFixFragmentation]') AND name = N'CL_FindAndFixFragmentation_Index')</code></p>
<p>DROP INDEX [CL_FindAndFixFragmentation_Index] ON [dbo].[FindAndFixFragmentation]<br />
GO<br />
&#8211; Create Clustered Index on FindAndFixFragmentation(RowGUID) &#8211;<br />
CREATE CLUSTERED INDEX [CL_FindAndFixFragmentation_Index] ON [dbo].[FindAndFixFragmentation]<br />
(<br />
[RowGUID] ASC<br />
)<br />
WITH (FILLFACTOR = 90) ON [PRIMARY]<br />
GO</p>
<p>You can see that we are creating a clustered index on FindAndFixFragmentation table with a Fill Factor 90. The fill factor option is basically provided for fine tuning index data storage and to improve performance. Whenever an index is created or it is rebuilt, the fill factor value basically determines the percentage of space on each leaf level page that needs to be filled with data. Based on the fill factor value a percentage of free space is allocated on every single page. By default the fill factor value is 0 or 100 which means there will be no free space allocated on each leaf level page. The value for fill factor is defined in percentages and this can be any value in between 1 to 100. In this example the fill factor value provide is 90 which mean on every single page there will be a 10 percentage of free space left to accommodate future growth.</p>
<p><strong>Query to Find Existing Fragmentation on FindAndFixFragmentation Table</strong></p>
<p>Next step will be to execute the below mentioned TSQL query to know the existing fragmentation on FindAndFixFragmentation table. The important values which need to be noted by the database administrators are AvgPageFragmentation and PageCounts. The value for AvgPageFragmentation is 0.341296928327645, which means there is a very little fragmentation existing on the table at this point of time. However the value for PageCounts is 293, which mean the data is stored in that many data pages on SQL Server. This query will be executing many a times in this article.</p>
<p><code><br />
-- Find index fragmentation --<br />
SELECT<br />
DB_NAME(DATABASE_ID) AS [DatabaseName],<br />
OBJECT_NAME(OBJECT_ID) AS TableName,<br />
SI.NAME AS IndexName,<br />
INDEX_TYPE_DESC AS IndexType,<br />
AVG_FRAGMENTATION_IN_PERCENT AS AvgPageFragmentation,<br />
PAGE_COUNT AS PageCounts<br />
FROM sys.dm_db_index_physical_stats (DB_ID(), NULL, NULL , NULL, N'LIMITED') DPS<br />
INNER JOIN sysindexes SI<br />
ON DPS.OBJECT_ID = SI.ID AND DPS.INDEX_ID = SI.INDID<br />
GO<br />
</code></p>
<p>Perform Update Operation on FindAndFixFragmentation Table</p>
<p>Next step will be to perform updates on FindAndFixFragmentation table by executing the below mentioned TSQL code. This query will modify all the data for RowGUID column on which we have created clustered index with fill factor as 90.</p>
<p>&#8211; Update all the rows within to FindAndFixFragmentation table create index fragmentation &#8211;</p>
<p>USE AnalyzeFragmentation<br />
GO<br />
UPDATE FindAndFixFragmentation<br />
SET RowGUID =NEWID()<br />
GO</p>
<p><strong>Execute the query to find existing fragmentation on FindAndFixFragmentation table as shown in the below snippet.<br />
</strong></p>
<p>Now you can see that the value for AvgPageFragmentation has changed from 0.341296928327645 to 99.0049751243781, which means index is completely fragmentation. At the same time the value for PageCounts has changed from 293 to 603, which mean more number of data pages are required to store the content. Now the question which comes to your mind is how this can be fixed.</p>
<p>There are two methods to fix index fragmentation issues in SQL Server 2005 and higher versions. The two methods are Reorganize or Rebuild Index. The Reorganize Index is an online operation, however Rebuild Index is not an online operation until you have specified the option ONLINE=ON while performing the Rebuild. Next step will be to perform first REORGANIZE Index option and then finally perform we will perform the REBUILD and see which options is the best.</p>
<p><strong>Perform Reorgainize Index Operation on Clustered Index of FindAndFixFragmentation Table</strong></p>
<p>First let us perform REORGANIZE Index operation on the clustered index, and then execute the query as shown in the snippet to find the fragmentation on FindAndFixFragmentation table.</p>
<p><code><br />
-- Reorganize [CL_FindAndFixFragmentation_Index] index on  FindAndFixFragmentation --</code></p>
<p>ALTER INDEX [CL_FindAndFixFragmentation_Index] ON FindAndFixFragmentation</p>
<p>REORGANIZE;</p>
<p>GO</p>
<p>Once we have performed the REORGANIZE Index operation you can see that the value for AvgPageFragmentation has changed from 99.0049751243781 to 5.70469798657718, which means index fragmentation is much better that how it was earlier. And at the same time the value for PageCounts has also come down from 603 to 298, this is considerable improvement.</p>
<p>Perform Rebuild Index Operation on Clustered Index of FindAndFixFragmentation Table</p>
<p>Now let us perform REBUILD Index operation on the clustered index, when you are using the Rebuild index operation it basically drops and recreates the index. The important thing what we need to see is does this results in reducing the index fragmentation further down from 5.70469798657718. Once you have performed the Rebuild operation execute the query as shown in the snippet to check the fragmentation on FindAndFixFragmentation table.</p>
<p><code><br />
-- Rebuild [CL_FindAndFixFragmentation_Index] index on  FindAndFixFragmentation --</code></p>
<p>ALTER INDEX [CL_FindAndFixFragmentation_Index] ON FindAndFixFragmentation<br />
REBUILD WITH (FILLFACTOR = 90, ONLINE=ON)<br />
GO</p>
<p>You can see that the value for AvgPageFragmentation is back to 0.341296928327645, which means the fragmentation is same as it was when we began this exercise. And at the same time the value for PageCounts is back to 293. This proves that using <strong>REBUILD</strong> Index operation is better than <strong>REORGANIZE</strong> Index operation.</p>
<p><strong>Reorganize Index</strong></p>
<p>Reorganize Index uses minimal system resources and it is performed online. The biggest advantage is it does not require locks for long time therefore it does not block updates or other user queries. If the index fragmentation ranges in between 5% to 30% then it is better to perform Reorganize Index.</p>
<p><strong>Rebuild Index</strong></p>
<p>Rebuild Index basically drops and recreates the index; this is by far the best approach. If the index fragmentation is greater than 30% then the best strategy will be to use Rebuild Index instead of Reorganize Index.</p>
<p><strong>Conclusion</strong></p>
<p>Database Administrators should always make sure that fragmentation of indexes is handled on time. If the indexes are fragmented then the query response will not only be very slow; the data storage will also require more disk space. In this article you have seen an example where the clustered index gets fragmented over time and the steps which you need to perform to resolve index fragmentation issues.</p>
  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/sqlhelp.wordpress.com/77/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/sqlhelp.wordpress.com/77/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/sqlhelp.wordpress.com/77/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/sqlhelp.wordpress.com/77/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/sqlhelp.wordpress.com/77/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/sqlhelp.wordpress.com/77/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/sqlhelp.wordpress.com/77/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/sqlhelp.wordpress.com/77/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/sqlhelp.wordpress.com/77/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/sqlhelp.wordpress.com/77/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=sqlhelp.wordpress.com&blog=5672629&post=77&subd=sqlhelp&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://sqlhelp.wordpress.com/2008/11/05/analyze-and-fix-index-fragmentation-in-sql-server-2008/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/344460fcb9807a37c97174a2edc9d970?s=96&#38;d=identicon" medium="image">
			<media:title type="html">Raghunath Bhandari</media:title>
		</media:content>
	</item>
		<item>
		<title>How to Cluster SQL Server 2005</title>
		<link>http://sqlhelp.wordpress.com/2008/10/22/how-to-cluster-sql-server-2005/</link>
		<comments>http://sqlhelp.wordpress.com/2008/10/22/how-to-cluster-sql-server-2005/#comments</comments>
		<pubDate>Wed, 22 Oct 2008 07:28:38 +0000</pubDate>
		<dc:creator>Raghunath Bhandari</dc:creator>
				<category><![CDATA[Clustering SQL Server]]></category>
		<category><![CDATA[Advance SQL tips and tricks]]></category>
		<category><![CDATA[Author Raghunath Bhandari]]></category>
		<category><![CDATA[Cluster SQL Server 2005]]></category>
		<category><![CDATA[Database]]></category>
		<category><![CDATA[Database Optimization Tips]]></category>
		<category><![CDATA[dba]]></category>
		<category><![CDATA[MCP]]></category>
		<category><![CDATA[Microsoft Certified Professional]]></category>
		<category><![CDATA[Microsoft SQL server]]></category>
		<category><![CDATA[MSDN Help]]></category>
		<category><![CDATA[MSDN SQL News]]></category>
		<category><![CDATA[MSSQL]]></category>
		<category><![CDATA[MSSQL Resources]]></category>
		<category><![CDATA[MSSQL server]]></category>
		<category><![CDATA[MSSQL Server help]]></category>
		<category><![CDATA[SQL]]></category>
		<category><![CDATA[SQL Best practices and tips]]></category>
		<category><![CDATA[SQL Coding Standards]]></category>
		<category><![CDATA[SQL Database Optimization Tricks]]></category>
		<category><![CDATA[SQL Database Settings Optimization Tips]]></category>
		<category><![CDATA[SQL Documentation]]></category>
		<category><![CDATA[SQL help]]></category>
		<category><![CDATA[SQL Optimization]]></category>
		<category><![CDATA[SQL Optimization Tips]]></category>
		<category><![CDATA[SQL Query]]></category>
		<category><![CDATA[SQL Server]]></category>
		<category><![CDATA[SQL server tips]]></category>
		<category><![CDATA[SQL technology]]></category>
		<category><![CDATA[SQL Tips]]></category>
		<category><![CDATA[SQL Tips and Tricks]]></category>
		<category><![CDATA[SQL tips for programmer]]></category>
		<category><![CDATA[sqlhelp]]></category>
		<category><![CDATA[sqlhelp news]]></category>
		<category><![CDATA[sqlhelp WebSite Review]]></category>
		<category><![CDATA[T-SQL]]></category>
		<category><![CDATA[Technology News]]></category>

		<guid isPermaLink="false">http://sqlhelp.wordpress.com/?p=21</guid>
		<description><![CDATA[How to Cluster SQL Server 2005
Believe it or not, the procedure to install a SQL Server 2005 instance onto a cluster is one of the easiest parts of getting your SQL Server 2005 cluster up and running. The SQL Server 2005 setup program is used for the install and does the hard work for you. [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=sqlhelp.wordpress.com&blog=5672629&post=21&subd=sqlhelp&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p><strong>How to Cluster SQL Server 2005</strong></p>
<p>Believe it or not, the procedure to install a SQL Server 2005 instance onto a cluster is one of the easiest parts of getting your SQL Server 2005 cluster up and running. The SQL Server 2005 setup program is used for the install and does the hard work for you. All you have to do is make a few (but critically important) decisions, and then sit back and watch the installation take place. In fact, the setup program even goes to the trouble to verify that your nodes are all properly configured, and if not, will suggest how to fix most problems before the installation begins.</p>
<blockquote><p>When the installation process does begin, the setup program recognizes all the nodes, and once you give it the go ahead to install on each one, it does, all automatically. SQL Server 2005 binaries are installed on the local drive of each node, and the system databases are stored on the shared array you designate.</p></blockquote>
<p>In the next section are the step-by-steps instructions for installing a SQL Server 2005 instance in a cluster. The assumption for this example is that you will be installing this instance in a 2-node active/passive cluster. Even if you will be installing a 2-node active/active or a multi-node cluster, the steps in this section are virtually the same. The only real difference is that you will have to run SQL Server 2005 setup for every instance you want to install on the cluster, and you will have to specify a different logical drive on the shared array.<br />

<a href='http://sqlhelp.wordpress.com/2008/10/22/how-to-cluster-sql-server-2005/cluster_sql_server_2005_01/' title='cluster_sql_server_2005_01'><img width="150" height="136" src="http://sqlhelp.files.wordpress.com/2008/11/cluster_sql_server_2005_01.gif?w=150&#038;h=136" class="attachment-thumbnail" alt="" title="cluster_sql_server_2005_01" /></a>
<a href='http://sqlhelp.wordpress.com/2008/10/22/how-to-cluster-sql-server-2005/cluster_sql_server_2005_02/' title='cluster_sql_server_2005_02'><img width="150" height="136" src="http://sqlhelp.files.wordpress.com/2008/11/cluster_sql_server_2005_02.gif?w=150&#038;h=136" class="attachment-thumbnail" alt="" title="cluster_sql_server_2005_02" /></a>
<a href='http://sqlhelp.wordpress.com/2008/10/22/how-to-cluster-sql-server-2005/cluster_sql_server_2005_03/' title='cluster_sql_server_2005_03'><img width="150" height="136" src="http://sqlhelp.files.wordpress.com/2008/11/cluster_sql_server_2005_03.gif?w=150&#038;h=136" class="attachment-thumbnail" alt="" title="cluster_sql_server_2005_03" /></a>
</p>
<p><strong>Clustering SQL Server</strong></p>
<p>To begin installing your SQL Server 2005 cluster, you will need the installation CD or DVD. You can either install it directly from the media, or copy the install files from the media to the current active node of the cluster, and run the setup program from there.</p>
<p>To begin the installation, run Setup.exe. After an introductory screen, you will get the first install dialog box as shown in the figure below.</p>
<p>The Installing Prerequisites dialog box lists the prerequisites that need to be installed before installation of SQL Server 2005 can begin. The number of components may vary from the above figure, depending on what you have already installed on your nodes. What is interesting to note here is that these prerequisite components will only be installed immediately on the active node. They will be installed on the passive node later during the installation process. This is done automatically and you don&#8217;t have to worry about it.</p>
<p>Click Install to install these components. When completed, you will get a dialog box telling you that they were installed successfully, and then you can the click Next to proceed. On occasion, I have seen these components fail to install correctly. If this happens, you will have to troubleshoot the installation. Generally speaking, try rebooting both nodes of the cluster and try installing them again. This often fixes whatever caused the first setup try to fail.</p>
<p>Once the prerequisite components have been successfully installed, the SQL Server Installation Wizard launches</p>
  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/sqlhelp.wordpress.com/21/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/sqlhelp.wordpress.com/21/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/sqlhelp.wordpress.com/21/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/sqlhelp.wordpress.com/21/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/sqlhelp.wordpress.com/21/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/sqlhelp.wordpress.com/21/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/sqlhelp.wordpress.com/21/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/sqlhelp.wordpress.com/21/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/sqlhelp.wordpress.com/21/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/sqlhelp.wordpress.com/21/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=sqlhelp.wordpress.com&blog=5672629&post=21&subd=sqlhelp&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://sqlhelp.wordpress.com/2008/10/22/how-to-cluster-sql-server-2005/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/344460fcb9807a37c97174a2edc9d970?s=96&#38;d=identicon" medium="image">
			<media:title type="html">Raghunath Bhandari</media:title>
		</media:content>
	</item>
		<item>
		<title>SQL Tuning or SQL Optimization</title>
		<link>http://sqlhelp.wordpress.com/2008/10/16/47/</link>
		<comments>http://sqlhelp.wordpress.com/2008/10/16/47/#comments</comments>
		<pubDate>Thu, 16 Oct 2008 10:38:56 +0000</pubDate>
		<dc:creator>Raghunath Bhandari</dc:creator>
				<category><![CDATA[SQL Performance]]></category>
		<category><![CDATA[SQL Database Settings Optimization Tips]]></category>
		<category><![CDATA[SQL Optimization]]></category>
		<category><![CDATA[SQL Tuning]]></category>
		<category><![CDATA[SQL help]]></category>
		<category><![CDATA[Advance SQL tips and tricks]]></category>
		<category><![CDATA[SQL Tips]]></category>
		<category><![CDATA[sqlhelp]]></category>
		<category><![CDATA[SQL server tips]]></category>
		<category><![CDATA[SQL Optimization Tips]]></category>
		<category><![CDATA[Database Optimization Tips]]></category>
		<category><![CDATA[SQL Database Optimization Tricks]]></category>
		<category><![CDATA[SQL tips for programmer]]></category>
		<category><![CDATA[SQL technology]]></category>
		<category><![CDATA[SQL Server]]></category>
		<category><![CDATA[SQL]]></category>
		<category><![CDATA[SQL Query]]></category>
		<category><![CDATA[dba]]></category>
		<category><![CDATA[Database]]></category>
		<category><![CDATA[SQL Tips and Tricks]]></category>
		<category><![CDATA[T-SQL]]></category>
		<category><![CDATA[SQL Documentation]]></category>
		<category><![CDATA[sqlhelp news]]></category>
		<category><![CDATA[Author Raghunath Bhandari]]></category>
		<category><![CDATA[sqlhelp WebSite Review]]></category>
		<category><![CDATA[MCP]]></category>
		<category><![CDATA[Microsoft Certified Professional]]></category>
		<category><![CDATA[MSDN SQL News]]></category>
		<category><![CDATA[MSDN Help]]></category>
		<category><![CDATA[Technology News]]></category>
		<category><![CDATA[SQL Best practices and tips]]></category>
		<category><![CDATA[SQL Coding Standards]]></category>
		<category><![CDATA[MSSQL Resources]]></category>
		<category><![CDATA[MSSQL Server help]]></category>

		<guid isPermaLink="false">http://sqlhelp.wordpress.com/?p=47</guid>
		<description><![CDATA[SQL Tuning or SQL Optimization
Sql Statements are used to retrieve data from the database. We can get same results by writing different sql queries. But use of the best query is important when performance is considered. So you need to sql query tuning based on the requirement. Here is the list of queries which we [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=sqlhelp.wordpress.com&blog=5672629&post=47&subd=sqlhelp&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p><strong>SQL Tuning or SQL Optimization</strong></p>
<p>Sql Statements are used to retrieve data from the database. We can get same results by writing different sql queries. But use of the best query is important when performance is considered. So you need to sql query tuning based on the requirement. Here is the list of queries which we use reqularly and how these sql queries can be optimized for better performance.</p>
<p><strong>SQL Tuning/SQL Optimization Techniques:</strong></p>
<p>1) The sql query becomes faster if you use the actual columns names in SELECT statement instead of than &#8216;*&#8217;.</p>
<p>For Example: Write the query as</p>
<p><code>SELECT id, first_name, last_name, age, subject FROM student_details;</code></p>
<p>Instead of:</p>
<p><code>SELECT * FROM student_details;<br />
</code></p>
<p>2) HAVING clause is used to filter the rows after all the rows are selected. It is just like a filter. Do not use HAVING clause for any other purposes.<br />
For Example: Write the query as</p>
<p><code>SELECT subject, count(subject)<br />
FROM student_details<br />
WHERE subject != 'Science'<br />
AND subject != 'Maths'<br />
GROUP BY subject;</code></p>
<p><strong>Instead of:</strong></p>
<p><code>SELECT subject, count(subject)<br />
FROM student_details<br />
GROUP BY subject<br />
HAVING subject!= 'Vancouver' AND subject!= 'Toronto';</code></p>
<p>3) Sometimes you may have more than one subqueries in your main query. Try to minimize the number of subquery block in your query.<br />
For Example: Write the query as</p>
<p><code>SELECT name<br />
FROM employee<br />
WHERE (salary, age ) = (SELECT MAX (salary), MAX (age)<br />
FROM employee_details)<br />
AND dept = 'Electronics';<br />
</code><br />
Instead of:<br />
<code><br />
SELECT name<br />
FROM employee<br />
WHERE salary = (SELECT MAX(salary) FROM employee_details)<br />
AND age = (SELECT MAX(age) FROM employee_details)<br />
AND emp_dept = 'Electronics';</code></p>
<p>4) Use operator EXISTS, IN and table joins appropriately in your query.<br />
a) Usually IN has the slowest performance.<br />
b) IN is efficient when most of the filter criteria is in the sub-query.<br />
c) EXISTS is efficient when most of the filter criteria is in the main query.</p>
<p>For Example: Write the query as</p>
<p><code>Select * from product p<br />
where EXISTS (select * from order_items o<br />
where o.product_id = p.product_id)</code></p>
<p>Instead of:<br />
<code><br />
Select * from product p<br />
where product_id IN<br />
(select product_id from order_items</code></p>
<blockquote><p>5) Use EXISTS instead of DISTINCT when using joins which involves tables having one-to-many relationship.<br />
For Example: Write the query as</p></blockquote>
<p><code>SELECT d.dept_id, d.dept<br />
FROM dept d<br />
WHERE EXISTS ( SELECT 'X' FROM employee e WHERE e.dept = d.dept);</code></p>
<p>Instead of:</p>
<p><code>SELECT DISTINCT d.dept_id, d.dept<br />
FROM dept d,employee e<br />
WHERE e.dept = e.dept;</code></p>
<p>6) Try to use UNION ALL in place of UNION.<br />
For Example: Write the query as</p>
<p><code>SELECT id, first_name<br />
FROM student_details_class10<br />
UNION ALL<br />
SELECT id, first_name<br />
FROM sports_team;</code></p>
<p>Instead of:</p>
<p><code>SELECT id, first_name, subject<br />
FROM student_details_class10<br />
UNION<br />
SELECT id, first_name<br />
FROM sports_team;</code></p>
<blockquote><p>7) Be careful while using conditions in WHERE clause.<br />
For Example: Write the query as</p></blockquote>
<p><code>SELECT id, first_name, age FROM student_details WHERE age &gt; 10;</code></p>
<p>Instead of:</p>
<p><code>SELECT id, first_name, age FROM student_details WHERE age != 10;</code></p>
<p>Write the query as<br />
<code><br />
SELECT id, first_name, age<br />
FROM student_details<br />
WHERE first_name LIKE 'Chan%';</code></p>
<p>Instead of:</p>
<p><code>SELECT id, first_name, age<br />
FROM student_details<br />
WHERE SUBSTR(first_name,1,3) = 'Cha';</code></p>
<p>Write the query as</p>
<p><code>SELECT id, first_name, age<br />
FROM student_details<br />
WHERE first_name LIKE NVL ( :name, '%');</code></p>
<p>Instead of:</p>
<p><code>SELECT id, first_name, age<br />
FROM student_details<br />
WHERE first_name = NVL ( :name, first_name);</code></p>
<p>Write the query as</p>
<p><code>SELECT product_id, product_name<br />
FROM product<br />
WHERE unit_price BETWEEN MAX(unit_price) and MIN(unit_price)</code></p>
<p>Instead of:</p>
<p><code>SELECT product_id, product_name<br />
FROM product<br />
WHERE unit_price &gt;= MAX(unit_price)<br />
and unit_price &lt;= MIN(unit_price)</code></p>
<p>Write the query as<br />
<code><br />
SELECT id, name, salary<br />
FROM employee<br />
WHERE dept = 'Electronics'<br />
AND location = 'Bangalore';</code></p>
<p>Instead of:</p>
<p><code>SELECT id, name, salary<br />
FROM employee<br />
WHERE dept || location= 'ElectronicsBangalore';</code></p>
<p>Use non-column expression on one side of the query because it will be processed earlier.</p>
<p>Write the query as<br />
<code><br />
SELECT id, name, salary<br />
FROM employee<br />
WHERE salary &lt; 25000;</code></p>
<p>Instead of:</p>
<p><code>SELECT id, name, salary<br />
FROM employee<br />
WHERE salary + 10000 &lt; 35000;</code></p>
<p>Write the query as</p>
<p><code>SELECT id, first_name, age<br />
FROM student_details<br />
WHERE age &gt; 10;<br />
</code></p>
<p>Instead of:</p>
<p><code>SELECT id, first_name, age<br />
FROM student_details<br />
WHERE age NOT = 10;</code></p>
<p> <img src='http://s.wordpress.com/wp-includes/images/smilies/icon_cool.gif' alt='8)' class='wp-smiley' /> Use DECODE to avoid the scanning of same rows or joining the same table repetitively. DECODE can also be made used in place of GROUP BY or ORDER BY clause.<br />
For Example: Write the query as</p>
<p><code>SELECT id FROM employee<br />
WHERE name LIKE 'Ramesh%'<br />
and location = 'Bangalore';</code></p>
<p>Instead of:</p>
<p><code>SELECT DECODE(location,'Bangalore',id,NULL) id FROM employee<br />
WHERE name LIKE 'Ramesh%';<br />
</code></p>
<blockquote><p>9) To store large binary objects, first place them in the file system and add the file path in the database.</p></blockquote>
<p>10) To write queries which provide efficient performance follow the general SQL standard rules.</p>
<p>a) Use single case for all SQL verbs<br />
b) Begin all SQL verbs on a new line<br />
c) Separate all words with a single space<br />
d) Right or left aligning verbs within the initial SQL verb</p>
  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/sqlhelp.wordpress.com/47/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/sqlhelp.wordpress.com/47/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/sqlhelp.wordpress.com/47/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/sqlhelp.wordpress.com/47/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/sqlhelp.wordpress.com/47/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/sqlhelp.wordpress.com/47/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/sqlhelp.wordpress.com/47/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/sqlhelp.wordpress.com/47/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/sqlhelp.wordpress.com/47/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/sqlhelp.wordpress.com/47/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=sqlhelp.wordpress.com&blog=5672629&post=47&subd=sqlhelp&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://sqlhelp.wordpress.com/2008/10/16/47/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/344460fcb9807a37c97174a2edc9d970?s=96&#38;d=identicon" medium="image">
			<media:title type="html">Raghunath Bhandari</media:title>
		</media:content>
	</item>
		<item>
		<title>SQL Subquery</title>
		<link>http://sqlhelp.wordpress.com/2008/10/15/sql-subquery/</link>
		<comments>http://sqlhelp.wordpress.com/2008/10/15/sql-subquery/#comments</comments>
		<pubDate>Wed, 15 Oct 2008 10:30:25 +0000</pubDate>
		<dc:creator>Raghunath Bhandari</dc:creator>
				<category><![CDATA[SQL Subquery]]></category>
		<category><![CDATA[Advance SQL tips and tricks]]></category>
		<category><![CDATA[Author Raghunath Bhandari]]></category>
		<category><![CDATA[Database]]></category>
		<category><![CDATA[Database Optimization Tips]]></category>
		<category><![CDATA[dba]]></category>
		<category><![CDATA[MCP]]></category>
		<category><![CDATA[Microsoft Certified Professional]]></category>
		<category><![CDATA[Microsoft SQL server]]></category>
		<category><![CDATA[MSDN Help]]></category>
		<category><![CDATA[MSDN SQL News]]></category>
		<category><![CDATA[MSSQL]]></category>
		<category><![CDATA[MSSQL Resources]]></category>
		<category><![CDATA[MSSQL server]]></category>
		<category><![CDATA[MSSQL Server help]]></category>
		<category><![CDATA[SQL]]></category>
		<category><![CDATA[SQL Best practices and tips]]></category>
		<category><![CDATA[SQL Coding Standards]]></category>
		<category><![CDATA[SQL Database Optimization Tricks]]></category>
		<category><![CDATA[SQL Database Settings Optimization Tips]]></category>
		<category><![CDATA[SQL Documentation]]></category>
		<category><![CDATA[SQL help]]></category>
		<category><![CDATA[SQL Optimization]]></category>
		<category><![CDATA[SQL Optimization Tips]]></category>
		<category><![CDATA[SQL Query]]></category>
		<category><![CDATA[SQL Server]]></category>
		<category><![CDATA[SQL server tips]]></category>
		<category><![CDATA[SQL technology]]></category>
		<category><![CDATA[SQL Tips]]></category>
		<category><![CDATA[SQL Tips and Tricks]]></category>
		<category><![CDATA[SQL tips for programmer]]></category>
		<category><![CDATA[sqlhelp]]></category>
		<category><![CDATA[sqlhelp news]]></category>
		<category><![CDATA[sqlhelp WebSite Review]]></category>
		<category><![CDATA[T-SQL]]></category>
		<category><![CDATA[Technology News]]></category>

		<guid isPermaLink="false">http://sqlhelp.wordpress.com/?p=42</guid>
		<description><![CDATA[SQL Subquery
Subquery or Inner query or Nested query is a query in a query. A subquery is usually added in the WHERE Clause of the sql statement. Most of the time, a subquery is used when you know how to search for a value using a SELECT statement, but do not know the exact value.
Subqueries [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=sqlhelp.wordpress.com&blog=5672629&post=42&subd=sqlhelp&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p><strong>SQL Subquery</strong></p>
<p>Subquery or Inner query or Nested query is a query in a query. A subquery is usually added in the WHERE Clause of the sql statement. Most of the time, a subquery is used when you know how to search for a value using a SELECT statement, but do not know the exact value.</p>
<blockquote><p>Subqueries are an alternate way of returning data from multiple tables.</p></blockquote>
<p><strong><br />
Subqueries can be used with the following sql statements along with the comparision operators like =, &lt;, &gt;, &gt;=, &lt;= etc.<br />
</strong></p>
<ul>
<li> SELECT</li>
<li> INSERT</li>
<li> UPDATE</li>
<li> DELETE</li>
</ul>
<p><strong>For Example:</strong></p>
<p><strong>1) Usually, a subquery should return only one record, but sometimes it can also return multiple records when used with operators like IN, NOT IN in the where clause. The query would be like,<br />
</strong></p>
<p><code>SELECT first_name, last_name, subject<br />
FROM student_details<br />
WHERE games NOT IN (‘Cricket’, ‘Football’);<br />
</code><br />
The output would be similar to:</p>
<p>first_name     last_name     games<br />
&#8212;&#8212;&#8212;&#8212;-     &#8212;&#8212;&#8212;&#8212;-     &#8212;&#8212;&#8212;-<br />
Shekar     Gowda     Badminton<br />
Priya     Chandra     Chess</p>
<p>2) Lets consider the student_details table which we have used earlier. If you know the name of the students who are studying science subject, you can get their id&#8217;s by using this query below,</p>
<p><code>SELECT id, first_name<br />
FROM student_details<br />
WHERE first_name IN ('Rahul', 'Stephen');</code></p>
<p><strong>but, if you do not know their names, then to get their id&#8217;s you need to write the query in this manner,</strong></p>
<p><code>SELECT id, first_name<br />
FROM student_details<br />
WHERE first_name IN (SELECT first_name<br />
FROM student_details<br />
WHERE subject= 'Science');</code></p>
<p>Output:</p>
<p><code><br />
id     first_name<br />
--------     -------------<br />
100     Rahul<br />
102     Stephen<br />
</code></p>
<p>In the above sql statement, first the inner query is processed first and then the outer query is processed.</p>
<p>3) Subquery can be used with INSERT statement to add rows of data from one or more tables to another table. Lets try to group all the students who study Maths in a table &#8216;maths_group&#8217;.</p>
<p><code><br />
INSERT INTO maths_group(id, name)<br />
SELECT id, first_name || ' ' || last_name<br />
FROM student_details WHERE subject= 'Maths'<br />
</code></p>
<p>4) A subquery can be used in the SELECT statement as follows. Lets use the product and order_items table defined in the sql_joins section.</p>
<p>select p.product_name, p.supplier_name, (select order_id from order_items where product_id = 101) as order_id from product p where p.product_id = 101</p>
<p><code><br />
product_name     supplier_name     order_id<br />
------------------     ------------------     ----------<br />
Television     Onida     5103<br />
Correlated Subquery<br />
</code></p>
<p>A query is called correlated subquery when both the inner query and the outer query are interdependent. For every row processed by the inner query, the outer query is processed as well. The inner query depends on the outer query before it can be processed.</p>
<p><code><br />
SELECT p.product_name FROM product p<br />
WHERE p.product_id = (SELECT o.product_id FROM order_items o<br />
WHERE o.product_id = p.product_id);<br />
</code></p>
<blockquote><p>NOTE:<br />
1) You can nest as many queries you want but it is recommended not to nest more than 16 subqueries in oracle.<br />
2) If a subquery is not dependent on the outer query it is called a non-correlated subquery.</p></blockquote>
  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/sqlhelp.wordpress.com/42/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/sqlhelp.wordpress.com/42/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/sqlhelp.wordpress.com/42/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/sqlhelp.wordpress.com/42/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/sqlhelp.wordpress.com/42/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/sqlhelp.wordpress.com/42/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/sqlhelp.wordpress.com/42/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/sqlhelp.wordpress.com/42/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/sqlhelp.wordpress.com/42/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/sqlhelp.wordpress.com/42/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=sqlhelp.wordpress.com&blog=5672629&post=42&subd=sqlhelp&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://sqlhelp.wordpress.com/2008/10/15/sql-subquery/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/344460fcb9807a37c97174a2edc9d970?s=96&#38;d=identicon" medium="image">
			<media:title type="html">Raghunath Bhandari</media:title>
		</media:content>
	</item>
		<item>
		<title>Using Stored Procedures</title>
		<link>http://sqlhelp.wordpress.com/2008/10/10/using-stored-procedures/</link>
		<comments>http://sqlhelp.wordpress.com/2008/10/10/using-stored-procedures/#comments</comments>
		<pubDate>Fri, 10 Oct 2008 07:05:07 +0000</pubDate>
		<dc:creator>Raghunath Bhandari</dc:creator>
				<category><![CDATA[Stored Procedures]]></category>
		<category><![CDATA[Advance SQL tips and tricks]]></category>
		<category><![CDATA[Author Raghunath Bhandari]]></category>
		<category><![CDATA[Database]]></category>
		<category><![CDATA[Database Optimization Tips]]></category>
		<category><![CDATA[dba]]></category>
		<category><![CDATA[MCP]]></category>
		<category><![CDATA[Microsoft Certified Professional]]></category>
		<category><![CDATA[MSDN Help]]></category>
		<category><![CDATA[MSDN SQL News]]></category>
		<category><![CDATA[MSSQL Resources]]></category>
		<category><![CDATA[MSSQL Server help]]></category>
		<category><![CDATA[SQL]]></category>
		<category><![CDATA[SQL Best practices and tips]]></category>
		<category><![CDATA[SQL Coding Standards]]></category>
		<category><![CDATA[SQL Database Optimization Tricks]]></category>
		<category><![CDATA[SQL Database Settings Optimization Tips]]></category>
		<category><![CDATA[SQL Documentation]]></category>
		<category><![CDATA[SQL help]]></category>
		<category><![CDATA[SQL Optimization]]></category>
		<category><![CDATA[SQL Optimization Tips]]></category>
		<category><![CDATA[SQL Query]]></category>
		<category><![CDATA[SQL Server]]></category>
		<category><![CDATA[SQL server tips]]></category>
		<category><![CDATA[SQL technology]]></category>
		<category><![CDATA[SQL Tips]]></category>
		<category><![CDATA[SQL Tips and Tricks]]></category>
		<category><![CDATA[SQL tips for programmer]]></category>
		<category><![CDATA[sqlhelp]]></category>
		<category><![CDATA[sqlhelp news]]></category>
		<category><![CDATA[sqlhelp WebSite Review]]></category>
		<category><![CDATA[T-SQL]]></category>
		<category><![CDATA[Technology News]]></category>

		<guid isPermaLink="false">http://sqlhelp.wordpress.com/?p=16</guid>
		<description><![CDATA[Most of us, the database programmers, have used Stored Procedures. May be not all of us knows about why we use them. This article is for those who have used/never used stored procedures, and are yet to understand why everyone suggests using them in your Database.
Stored Procedures – What are they? 
Stored procedure is a [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=sqlhelp.wordpress.com&blog=5672629&post=16&subd=sqlhelp&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p>Most of us, the database programmers, have used Stored Procedures. May be not all of us knows about why we use them. This article is for those who have used/never used stored procedures, and are yet to understand why everyone suggests using them in your Database.</p>
<p><span style="color:#800000;"><strong>Stored Procedures – What are they? </strong></span></p>
<blockquote><p>Stored procedure is a set of pre-defined Transact-SQL statements, used to perform a specific task. There can be multiple statements in a stored procedure, and all the multiple statements are clubbed in to one database object.</p></blockquote>
<p><span style="color:#800000;"><strong>How to create a stored procedure? </strong></span></p>
<p>Creating a stored procedure is as easy as running the “Create Procedure” statement followed by the SQL script. You can run your Create Procedure statement from the SQL Query Analyzer, or can use the New Procedure menu item in the Enterprise Manager.</p>
<p><span style="color:#800000;"><strong>The simplest skeleton of a stored procedure. </strong></span></p>
<p><code>CREATE PROC procedure_name<br />
[ { @parameter data_type }<br />
]<br />
AS sql_statement</code></p>
<p>Check the basic building blocks of a stored procedure.</p>
<p><span style="color:#800000;"><strong>A stored procedure includes</strong>:</span></p>
<p>1.      A CREATE PROC (CREATE PROCEDURE) statement;<br />
2.      The procedure name;<br />
3.      The parameter list<br />
4.      And the SQL statements.</p>
<p>Even though there are numerous other options available while we define a stored procedure, I kept it simple, just to give you a basic idea about creating stored procedures.</p>
<p><span style="color:#800000;"><strong> Advantages! </strong></span></p>
<p>Almost every database Guru that you will meet, will suggest using stored procedures. For you, it will seem as if most of them blindly believes in stored procedures. But there are reasons for this. This is what I am trying to explore in this article.</p>
<p><span style="color:#800000;"><strong>1. Performance </strong></span></p>
<p>All the SQL statements, that you send to your database server passes through a series of actions, called execution. These are the steps that your SQL statement passes through before the data is returned to the client.</p>
<p>User sends request to execute the Stored Procedure. SQL Server checks for syntax errors. Identifies and checks the aliases in the FROM clause. Creates a query plan. Compiles the query and. Executes the query plan and return the requested data.</p>
<p>See, lots of things are happening inside that we didn’t knew about. Now, the crucial question. Does a stored procedure bypass all these?</p>
<p>In a way, yes. The previous versions of SQL Server stored the compiled execution plan in system tables, making them partially pre-compiled. This improved performance, because the Server did not have to compile the stored procedure each and every time it is called.</p>
<p>In later versions of SQL Server, there were a large number of changes in statement processing. Now, the stored procedure is stored in a procedure cache when it is called, making subsequent calls faster.</p>
<p><span style="color:#800000;"><strong>2. Security </strong><br />
</span><br />
Stored procedures provide significant benefits when it comes to security. By using a stored procedure, you can grant permissions to certain users to access data, reducing the immense coding that you need to do in your client applications. This is one of the best ways to control access to your data.</p>
<p><span style="color:#800000;"><strong>3. Modifications/Maintenance </strong></span></p>
<p>If you use stored procedures for database access, any change in the database can be reflected on to the client application without much effort. This is because you know exactly where the data is accessed from, and you also know exactly where you need to alter. This means no scuba diving in to thousands of lines of source code to identify areas where you need to alter and no headache of re-deploying the client application.</p>
<p><span style="color:#800000;"><strong>4. Minimal processing at the client. </strong></span></p>
<p>When creating a client/server application, normally it was the client who took care of the integrity of data that went in to the database. Managing Primary Keys, Foreign keys, cascaded deletion everything was done by the client, and the database server just had to store data given by the client.</p>
<p>Well friends, things have changed. Stored procedures help you write batch of SQL statements, which helps you manage the transactions, constraints etc. A little data aware code has to be written in to the client application, making it a thin-client application. These applications will be concerned more about displaying data in the way the user needs them and they know little about the database.</p>
<p>Take another scenario. You have a database with millions of rows and hundreds of tables. You need to do some calculations before updating each and every record. If you are fetching the complete data to the client, and is asking the client machine to process the data completely, then think about the overhead it creates. But when the client can execute a store procedure, where you have done the calculations prior to updating the records, you have a client, that doesn’t need to know about the calculations. This also reduces the amount of computing happening in the client, and the server takes care of tedious calculations.</p>
<p><span style="color:#800000;"><strong>5. Network traffic </strong></span></p>
<p>Client applications always have to request/send data from the database server. These data are sent as packets, and travel through the network to the server.</p>
<p>To explain how stored procedures can help reduce network traffic, let us see another scenario, where a request for data is send from the client. The request is sent as an SQL statement, and here it is.</p>
<p><code>SELECT dbo.Tbl_Tablename.fieldID,<br />
dbo.Tbl_Tablename.fieldName,<br />
dbo.Tbl_Tablename.Title,<br />
dbo.TBl_otherTableName.fieldID,<br />
dbo.Tbl_Tablename.Published,<br />
dbo.Tbl_Tablename.Updated,<br />
dbo.Tbl_Tablename.SomeText,<br />
dbo.Tbl_Tablename.TransactionDate,<br />
dbo.Tbl_Tablename.Approved,<br />
dbo.Tbl_Tablename.ApprovedBy,<br />
dbo.Tbl_Tablename.ApprovalID<br />
FROM<br />
dbo.Tbl_Tablename<br />
LEFT OUTER JOIN<br />
dbo.TBl_otherTableName on dbo.Tbl_Tablename.fieldID=dbo.TBl_otherTableName.ID<br />
Where<br />
DateDiff ( wk, dbo.Tbl_Tablename.TransactionDate, getdate()) &lt;= 1<br />
and dbo.Tbl_Tablename.Approved = 0<br />
</code></p>
<blockquote><p>518 Characters travel through the network, and when there are 20 client applications using this stored procedure 20 times a day, the number of characters passing through the network for just this request will be 2,07,200!</p>
<p><em>You see the difference now. If it was a stored procedure, lets call it SP_fetchSomething, there are only 6800 characters in the network for the request. A saving of 2,004,00!</em></p></blockquote>
<p><strong> As you have seen the five major points that I use to explain why I used a stored procedure, I hope you will also elect to intelligently use this awesome technology in your next database design.</strong></p>
  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/sqlhelp.wordpress.com/16/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/sqlhelp.wordpress.com/16/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/sqlhelp.wordpress.com/16/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/sqlhelp.wordpress.com/16/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/sqlhelp.wordpress.com/16/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/sqlhelp.wordpress.com/16/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/sqlhelp.wordpress.com/16/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/sqlhelp.wordpress.com/16/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/sqlhelp.wordpress.com/16/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/sqlhelp.wordpress.com/16/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=sqlhelp.wordpress.com&blog=5672629&post=16&subd=sqlhelp&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://sqlhelp.wordpress.com/2008/10/10/using-stored-procedures/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/344460fcb9807a37c97174a2edc9d970?s=96&#38;d=identicon" medium="image">
			<media:title type="html">Raghunath Bhandari</media:title>
		</media:content>
	</item>
		<item>
		<title>SQL Server Date Formats CAST and CONVERT</title>
		<link>http://sqlhelp.wordpress.com/2008/10/03/149/</link>
		<comments>http://sqlhelp.wordpress.com/2008/10/03/149/#comments</comments>
		<pubDate>Fri, 03 Oct 2008 06:24:08 +0000</pubDate>
		<dc:creator>Raghunath Bhandari</dc:creator>
				<category><![CDATA[SQL Server Date Formats]]></category>
		<category><![CDATA[Advance SQL tips and tricks]]></category>
		<category><![CDATA[Author Raghunath Bhandari]]></category>
		<category><![CDATA[Database]]></category>
		<category><![CDATA[Database Optimization Tips]]></category>
		<category><![CDATA[Date Formats CAST and CONVERT]]></category>
		<category><![CDATA[dba]]></category>
		<category><![CDATA[MCP]]></category>
		<category><![CDATA[Microsoft Certified Professional]]></category>
		<category><![CDATA[Microsoft SQL server]]></category>
		<category><![CDATA[MSDN Help]]></category>
		<category><![CDATA[MSDN SQL News]]></category>
		<category><![CDATA[MSSQL]]></category>
		<category><![CDATA[MSSQL Resources]]></category>
		<category><![CDATA[MSSQL server]]></category>
		<category><![CDATA[MSSQL Server help]]></category>
		<category><![CDATA[SQL]]></category>
		<category><![CDATA[SQL Best practices and tips]]></category>
		<category><![CDATA[SQL Coding Standards]]></category>
		<category><![CDATA[SQL Database Optimization Tricks]]></category>
		<category><![CDATA[SQL Database Settings Optimization Tips]]></category>
		<category><![CDATA[SQL Documentation]]></category>
		<category><![CDATA[SQL help]]></category>
		<category><![CDATA[SQL Optimization]]></category>
		<category><![CDATA[SQL Optimization Tips]]></category>
		<category><![CDATA[SQL Query]]></category>
		<category><![CDATA[SQL Server]]></category>
		<category><![CDATA[SQL server tips]]></category>
		<category><![CDATA[SQL technology]]></category>
		<category><![CDATA[SQL Tips]]></category>
		<category><![CDATA[SQL Tips and Tricks]]></category>
		<category><![CDATA[SQL tips for programmer]]></category>
		<category><![CDATA[sqlhelp]]></category>
		<category><![CDATA[sqlhelp news]]></category>
		<category><![CDATA[sqlhelp WebSite Review]]></category>
		<category><![CDATA[T-SQL]]></category>
		<category><![CDATA[Technology News]]></category>

		<guid isPermaLink="false">http://sqlhelp.wordpress.com/?p=149</guid>
		<description><![CDATA[Date Formats CAST and CONVERT (Transact-SQL)
Converts an expression of one data type to another.
Topic link icon Transact-SQL Syntax Conventions
Syntax for CAST:
CAST ( expression AS data_type [ (length ) ])
Syntax for CONVERT:
CONVERT ( data_type [ ( length ) ] , expression [ , style ] )
SQL Server Date Formats



Default

SELECT CONVERT(VARCHAR(20), GETDATE(), 100)

Jan 1 2005 1:29PM 1


USA

SELECT [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=sqlhelp.wordpress.com&blog=5672629&post=149&subd=sqlhelp&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p><strong>Date Formats CAST and CONVERT (Transact-SQL)</strong></p>
<blockquote><p>Converts an expression of one data type to another.<br />
Topic link icon Transact-SQL Syntax Conventions</p></blockquote>
<p><strong>Syntax for CAST:</strong></p>
<pre>CAST ( expression AS data_type [ (length ) ])</pre>
<p><strong>Syntax for CONVERT:</strong></p>
<pre>CONVERT ( data_type [ ( length ) ] , expression [ , style ] )</pre>
<p><strong>SQL Server Date Formats</strong></p>
<table border="1" cellspacing="0" cellpadding="0">
<tbody>
<tr>
<td align="center">Default</td>
<td>
<pre>SELECT CONVERT(VARCHAR(20), GETDATE(), 100)</pre>
</td>
<td align="center">Jan 1 2005 1:29PM 1</td>
</tr>
<tr>
<td align="center">USA</td>
<td>
<pre>SELECT CONVERT(VARCHAR(8), GETDATE(), 1) AS [MM/DD/YY]</pre>
</td>
<td align="center">11/23/98</td>
</tr>
<tr>
<td align="center">USA</td>
<td>
<pre>SELECT CONVERT(VARCHAR(10), GETDATE(), 101) AS [MM/DD/YYYY]</pre>
</td>
<td align="center">11/23/1998</td>
</tr>
<tr>
<td align="center">ANSI</td>
<td>
<pre>SELECT CONVERT(VARCHAR(8), GETDATE(), 2) AS [YY.MM.DD]</pre>
</td>
<td align="center">72.01.01</td>
</tr>
<tr>
<td align="center">ANSI</td>
<td>
<pre>SELECT CONVERT(VARCHAR(10), GETDATE(), 102) AS [YYYY.MM.DD]</pre>
</td>
<td align="center">1972.01.01</td>
</tr>
<tr>
<td align="center">British/French</td>
<td>
<pre>SELECT CONVERT(VARCHAR(8), GETDATE(), 3) AS [DD/MM/YY]</pre>
</td>
<td align="center">19/02/72</td>
</tr>
<tr>
<td align="center">British/French</td>
<td>
<pre>SELECT CONVERT(VARCHAR(10), GETDATE(), 103) AS [DD/MM/YYYY]</pre>
</td>
<td align="center">19/02/1972</td>
</tr>
<tr>
<td align="center">German</td>
<td>
<pre>SELECT CONVERT(VARCHAR(8), GETDATE(), 4) AS [DD.MM.YY]</pre>
</td>
<td align="center">25.12.05</td>
</tr>
<tr>
<td align="center">German</td>
<td>
<pre>SELECT CONVERT(VARCHAR(10), GETDATE(), 104) AS [DD.MM.YYYY]</pre>
</td>
<td align="center">25.12.2005</td>
</tr>
<tr>
<td align="center">Italian</td>
<td>
<pre>SELECT CONVERT(VARCHAR(8), GETDATE(), 5) AS [DD-MM-YY]</pre>
</td>
<td align="center">24-01-98</td>
</tr>
<tr>
<td align="center">Italian</td>
<td>
<pre>SELECT CONVERT(VARCHAR(10), GETDATE(), 105) AS [DD-MM-YYYY]</pre>
</td>
<td align="center">24-01-1998</td>
</tr>
<tr>
<td align="center">-</td>
<td>
<pre>SELECT CONVERT(VARCHAR(9), GETDATE(), 6) AS [DD MON YY]</pre>
</td>
<td align="center">04 Jul 06 1</td>
</tr>
<tr>
<td align="center">-</td>
<td>
<pre>SELECT CONVERT(VARCHAR(11), GETDATE(), 106) AS [DD MON YYYY]</pre>
</td>
<td align="center">04 Jul 2006 1</td>
</tr>
<tr>
<td align="center">-</td>
<td>
<pre>SELECT CONVERT(VARCHAR(10), GETDATE(), 7) AS [Mon DD, YY]</pre>
</td>
<td align="center">Jan 24, 98 1</td>
</tr>
<tr>
<td align="center">-</td>
<td>
<pre>SELECT CONVERT(VARCHAR(12), GETDATE(), 107) AS [Mon DD, YYYY]</pre>
</td>
<td align="center">Jan 24, 1998 1</td>
</tr>
<tr>
<td align="center">-</td>
<td>
<pre>SELECT CONVERT(VARCHAR(8), GETDATE(), 108)</pre>
</td>
<td align="center">03:24:53</td>
</tr>
<tr>
<td align="center">Default +</p>
<p>milliseconds</td>
<td>
<pre>SELECT CONVERT(VARCHAR(26), GETDATE(), 109)</pre>
</td>
<td align="center">Apr 28 2006 12:32:29:253PM 1</td>
</tr>
<tr>
<td align="center">USA</td>
<td>
<pre>SELECT CONVERT(VARCHAR(8), GETDATE(), 10) AS [MM-DD-YY]</pre>
</td>
<td align="center">01-01-06</td>
</tr>
<tr>
<td align="center">USA</td>
<td>
<pre>SELECT CONVERT(VARCHAR(10), GETDATE(), 110) AS [MM-DD-YYYY]</pre>
</td>
<td align="center">01-01-2006</td>
</tr>
<tr>
<td align="center">-</td>
<td>
<pre>SELECT CONVERT(VARCHAR(8), GETDATE(), 11) AS [YY/MM/DD]</pre>
</td>
<td align="center">98/11/23</td>
</tr>
<tr>
<td align="center">-</td>
<td>
<pre>SELECT CONVERT(VARCHAR(10), GETDATE(), 111) AS [YYYY/MM/DD]</pre>
</td>
<td align="center">1998/11/23</td>
</tr>
<tr>
<td align="center">ISO</td>
<td>
<pre>SELECT CONVERT(VARCHAR(6), GETDATE(), 12) AS [YYMMDD]</pre>
</td>
<td align="center">980124</td>
</tr>
<tr>
<td align="center">ISO</td>
<td>
<pre>SELECT CONVERT(VARCHAR(8), GETDATE(), 112) AS [YYYYMMDD]</pre>
</td>
<td align="center">19980124</td>
</tr>
<tr>
<td align="center">Europe default + milliseconds</td>
<td>
<pre>SELECT CONVERT(VARCHAR(24), GETDATE(), 113)</pre>
</td>
<td align="center">28 Apr 2006 00:34:55:190 1</td>
</tr>
<tr>
<td align="center">-</td>
<td>
<pre>SELECT CONVERT(VARCHAR(12), GETDATE(), 114) AS [HH:MI:SS:MMM(24H)]</pre>
</td>
<td align="center">11:34:23:013</td>
</tr>
<tr>
<td align="center">ODBC Canonical</td>
<td>
<pre>SELECT CONVERT(VARCHAR(19), GETDATE(), 120)</pre>
</td>
<td align="center">1972-01-01 13:42:24</td>
</tr>
<tr>
<td align="center">ODBC Canonical</p>
<p>(with milliseconds)</td>
<td>
<pre>SELECT CONVERT(VARCHAR(23), GETDATE(), 121)</pre>
</td>
<td align="center">1972-02-19 06:35:24.489</td>
</tr>
<tr>
<td align="center">ISO8601</td>
<td>
<pre>SELECT CONVERT(VARCHAR(23), GETDATE(), 126)</pre>
</td>
<td align="center">1998-11-23T11:25:43:250</td>
</tr>
<tr>
<td align="center">Kuwaiti</td>
<td>
<pre>SELECT CONVERT(VARCHAR(26), GETDATE(), 130)</pre>
</td>
<td align="center">28 Apr 2006 12:39:32:429AM 1</td>
</tr>
<tr>
<td align="center">Kuwaiti</td>
<td>
<pre>SELECT CONVERT(VARCHAR(25), GETDATE(), 131)</pre>
</td>
<td align="center">28/04/2006 12:39:32:429AM</td>
</tr>
</tbody>
</table>
  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/sqlhelp.wordpress.com/149/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/sqlhelp.wordpress.com/149/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/sqlhelp.wordpress.com/149/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/sqlhelp.wordpress.com/149/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/sqlhelp.wordpress.com/149/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/sqlhelp.wordpress.com/149/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/sqlhelp.wordpress.com/149/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/sqlhelp.wordpress.com/149/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/sqlhelp.wordpress.com/149/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/sqlhelp.wordpress.com/149/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=sqlhelp.wordpress.com&blog=5672629&post=149&subd=sqlhelp&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://sqlhelp.wordpress.com/2008/10/03/149/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/344460fcb9807a37c97174a2edc9d970?s=96&#38;d=identicon" medium="image">
			<media:title type="html">Raghunath Bhandari</media:title>
		</media:content>
	</item>
		<item>
		<title>SQL Statement OR Syntax</title>
		<link>http://sqlhelp.wordpress.com/2008/09/23/sql-statement-or-syntax/</link>
		<comments>http://sqlhelp.wordpress.com/2008/09/23/sql-statement-or-syntax/#comments</comments>
		<pubDate>Tue, 23 Sep 2008 06:22:34 +0000</pubDate>
		<dc:creator>Raghunath Bhandari</dc:creator>
				<category><![CDATA[SQL Statement OR Syntax]]></category>
		<category><![CDATA[Advance SQL tips and tricks]]></category>
		<category><![CDATA[Author Raghunath Bhandari]]></category>
		<category><![CDATA[Database]]></category>
		<category><![CDATA[Database Optimization Tips]]></category>
		<category><![CDATA[dba]]></category>
		<category><![CDATA[MCP]]></category>
		<category><![CDATA[Microsoft Certified Professional]]></category>
		<category><![CDATA[Microsoft SQL server]]></category>
		<category><![CDATA[MSDN Help]]></category>
		<category><![CDATA[MSDN SQL News]]></category>
		<category><![CDATA[MSSQL]]></category>
		<category><![CDATA[MSSQL Resources]]></category>
		<category><![CDATA[MSSQL server]]></category>
		<category><![CDATA[MSSQL Server help]]></category>
		<category><![CDATA[SQL]]></category>
		<category><![CDATA[SQL Best practices and tips]]></category>
		<category><![CDATA[SQL Coding Standards]]></category>
		<category><![CDATA[SQL Database Optimization Tricks]]></category>
		<category><![CDATA[SQL Database Settings Optimization Tips]]></category>
		<category><![CDATA[SQL Documentation]]></category>
		<category><![CDATA[SQL help]]></category>
		<category><![CDATA[SQL Optimization]]></category>
		<category><![CDATA[SQL Optimization Tips]]></category>
		<category><![CDATA[SQL Query]]></category>
		<category><![CDATA[SQL Server]]></category>
		<category><![CDATA[SQL server tips]]></category>
		<category><![CDATA[SQL Statement]]></category>
		<category><![CDATA[SQL technology]]></category>
		<category><![CDATA[SQL Tips]]></category>
		<category><![CDATA[SQL Tips and Tricks]]></category>
		<category><![CDATA[SQL tips for programmer]]></category>
		<category><![CDATA[sqlhelp]]></category>
		<category><![CDATA[sqlhelp news]]></category>
		<category><![CDATA[sqlhelp WebSite Review]]></category>
		<category><![CDATA[T-SQL]]></category>
		<category><![CDATA[Technology News]]></category>

		<guid isPermaLink="false">http://sqlhelp.wordpress.com/?p=9</guid>
		<description><![CDATA[SQL Quick Reference:




SQL Statement
Syntax


AND / OR
SELECT column_name(s)
FROM table_name
WHERE condition
AND&#124;OR condition


ALTER TABLE
ALTER TABLE table_name
ADD column_name datatypeor
ALTER TABLE table_name
DROP COLUMN column_name


AS (alias)
SELECT column_name AS column_alias
FROM table_nameor
SELECT column_name
FROM table_name  AS table_alias


BETWEEN
SELECT column_name(s)
FROM table_name
WHERE column_name
BETWEEN value1 AND value2


CREATE DATABASE
CREATE DATABASE database_name


CREATE TABLE
CREATE TABLE table_name
(
column_name1 data_type,
column_name2 data_type,
column_name2 data_type,
&#8230;
)


CREATE INDEX
CREATE INDEX index_name
ON table_name (column_name)or
CREATE UNIQUE INDEX index_name
ON table_name (column_name)


CREATE VIEW
CREATE VIEW [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=sqlhelp.wordpress.com&blog=5672629&post=9&subd=sqlhelp&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p><strong>SQL Quick Reference:</strong></p>
<p><strong></strong></p>
<table class="ex" border="1" cellspacing="0" width="100%">
<tbody>
<tr>
<th width="27%" align="left" valign="top">SQL Statement</th>
<th width="73%" align="left" valign="top">Syntax</th>
</tr>
<tr>
<td align="left" valign="top">AND / OR</td>
<td align="left" valign="top">SELECT column_name(s)<br />
FROM table_name<br />
WHERE condition<br />
AND|OR condition</td>
</tr>
<tr>
<td align="left" valign="top">ALTER TABLE</td>
<td align="left" valign="top">ALTER TABLE table_name<br />
ADD column_name datatypeor</p>
<p>ALTER TABLE table_name<br />
DROP COLUMN column_name</td>
</tr>
<tr>
<td align="left" valign="top">AS (alias)</td>
<td align="left" valign="top">SELECT column_name AS column_alias<br />
FROM table_nameor</p>
<p>SELECT column_name<br />
FROM table_name  AS table_alias</td>
</tr>
<tr>
<td align="left" valign="top">BETWEEN</td>
<td align="left" valign="top">SELECT column_name(s)<br />
FROM table_name<br />
WHERE column_name<br />
BETWEEN value1 AND value2</td>
</tr>
<tr>
<td align="left" valign="top">CREATE DATABASE</td>
<td align="left" valign="top">CREATE DATABASE database_name</td>
</tr>
<tr>
<td align="left" valign="top">CREATE TABLE</td>
<td align="left" valign="top">CREATE TABLE table_name<br />
(<br />
column_name1 data_type,<br />
column_name2 data_type,<br />
column_name2 data_type,<br />
&#8230;<br />
)</td>
</tr>
<tr>
<td align="left" valign="top">CREATE INDEX</td>
<td align="left" valign="top">CREATE INDEX index_name<br />
ON table_name (column_name)or</p>
<p>CREATE UNIQUE INDEX index_name<br />
ON table_name (column_name)</td>
</tr>
<tr>
<td align="left" valign="top">CREATE VIEW</td>
<td align="left" valign="top">CREATE VIEW view_name AS<br />
SELECT column_name(s)<br />
FROM table_name<br />
WHERE condition</td>
</tr>
<tr>
<td align="left" valign="top">DELETE</td>
<td align="left" valign="top">DELETE FROM table_name<br />
WHERE some_column=some_valueor</p>
<p>DELETE FROM table_name<br />
(<strong>Note: </strong>Deletes the entire table!!)</p>
<p>DELETE * FROM table_name<br />
(<strong>Note: </strong>Deletes the entire table!!)</td>
</tr>
<tr>
<td align="left" valign="top">DROP DATABASE</td>
<td align="left" valign="top">DROP DATABASE database_name</td>
</tr>
<tr>
<td align="left" valign="top">DROP INDEX</td>
<td align="left" valign="top">DROP INDEX table_name.index_name (SQL  		Server)<br />
DROP INDEX index_name ON table_name (MS Access)<br />
DROP INDEX index_name (DB2/Oracle)<br />
ALTER TABLE table_name<br />
DROP INDEX index_name (MySQL)</td>
</tr>
<tr>
<td align="left" valign="top">DROP TABLE</td>
<td align="left" valign="top">DROP TABLE table_name</td>
</tr>
<tr>
<td align="left" valign="top">GROUP BY</td>
<td align="left" valign="top">SELECT column_name,  		aggregate_function(column_name)<br />
FROM table_name<br />
WHERE column_name operator value<br />
GROUP BY column_name</td>
</tr>
<tr>
<td align="left" valign="top">HAVING</td>
<td align="left" valign="top">SELECT column_name,  		aggregate_function(column_name)<br />
FROM table_name<br />
WHERE column_name operator value<br />
GROUP BY column_name<br />
HAVING aggregate_function(column_name) operator value</td>
</tr>
<tr>
<td align="left" valign="top">IN</td>
<td align="left" valign="top">SELECT column_name(s)<br />
FROM table_name<br />
WHERE column_name<br />
IN (value1,value2,..)</td>
</tr>
<tr>
<td align="left" valign="top">INSERT INTO</td>
<td align="left" valign="top">INSERT INTO table_name<br />
VALUES (value1, value2, value3,&#8230;.)<em>or</em></p>
<p>INSERT INTO table_name<br />
(column1, column2, column3,&#8230;)<br />
VALUES (value1, value2, value3,&#8230;.)</td>
</tr>
<tr>
<td align="left" valign="top">INNER JOIN</td>
<td align="left" valign="top">SELECT column_name(s)<br />
FROM table_name1<br />
INNER JOIN table_name2<br />
ON table_name1.column_name=table_name2.column_name</td>
</tr>
<tr>
<td align="left" valign="top">LEFT JOIN</td>
<td align="left" valign="top">SELECT column_name(s)<br />
FROM table_name1<br />
LEFT JOIN table_name2<br />
ON table_name1.column_name=table_name2.column_name</td>
</tr>
<tr>
<td align="left" valign="top">RIGHT JOIN</td>
<td align="left" valign="top">SELECT column_name(s)<br />
FROM table_name1<br />
RIGHT JOIN table_name2<br />
ON table_name1.column_name=table_name2.column_name</td>
</tr>
<tr>
<td align="left" valign="top">FULL JOIN</td>
<td align="left" valign="top">SELECT column_name(s)<br />
FROM table_name1<br />
FULL JOIN table_name2<br />
ON table_name1.column_name=table_name2.column_name</td>
</tr>
<tr>
<td align="left" valign="top">LIKE</td>
<td align="left" valign="top">SELECT column_name(s)<br />
FROM table_name<br />
WHERE column_name 		LIKE pattern</td>
</tr>
<tr>
<td align="left" valign="top">ORDER BY</td>
<td align="left" valign="top">SELECT column_name(s)<br />
FROM table_name<br />
ORDER BY column_name [ASC|DESC]</td>
</tr>
<tr>
<td align="left" valign="top">SELECT</td>
<td align="left" valign="top">SELECT column_name(s)<br />
FROM table_name</td>
</tr>
<tr>
<td align="left" valign="top">SELECT *</td>
<td align="left" valign="top">SELECT *<br />
FROM table_name</td>
</tr>
<tr>
<td align="left" valign="top">SELECT DISTINCT</td>
<td align="left" valign="top">SELECT DISTINCT column_name(s)<br />
FROM table_name</td>
</tr>
<tr>
<td align="left" valign="top">SELECT INTO</td>
<td align="left" valign="top">SELECT *<br />
INTO new_table_name [IN externaldatabase]<br />
FROM old_table_name<em>or</em></p>
<p>SELECT column_name(s)<br />
INTO new_table_name [IN externaldatabase]<br />
FROM old_table_name</td>
</tr>
<tr>
<td align="left" valign="top">SELECT TOP</td>
<td align="left" valign="top">SELECT TOP number|percent column_name(s)<br />
FROM table_name</td>
</tr>
<tr>
<td align="left" valign="top">TRUNCATE TABLE</td>
<td align="left" valign="top">TRUNCATE TABLE table_name</td>
</tr>
<tr>
<td align="left" valign="top">UNION</td>
<td align="left" valign="top">SELECT column_name(s) FROM table_name1<br />
UNION<br />
SELECT column_name(s) FROM table_name2</td>
</tr>
<tr>
<td align="left" valign="top">UNION ALL</td>
<td align="left" valign="top">SELECT column_name(s) FROM table_name1<br />
UNION ALL<br />
SELECT column_name(s) FROM table_name2</td>
</tr>
<tr>
<td align="left" valign="top">UPDATE</td>
<td align="left" valign="top">UPDATE table_name<br />
SET column1=value, column2=value,&#8230;<br />
WHERE some_column=some_value</td>
</tr>
<tr>
<td align="left" valign="top">WHERE</td>
<td align="left" valign="top">SELECT column_name(s)<br />
FROM table_name<br />
WHERE column_name operator value</td>
</tr>
</tbody>
</table>
  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/sqlhelp.wordpress.com/9/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/sqlhelp.wordpress.com/9/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/sqlhelp.wordpress.com/9/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/sqlhelp.wordpress.com/9/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/sqlhelp.wordpress.com/9/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/sqlhelp.wordpress.com/9/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/sqlhelp.wordpress.com/9/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/sqlhelp.wordpress.com/9/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/sqlhelp.wordpress.com/9/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/sqlhelp.wordpress.com/9/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=sqlhelp.wordpress.com&blog=5672629&post=9&subd=sqlhelp&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://sqlhelp.wordpress.com/2008/09/23/sql-statement-or-syntax/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/344460fcb9807a37c97174a2edc9d970?s=96&#38;d=identicon" medium="image">
			<media:title type="html">Raghunath Bhandari</media:title>
		</media:content>
	</item>
		<item>
		<title>SQL Server 2005 Failover Clustering White Paper</title>
		<link>http://sqlhelp.wordpress.com/2008/09/01/sql-server-2005-failover-clustering-white-paper/</link>
		<comments>http://sqlhelp.wordpress.com/2008/09/01/sql-server-2005-failover-clustering-white-paper/#comments</comments>
		<pubDate>Mon, 01 Sep 2008 09:45:38 +0000</pubDate>
		<dc:creator>Raghunath Bhandari</dc:creator>
				<category><![CDATA[Clustering SQL Server]]></category>
		<category><![CDATA[Advance SQL tips and tricks]]></category>
		<category><![CDATA[Author Raghunath Bhandari]]></category>
		<category><![CDATA[Database]]></category>
		<category><![CDATA[Database Optimization Tips]]></category>
		<category><![CDATA[dba]]></category>
		<category><![CDATA[MCP]]></category>
		<category><![CDATA[Microsoft Certified Professional]]></category>
		<category><![CDATA[MSDN Help]]></category>
		<category><![CDATA[MSDN SQL News]]></category>
		<category><![CDATA[MSSQL Resources]]></category>
		<category><![CDATA[MSSQL Server help]]></category>
		<category><![CDATA[SQL]]></category>
		<category><![CDATA[SQL Best practices and tips]]></category>
		<category><![CDATA[SQL Coding Standards]]></category>
		<category><![CDATA[SQL Database Optimization Tricks]]></category>
		<category><![CDATA[SQL Database Settings Optimization Tips]]></category>
		<category><![CDATA[SQL Documentation]]></category>
		<category><![CDATA[SQL help]]></category>
		<category><![CDATA[SQL Optimization]]></category>
		<category><![CDATA[SQL Optimization Tips]]></category>
		<category><![CDATA[SQL Query]]></category>
		<category><![CDATA[SQL Server]]></category>
		<category><![CDATA[SQL Server 2005 Failover Clustering]]></category>
		<category><![CDATA[SQL server tips]]></category>
		<category><![CDATA[SQL technology]]></category>
		<category><![CDATA[SQL Tips]]></category>
		<category><![CDATA[SQL Tips and Tricks]]></category>
		<category><![CDATA[SQL tips for programmer]]></category>
		<category><![CDATA[sqlhelp]]></category>
		<category><![CDATA[sqlhelp news]]></category>
		<category><![CDATA[sqlhelp WebSite Review]]></category>
		<category><![CDATA[T-SQL]]></category>
		<category><![CDATA[Technology News]]></category>

		<guid isPermaLink="false">http://sqlhelp.wordpress.com/?p=111</guid>
		<description><![CDATA[SQL Server 2005 Failover Clustering White Paper
Brief Description:
Comprehensive document about implementing failover clustering for SQL Server 2005 and Analysis Services.
Overview:
This white paper is intended for a technical audience and not technical decision makers. It complements the existing documentation around planning, implementing, and administering of a failover cluster that can be found in Microsoft SQL Server [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=sqlhelp.wordpress.com&blog=5672629&post=111&subd=sqlhelp&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p>SQL Server 2005 Failover Clustering White Paper</p>
<p><strong>Brief Description</strong>:<br />
Comprehensive document about implementing failover clustering for SQL Server 2005 and Analysis Services.</p>
<blockquote><p><strong>Overview</strong>:<br />
This white paper is intended for a technical audience and not technical decision makers. It complements the existing documentation around planning, implementing, and administering of a failover cluster that can be found in Microsoft SQL Server 2005 Books Online. To ease the upgrade process for existing users of failover clustering, this white paper also points out differences in the failover clustering implementation of SQL Server 2005 compared to SQL Server 2000.</p></blockquote>
<p><strong>System Requirements:</strong></p>
<ul>
<li> Supported Operating Systems: Windows Server 2003 Service Pack 1; Windows XP Service Pack 2</li>
<li>Microsoft Word</li>
</ul>
<p><strong>Instructions</strong>:<br />
Click the Download button on this page. You can then choose to open the file immediately or save it to your hard disk.</p>
<p><a href="http://www.microsoft.com/downloads/thankyou.aspx?familyId=818234dc-a17b-4f09-b282-c6830fead499&amp;displayLang=en"> click here to download from microsoft site</a></p>
<img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/sqlhelp.wordpress.com/111/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/sqlhelp.wordpress.com/111/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/sqlhelp.wordpress.com/111/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/sqlhelp.wordpress.com/111/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/sqlhelp.wordpress.com/111/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/sqlhelp.wordpress.com/111/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/sqlhelp.wordpress.com/111/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/sqlhelp.wordpress.com/111/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/sqlhelp.wordpress.com/111/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/sqlhelp.wordpress.com/111/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/sqlhelp.wordpress.com/111/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/sqlhelp.wordpress.com/111/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=sqlhelp.wordpress.com&blog=5672629&post=111&subd=sqlhelp&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://sqlhelp.wordpress.com/2008/09/01/sql-server-2005-failover-clustering-white-paper/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/344460fcb9807a37c97174a2edc9d970?s=96&#38;d=identicon" medium="image">
			<media:title type="html">Raghunath Bhandari</media:title>
		</media:content>
	</item>
		<item>
		<title>Roles of DBA</title>
		<link>http://sqlhelp.wordpress.com/2008/03/20/roles-of-dba/</link>
		<comments>http://sqlhelp.wordpress.com/2008/03/20/roles-of-dba/#comments</comments>
		<pubDate>Thu, 20 Mar 2008 06:37:32 +0000</pubDate>
		<dc:creator>Raghunath Bhandari</dc:creator>
				<category><![CDATA[Roles of DBA]]></category>
		<category><![CDATA[Advance SQL tips and tricks]]></category>
		<category><![CDATA[Author Raghunath Bhandari]]></category>
		<category><![CDATA[Database]]></category>
		<category><![CDATA[Database Optimization Tips]]></category>
		<category><![CDATA[dba]]></category>
		<category><![CDATA[interview question for DBA]]></category>
		<category><![CDATA[Jobs of DBA]]></category>
		<category><![CDATA[MCP]]></category>
		<category><![CDATA[Microsoft Certified Professional]]></category>
		<category><![CDATA[MSDN Help]]></category>
		<category><![CDATA[MSDN SQL News]]></category>
		<category><![CDATA[MSSQL Resources]]></category>
		<category><![CDATA[MSSQL Server help]]></category>
		<category><![CDATA[SQL]]></category>
		<category><![CDATA[SQL Best practices and tips]]></category>
		<category><![CDATA[SQL Coding Standards]]></category>
		<category><![CDATA[SQL Database Optimization Tricks]]></category>
		<category><![CDATA[SQL Database Settings Optimization Tips]]></category>
		<category><![CDATA[SQL Documentation]]></category>
		<category><![CDATA[SQL help]]></category>
		<category><![CDATA[SQL Optimization]]></category>
		<category><![CDATA[SQL Optimization Tips]]></category>
		<category><![CDATA[SQL Query]]></category>
		<category><![CDATA[SQL Server]]></category>
		<category><![CDATA[SQL server tips]]></category>
		<category><![CDATA[SQL technology]]></category>
		<category><![CDATA[SQL Tips]]></category>
		<category><![CDATA[SQL Tips and Tricks]]></category>
		<category><![CDATA[SQL tips for programmer]]></category>
		<category><![CDATA[sqlhelp]]></category>
		<category><![CDATA[sqlhelp news]]></category>
		<category><![CDATA[sqlhelp WebSite Review]]></category>
		<category><![CDATA[T-SQL]]></category>
		<category><![CDATA[Technology News]]></category>

		<guid isPermaLink="false">http://sqlhelp.wordpress.com/?p=55</guid>
		<description><![CDATA[A database administrator (DBA) is a person who is responsible for the environmental aspects of a database. In general, these include basic:

Recoverability &#8211; Creating and testing Backups
Integrity &#8211; Verifying or helping to verify data integrity
Security &#8211; Defining and/or implementing access controls to the data
Availability &#8211; Ensuring maximum uptime
Performance &#8211; Ensuring maximum performance
Development and testing support [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=sqlhelp.wordpress.com&blog=5672629&post=55&subd=sqlhelp&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p><strong>A database administrator (DBA) is a person who is responsible for the environmental aspects of a database. In general, these include basic:</strong></p>
<ul>
<li>Recoverability &#8211; Creating and testing Backups</li>
<li>Integrity &#8211; Verifying or helping to verify data integrity</li>
<li>Security &#8211; Defining and/or implementing access controls to the data</li>
<li>Availability &#8211; Ensuring maximum uptime</li>
<li>Performance &#8211; Ensuring maximum performance</li>
<li>Development and testing support &#8211; Helping programmers and engineers to efficiently utilize the database.</li>
</ul>
<blockquote><p>The role of a database administrator has changed according to the technology of database management systems (DBMSs) as well as the needs of the owners of the databases. For example, although logical and physical database design are traditionally the duties of a database analyst or database designer, a DBA may be tasked to perform those duties.</p></blockquote>
<p><strong><br />
The Database Administrator is responsible for designing, developing and implementing programs, as required, to support the technical capabilities.</strong></p>
<ul>
<li>Develop new or maintain existing databases based on specifications</li>
<li>Develop, implement and maintain unit tests of database programs (i.e, SQL, etc)</li>
<li>Share knowledge by effectively documenting work</li>
<li>Respond quickly and effectively to production &amp; development issues and taking responsibility for seeing those issues through resolution.</li>
<li>Resolve database performance issues, database capacity issues, replication, and other distributed data issues.</li>
<li>Design &amp; implement data models and database designs into physical databases.</li>
<li>Install and maintain database software.</li>
<li>Manage backup and recovery of databases.</li>
<li>Manage security of database structures and corporate data held within databases.</li>
<li>Develop database procedures, triggers and SQL scripts for development teams.</li>
<li>Maintain database changes from Development, QA to Production.</li>
<li>Assist in the definition and implementation of database standards.</li>
<li>Monitor databases for errors and perform problem determination when necessary.</li>
<li>Design and implement highly available production systems.</li>
</ul>
<p><strong>Qualifications</strong>:</p>
<ul>
<li> Bachelor degree in technical discipline; or equivalent professional experience</li>
<li> Experience writing complex SQL, triggers, and procedures</li>
<li> Ability to work with minimal direction, yet also able to work in team environment.</li>
<li> Relational database analysis and modeling experience.</li>
<li> Experience configuring database network connectivity.</li>
<li> Understanding of database backup and recovery techniques.</li>
<li> Experience in fast paced production or operational system arena</li>
<li> Clear and effective written and verbal communication skills</li>
<li> Hands on and ownership personality..</li>
</ul>
<img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/sqlhelp.wordpress.com/55/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/sqlhelp.wordpress.com/55/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/sqlhelp.wordpress.com/55/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/sqlhelp.wordpress.com/55/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/sqlhelp.wordpress.com/55/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/sqlhelp.wordpress.com/55/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/sqlhelp.wordpress.com/55/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/sqlhelp.wordpress.com/55/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/sqlhelp.wordpress.com/55/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/sqlhelp.wordpress.com/55/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/sqlhelp.wordpress.com/55/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/sqlhelp.wordpress.com/55/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=sqlhelp.wordpress.com&blog=5672629&post=55&subd=sqlhelp&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://sqlhelp.wordpress.com/2008/03/20/roles-of-dba/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/344460fcb9807a37c97174a2edc9d970?s=96&#38;d=identicon" medium="image">
			<media:title type="html">Raghunath Bhandari</media:title>
		</media:content>
	</item>
		<item>
		<title>Easy step to install SQL Server 2000</title>
		<link>http://sqlhelp.wordpress.com/2008/01/20/easy-step-to-install-sql-server-2000/</link>
		<comments>http://sqlhelp.wordpress.com/2008/01/20/easy-step-to-install-sql-server-2000/#comments</comments>
		<pubDate>Sun, 20 Jan 2008 06:39:00 +0000</pubDate>
		<dc:creator>Raghunath Bhandari</dc:creator>
				<category><![CDATA[Installing SQL 2000]]></category>
		<category><![CDATA[Advance SQL tips and tricks]]></category>
		<category><![CDATA[Author Raghunath Bhandari]]></category>
		<category><![CDATA[Database]]></category>
		<category><![CDATA[Database Optimization Tips]]></category>
		<category><![CDATA[dba]]></category>
		<category><![CDATA[MCP]]></category>
		<category><![CDATA[Microsoft Certified Professional]]></category>
		<category><![CDATA[MSDN Help]]></category>
		<category><![CDATA[MSDN SQL News]]></category>
		<category><![CDATA[MSSQL Resources]]></category>
		<category><![CDATA[MSSQL Server help]]></category>
		<category><![CDATA[SQL]]></category>
		<category><![CDATA[SQL Best practices and tips]]></category>
		<category><![CDATA[SQL Coding Standards]]></category>
		<category><![CDATA[SQL Database Optimization Tricks]]></category>
		<category><![CDATA[SQL Database Settings Optimization Tips]]></category>
		<category><![CDATA[SQL Documentation]]></category>
		<category><![CDATA[SQL help]]></category>
		<category><![CDATA[SQL Optimization]]></category>
		<category><![CDATA[SQL Optimization Tips]]></category>
		<category><![CDATA[SQL Query]]></category>
		<category><![CDATA[SQL Server]]></category>
		<category><![CDATA[SQL server tips]]></category>
		<category><![CDATA[SQL technology]]></category>
		<category><![CDATA[SQL Tips]]></category>
		<category><![CDATA[SQL Tips and Tricks]]></category>
		<category><![CDATA[SQL tips for programmer]]></category>
		<category><![CDATA[sqlhelp]]></category>
		<category><![CDATA[sqlhelp news]]></category>
		<category><![CDATA[sqlhelp WebSite Review]]></category>
		<category><![CDATA[step to install SQL Server 2000]]></category>
		<category><![CDATA[T-SQL]]></category>
		<category><![CDATA[Technology News]]></category>

		<guid isPermaLink="false">http://sqlhelp.wordpress.com/?p=14</guid>
		<description><![CDATA[Installing SQL Server 2000
loadTOCNode(2, &#8217;summary&#8217;);
To Install SQL Server 2000 Basic Local Installation
loadTOCNode(3, &#8217;summary&#8217;);

Insert the Microsoft SQL Server 2000 compact disc in your 				CD-ROM drive (if the compact disc does not run automatically, double-click 				Autorun.exe in the root directory of the compact disc), select SQL Server 2000 Components, and then select Install Database Server. Setup prepares [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=sqlhelp.wordpress.com&blog=5672629&post=14&subd=sqlhelp&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><h3>Installing SQL Server 2000</h3>
<p>loadTOCNode(2, &#8217;summary&#8217;);</p>
<h4>To Install SQL Server 2000 Basic Local Installation</h4>
<p>loadTOCNode(3, &#8217;summary&#8217;);</p>
<ol>
<li>Insert the Microsoft SQL Server 2000 compact disc in your 				CD-ROM drive (if the compact disc does not run automatically, double-click 				Autorun.exe in the root directory of the compact disc), select <strong>SQL Server 2000 Components</strong>, and then select <strong>Install Database Server</strong>. Setup prepares the SQL Server Installation Wizard. At the <strong>Welcome</strong> page, click <strong>Next</strong>.</li>
<li>In the <strong>Computer Name</strong> dialog box, <strong>Local Computer</strong> is the default option, and the local computer name appears in the 				text box. Click <strong>Next</strong>.</li>
<li>In the <strong>Installation Selection</strong> dialog box, click <strong class="uiterm">Create a new instance of SQL Server, or 				install Client Tools</strong>, and then click <strong>Next</strong>. Follow directions on the <strong class="uiterm">User Information, Software 				License Agreement</strong> and related pages. In the <strong>Installation Definition</strong> dialog box, click <strong class="uiterm">Server and Client Tools</strong>, and 				then click <strong>Next</strong>.</li>
<li>In the <strong>Instance Name</strong> dialog box, if the <strong>Default</strong> check box is available, you can install either the default or a 				named instance. If the <strong>Default</strong> check box is not available, a default instance has already been 				installed, and you can install only a named instance.
<ul>
<li>To install the default instance, click to select the <strong>Default</strong> check box, and then click <strong>Next</strong>.</li>
<li>To install a named instance, click to clear the <strong>Default</strong> check box, type a new named instance in the <strong>Instance Name</strong> box, and then click <strong>Next</strong>.</li>
</ul>
</li>
<li> In the <strong>Setup Type</strong> dialog box, click <strong>Typical</strong> or <strong>Minimum</strong>, and then click <strong>Next</strong>.</li>
<li>In the <strong>Service Accounts</strong> dialog box, accept the default settings, type your domain 				password, and then click <strong>Next</strong>. In the <strong>Authentication Mode</strong> dialog box, accept the default setting, and then click <strong>Next</strong>. When you finish specifying options, click <strong>Next</strong> in the <strong>Start Copying Files</strong> dialog box.</li>
<li>In the <strong>Choose Licensing Mode</strong> dialog box, make selections according to your license agreement, 				and then click <strong>Continue</strong> to begin the installation. In the <strong>Setup Complete</strong> dialog box, click <strong class="uiterm">Yes, I want to restart my computer 				now</strong>, and then click <strong>Finish</strong>.</li>
</ol>
<h4>To Install Client Tools Only for SQL Server 2000</h4>
<p>loadTOCNode(3, &#8217;summary&#8217;);</p>
<ol>
<li>Insert the Microsoft SQL Server 2000 compact disc in your 				CD-ROM drive (if the compact disc does not run automatically, double-click 				Autorun.exe in the root directory of the compact disc), select <strong>SQL Server 2000 Components</strong>, select Install Database Server, and then click <strong>Next</strong> at the Welcome page of the <strong>SQL Server Installation Wizard</strong>.</li>
<li>In <strong>Computer Name </strong>dialog box, <strong>Local Computer</strong> is the default option, and the local computer name appears in the 				edit box. Click <strong>Next</strong>.</li>
<li>In the <strong>Installation Selection</strong> dialog box, click <strong>Create a new instance of SQL Server, or install Client Tools</strong>, and then click <strong>Next</strong>.</li>
<li>Follow the directions on the <strong>User Information, Software License Agreement</strong>, and related pages.</li>
<li>In the <strong>Installation Definition</strong> dialog box, click <strong>Client tools</strong> only, and then click <strong>Next</strong>.</li>
<li>In the <strong>Select Components</strong> dialog box, accept the defaults or select the components you 				want, and then click <strong>Next</strong>. You can select an item in the <strong>Components</strong> list, such as <strong>Management Tools</strong>, and then select items from the related <strong>Sub-Components</strong> list, such as <strong>Enterprise Manager</strong>. Click to select items that you want to install, and click to 				clear the check box for the items you do not want to install. For information 				about each component, select the item, and view the <strong>Description</strong> box.</li>
<li>In the <strong>Start Copying Files</strong> dialog box, click <strong>Next</strong> to complete the installation of the client tools.</li>
</ol>
<h4>To Install Connectivity Only for SQL Server 2000</h4>
<p>loadTOCNode(3, &#8217;summary&#8217;);</p>
<ol>
<li>Insert the Microsoft SQL Server 2000 compact disc into your 				CD-ROM drive (if the compact disc does not run automatically, double-click 				Autorun.exe in the root directory of the compact disc), and then select <strong>SQL Server 2000 Components</strong>.</li>
<li>Select <strong>Install Database Server</strong>. Setup prepares the <strong>SQL Server Installation Wizard</strong>. At the <strong>Welcome</strong> page, click <strong>Next</strong>.</li>
<li>In the <strong>Computer Name</strong> dialog box, <strong>Local Computer</strong> is the default option, and the local computer name appears in the 				text box. Click <strong>Next</strong>.</li>
<li>In the <strong>Installation Selection</strong> dialog box, click <strong class="uiterm">Create a new instance of SQL Server, or 				install Client Tools</strong>, and then click <strong>Next</strong>.</li>
<li>Follow the directions on the <strong>User Information, Software License Agreement</strong> and related pages.</li>
<li>In the <strong>Installation Definition</strong> dialog box, click <strong>Connectivity Only</strong>, and then click <strong>Next</strong>.</li>
<li>In the <strong>Start Copying Files</strong> dialog box, click <strong>Next</strong> to complete the installation.Microsoft SQL Server Books Online:&#8221;Basic 		  Installation Options&#8221;For additional 			 information, click the article number below to view the article in the 			 Microsoft Knowledge Base:
<div class="indent"><a class="KBlink" href="http://support.microsoft.com/kb/257716/EN-US/">257716</a> <span class="pLink"> (http://support.microsoft.com/kb/257716/EN-US/             ) </span> Frequently Asked Questions &#8211; SQL Server 2000 &#8211; Setup</div>
</li>
</ol>
<img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/sqlhelp.wordpress.com/14/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/sqlhelp.wordpress.com/14/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/sqlhelp.wordpress.com/14/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/sqlhelp.wordpress.com/14/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/sqlhelp.wordpress.com/14/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/sqlhelp.wordpress.com/14/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/sqlhelp.wordpress.com/14/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/sqlhelp.wordpress.com/14/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/sqlhelp.wordpress.com/14/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/sqlhelp.wordpress.com/14/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/sqlhelp.wordpress.com/14/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/sqlhelp.wordpress.com/14/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=sqlhelp.wordpress.com&blog=5672629&post=14&subd=sqlhelp&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://sqlhelp.wordpress.com/2008/01/20/easy-step-to-install-sql-server-2000/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/344460fcb9807a37c97174a2edc9d970?s=96&#38;d=identicon" medium="image">
			<media:title type="html">Raghunath Bhandari</media:title>
		</media:content>
	</item>
		<item>
		<title>SQL functions</title>
		<link>http://sqlhelp.wordpress.com/2008/01/07/sql-functions/</link>
		<comments>http://sqlhelp.wordpress.com/2008/01/07/sql-functions/#comments</comments>
		<pubDate>Mon, 07 Jan 2008 06:03:27 +0000</pubDate>
		<dc:creator>Raghunath Bhandari</dc:creator>
				<category><![CDATA[SQL Functions]]></category>
		<category><![CDATA[Microsoft SQL server]]></category>
		<category><![CDATA[MSSQL]]></category>
		<category><![CDATA[MSSQL server]]></category>
		<category><![CDATA[SQL Server]]></category>

		<guid isPermaLink="false">http://sqlhelp.wordpress.com/?p=7</guid>
		<description><![CDATA[SQL has many built-in functions for performing calculations on data.
SQL Aggregate Functions
SQL aggregate functions return a single value, calculated from values in a column.
Useful aggregate functions:

 AVG() &#8211; Returns the average value
 COUNT() &#8211; Returns the number of rows
 FIRST() &#8211; Returns the first value
 LAST() &#8211; Returns the last value
 MAX() &#8211; Returns the [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=sqlhelp.wordpress.com&blog=5672629&post=7&subd=sqlhelp&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p><strong>SQL has many built-in functions for performing calculations on data.<br />
SQL Aggregate Functions</strong></p>
<p>SQL aggregate functions return a single value, calculated from values in a column.</p>
<p><strong>Useful aggregate functions:</strong></p>
<ul>
<li> AVG() &#8211; Returns the average value</li>
<li> COUNT() &#8211; Returns the number of rows</li>
<li> FIRST() &#8211; Returns the first value</li>
<li> LAST() &#8211; Returns the last value</li>
<li> MAX() &#8211; Returns the largest value</li>
<li> MIN() &#8211; Returns the smallest value</li>
<li> SUM() &#8211; Returns the sum</li>
</ul>
<p>SQL Scalar functions:<br />
SQL scalar functions return a single value, based on the input value.</p>
<p><strong>Useful scalar functions:</strong></p>
<ul>
<li> UCASE() &#8211; Converts a field to upper case</li>
<li> LCASE() &#8211; Converts a field to lower case</li>
<li> MID() &#8211; Extract characters from a text field</li>
<li> LEN() &#8211; Returns the length of a text field</li>
<li> ROUND() &#8211; Rounds a numeric field to the number of decimals specified</li>
<li> NOW() &#8211; Returns the current system date and time</li>
<li> FORMAT() &#8211; Formats how a field is to be displayed</li>
</ul>
<p><strong>Tip: The aggregate functions and the scalar functions will be explained in details in the next chapters.</strong></p>
<img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/sqlhelp.wordpress.com/7/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/sqlhelp.wordpress.com/7/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/sqlhelp.wordpress.com/7/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/sqlhelp.wordpress.com/7/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/sqlhelp.wordpress.com/7/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/sqlhelp.wordpress.com/7/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/sqlhelp.wordpress.com/7/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/sqlhelp.wordpress.com/7/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/sqlhelp.wordpress.com/7/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/sqlhelp.wordpress.com/7/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/sqlhelp.wordpress.com/7/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/sqlhelp.wordpress.com/7/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=sqlhelp.wordpress.com&blog=5672629&post=7&subd=sqlhelp&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://sqlhelp.wordpress.com/2008/01/07/sql-functions/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/344460fcb9807a37c97174a2edc9d970?s=96&#38;d=identicon" medium="image">
			<media:title type="html">Raghunath Bhandari</media:title>
		</media:content>
	</item>
	</channel>
</rss>