<?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>Rajashri's Weblog</title>
	<atom:link href="http://rajashri.wordpress.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://rajashri.wordpress.com</link>
	<description>Just another WordPress.com weblog</description>
	<lastBuildDate>Thu, 25 Oct 2007 10:31:40 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.com/</generator>
<cloud domain='rajashri.wordpress.com' port='80' path='/?rsscloud=notify' registerProcedure='' protocol='http-post' />
<image>
		<url>http://s2.wp.com/i/buttonw-com.png</url>
		<title>Rajashri's Weblog</title>
		<link>http://rajashri.wordpress.com</link>
	</image>
	<atom:link rel="search" type="application/opensearchdescription+xml" href="http://rajashri.wordpress.com/osd.xml" title="Rajashri&#039;s Weblog" />
	<atom:link rel='hub' href='http://rajashri.wordpress.com/?pushpress=hub'/>
		<item>
		<title>What Is .NET?</title>
		<link>http://rajashri.wordpress.com/2007/10/25/what-is-net/</link>
		<comments>http://rajashri.wordpress.com/2007/10/25/what-is-net/#comments</comments>
		<pubDate>Thu, 25 Oct 2007 10:31:40 +0000</pubDate>
		<dc:creator>rajashri</dc:creator>
				<category><![CDATA[Asp.net 2.0]]></category>

		<guid isPermaLink="false">http://rajashri.wordpress.com/2007/10/25/what-is-net/</guid>
		<description><![CDATA[.NET is the Microsoft Web services strategy to connect information, people, systems, and devices through software. Integrated across the Microsoft platform, .NET technology provides the ability to quickly build, deploy, manage, and use connected, security-enhanced solutions with Web services. .NET-connected &#8230; <a href="http://rajashri.wordpress.com/2007/10/25/what-is-net/">Continue reading <span class="meta-nav">&#8594;</span></a><img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=rajashri.wordpress.com&amp;blog=1986833&amp;post=7&amp;subd=rajashri&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>.NET is the Microsoft Web services strategy to connect information, people, systems, and devices through software. Integrated across the Microsoft platform, .NET technology provides the ability to quickly build, deploy, manage, and use connected, security-enhanced solutions with Web services. .NET-connected solutions enable businesses to integrate their systems more rapidly and in a more agile manner and help them realize the promise of information anytime, anywhere, on any device.</p>
<p>The Microsoft platform includes everything a business needs to develop and deploy a Web service-connected IT architecture: servers to host Web services, development tools to create them, applications to use them, and a worldwide network of more than 35,000 Microsoft Certified Partner organizations to provide any help you need.  </p>
<br /><img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/rajashri.wordpress.com/7/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/rajashri.wordpress.com/7/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/rajashri.wordpress.com/7/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/rajashri.wordpress.com/7/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/rajashri.wordpress.com/7/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/rajashri.wordpress.com/7/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/rajashri.wordpress.com/7/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/rajashri.wordpress.com/7/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/rajashri.wordpress.com/7/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/rajashri.wordpress.com/7/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/rajashri.wordpress.com/7/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/rajashri.wordpress.com/7/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/rajashri.wordpress.com/7/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/rajashri.wordpress.com/7/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/rajashri.wordpress.com/7/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/rajashri.wordpress.com/7/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=rajashri.wordpress.com&amp;blog=1986833&amp;post=7&amp;subd=rajashri&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://rajashri.wordpress.com/2007/10/25/what-is-net/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/90fbc04c7f2e5cf3eb6a377a14e52e9a?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">rajashri</media:title>
		</media:content>
	</item>
		<item>
		<title>Advantage Of stored procedures</title>
		<link>http://rajashri.wordpress.com/2007/10/25/advantage-of-stored-procedures/</link>
		<comments>http://rajashri.wordpress.com/2007/10/25/advantage-of-stored-procedures/#comments</comments>
		<pubDate>Thu, 25 Oct 2007 10:20:58 +0000</pubDate>
		<dc:creator>rajashri</dc:creator>
				<category><![CDATA[Sql Server]]></category>

		<guid isPermaLink="false">http://rajashri.wordpress.com/2007/10/25/advantage-of-stored-procedures/</guid>
		<description><![CDATA[A variety of advantages can be obtained through the use of stored procedures. [edit] Pre-compilation of SQL statements SQL statements implemented as stored procedures in some cases run faster, as they can be pre-compiled. Execution plans for compiled statements can &#8230; <a href="http://rajashri.wordpress.com/2007/10/25/advantage-of-stored-procedures/">Continue reading <span class="meta-nav">&#8594;</span></a><img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=rajashri.wordpress.com&amp;blog=1986833&amp;post=6&amp;subd=rajashri&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>A variety of advantages can be obtained through the use of stored procedures.</p>
<p>[edit] Pre-compilation of SQL statements<br />
SQL statements implemented as stored procedures in some cases run faster, as they can be pre-compiled. Execution plans for compiled statements can be stored in the database, together with the procedure. This can remove the compilation overhead that is typically required in situations where software applications send inline SQL queries to a database. However, most database systems implement statement caches to avoid repetitive compilation of dynamic SQL statements.</p>
<p>In addition, pre-compiled SQL statements, while avoiding some overhead, add to the complexity of creating an optimal execution plan because not all arguments of the SQL statement are supplied at compile time. Depending on the specific database implementation and configuration, mixed performance results will be seen from stored procedures versus generic queries or user defined functions .</p>
<p>[edit] Execution on a database server<br />
Stored procedures can run directly within the database engine. In a production system, this typically means that the procedures run entirely on a specialized database server, which has direct access to the data being accessed. The benefit here is that network communication costs can be avoided completely. This becomes particularly important for complex series of SQL statements.</p>
<p>However, note that unnecessary or excessive procedural statement execution in the database server (typically a singular shared resource) may impair overall enterprise system performance &#8211; i.e., while application servers can often be dramatically scaled horizontally for increased processing capacity, the same is not generally or as easily accomplished for database servers.</p>
<p>Therefore, a growing school of thought (not among old school DBAs of course) advocates the database be used for what it&#8217;s best at &#8211; i.e., a very efficient file cabinet. Thereby restricting any database-local procedural executions to only very specific cases rather than the old school ubiquity &#8211; instead advocating the use of advanced object oriented domain class ontologies and reusable parameterized SQL generation.</p>
<p>However, the culture war on this point is likely to continue for years more!</p>
<p>[edit] Simplification of data management<br />
Stored procedures allow for business logic to be embedded as an API in the database, which can simplify data management and reduce the need to encode the logic elsewhere in client programs. This may result in a lesser likelihood of data becoming corrupted through the use of faulty client programs. Thus, the database system can ensure data integrity and consistency with the help of stored procedures.</p>
<p>Some critics claim that databases should be for storing data only, and that business logic should only be implemented by writing a business layer of code, through which client applications should access the data. However, the use of stored procedures does not preclude the use of a business layer.</p>
<p>[edit] Security<br />
Carefully written stored procedures may allow for fine grained security permissions to be applied to a database. For example, client programs might be restricted from accessing the database via any means except those that are provided by the available stored procedures.</p>
<p>[edit] Other uses<br />
In some systems, stored procedures can be used to control transaction management; in others, stored procedures run inside a transaction such that transactions are effectively transparent to them. Stored procedures can also be invoked from a database trigger or a condition handler. For example, a stored procedure may be triggered by an insert on a specific table, or update of a specific field in a table, and the code inside the stored procedure would be executed. Writing stored procedures as condition handlers also allow DBAs to track errors in the system with greater detail by using stored procedures to catch the errors and record some audit information in the database or an external resource like a file.</p>
<br /><img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/rajashri.wordpress.com/6/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/rajashri.wordpress.com/6/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/rajashri.wordpress.com/6/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/rajashri.wordpress.com/6/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/rajashri.wordpress.com/6/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/rajashri.wordpress.com/6/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/rajashri.wordpress.com/6/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/rajashri.wordpress.com/6/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/rajashri.wordpress.com/6/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/rajashri.wordpress.com/6/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/rajashri.wordpress.com/6/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/rajashri.wordpress.com/6/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/rajashri.wordpress.com/6/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/rajashri.wordpress.com/6/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/rajashri.wordpress.com/6/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/rajashri.wordpress.com/6/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=rajashri.wordpress.com&amp;blog=1986833&amp;post=6&amp;subd=rajashri&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://rajashri.wordpress.com/2007/10/25/advantage-of-stored-procedures/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/90fbc04c7f2e5cf3eb6a377a14e52e9a?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">rajashri</media:title>
		</media:content>
	</item>
		<item>
		<title>What Is Stored procedure</title>
		<link>http://rajashri.wordpress.com/2007/10/25/what-is-stored-procedure/</link>
		<comments>http://rajashri.wordpress.com/2007/10/25/what-is-stored-procedure/#comments</comments>
		<pubDate>Thu, 25 Oct 2007 10:20:00 +0000</pubDate>
		<dc:creator>rajashri</dc:creator>
				<category><![CDATA[Sql Server]]></category>

		<guid isPermaLink="false">http://rajashri.wordpress.com/2007/10/25/what-is-stored-procedure/</guid>
		<description><![CDATA[A stored procedure is a subroutine available to applications accessing a relational database system. Stored procedures (sometimes called a sproc or SP) are actually stored in the database. Typical uses for stored procedures include data validation (integrated into the database) &#8230; <a href="http://rajashri.wordpress.com/2007/10/25/what-is-stored-procedure/">Continue reading <span class="meta-nav">&#8594;</span></a><img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=rajashri.wordpress.com&amp;blog=1986833&amp;post=5&amp;subd=rajashri&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>A stored procedure is a subroutine available to applications accessing a relational database system. Stored procedures (sometimes called a sproc or SP) are actually stored in the database.</p>
<p>Typical uses for stored procedures include data validation (integrated into the database) or access control mechanisms. Furthermore, stored procedures are used to consolidate and centralize logic that was originally implemented in applications. Large or complex processing that might require the execution of several SQL statements is moved into stored procedures and all applications call the procedures only.</p>
<p>Stored procedures are similar to user-defined functions (UDFs). The major difference is that UDFs can be used like any other expression within SQL statements, whereas stored procedures must be invoked using the CALL statement</p>
<br /><img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/rajashri.wordpress.com/5/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/rajashri.wordpress.com/5/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/rajashri.wordpress.com/5/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/rajashri.wordpress.com/5/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/rajashri.wordpress.com/5/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/rajashri.wordpress.com/5/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/rajashri.wordpress.com/5/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/rajashri.wordpress.com/5/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/rajashri.wordpress.com/5/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/rajashri.wordpress.com/5/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/rajashri.wordpress.com/5/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/rajashri.wordpress.com/5/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/rajashri.wordpress.com/5/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/rajashri.wordpress.com/5/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/rajashri.wordpress.com/5/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/rajashri.wordpress.com/5/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=rajashri.wordpress.com&amp;blog=1986833&amp;post=5&amp;subd=rajashri&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://rajashri.wordpress.com/2007/10/25/what-is-stored-procedure/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/90fbc04c7f2e5cf3eb6a377a14e52e9a?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">rajashri</media:title>
		</media:content>
	</item>
		<item>
		<title>Transaction Management: Stored Procedures or ADO.NET?</title>
		<link>http://rajashri.wordpress.com/2007/10/25/transaction-management-stored-procedures-or-adonet/</link>
		<comments>http://rajashri.wordpress.com/2007/10/25/transaction-management-stored-procedures-or-adonet/#comments</comments>
		<pubDate>Thu, 25 Oct 2007 10:16:27 +0000</pubDate>
		<dc:creator>rajashri</dc:creator>
				<category><![CDATA[Asp.net 2.0]]></category>

		<guid isPermaLink="false">http://rajashri.wordpress.com/2007/10/25/transaction-management-stored-procedures-or-adonet/</guid>
		<description><![CDATA[This article, along with last week&#8217;s look at using ADO.NET to manage transactions, provide two different ways for providing transactional support in your data-driven applications. So which technique should you use? I find myself using both techniques. For simple batch &#8230; <a href="http://rajashri.wordpress.com/2007/10/25/transaction-management-stored-procedures-or-adonet/">Continue reading <span class="meta-nav">&#8594;</span></a><img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=rajashri.wordpress.com&amp;blog=1986833&amp;post=4&amp;subd=rajashri&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>This article, along with last week&#8217;s look at using ADO.NET to manage transactions, provide two different ways for providing transactional support in your data-driven applications. So which technique should you use? I find myself using both techniques. For simple batch statements that are known at compile time I tend to use stored procedures. An excellent example would be the case in point above, when deleting from a table that has associated child records that I also want to delete. </p>
<p>There are times, however, when I need to issue a series of atomic statements but I don&#8217;t know what statements will need to be executed, exactly, until runtime. Or, there may be a variable number of stored procedure calls that need to be made based on data supplied by the user. For example, imagine that I presented a list of all departments in the system using a CheckBoxList Web control, allowing the user to select the set of departments she wanted to delete. </p>
<p>Upon posting back, I&#8217;d enumerate the items in the CheckBoxList&#8217;s Items collection and issue a call to the DeleteDepartment stored procedure we examined above. Now, deleting each department and its associated employees is treated as a transaction (as we have BEGIN TRANSACTION in the stored procedure), but I want all department deletions to behave as an atomic statement. That is, say the user opted to delete five departments. If three departments and their employees to be deleted only to have an error crop up when trying to delete the fourth department, I want to make sure that the delete of the first three departments and employees are &#8220;undone.&#8221; I can accomplish this by wrapping the loop through the Items collection and the subsequent calls to DeleteDepartment within a transaction itself. (This is an example of providing transactions at both the ADO.NET level and stored procedure level!) </p>
<p>That is, my code would look something like: </p>
<p>&#8216;Create a connection<br />
Dim myConnection As New SqlConnection(myConnString)<br />
myConnection.Open()</p>
<p>&#8216;Start the transaction<br />
Dim myTrans As SqlTransaction = myConnection.BeginTransaction()</p>
<p>Dim sql as String = &#8220;DeleteDepartment&#8221;</p>
<p>Try<br />
   &#8216;Create the SqlCommand object, specifying the transaction through<br />
   &#8216;the constructor (along with the SQL string and SqlConnection)<br />
   Dim myCommand as New SqlCommand(sql, myConnection, myTrans)</p>
<p>   For Each dept as ListItem in CheckBoxListID.Items<br />
      &#8216;Add the dept.Value to the Parameters collection<br />
      myCommand.Parameters.Clear()</p>
<p>      myCommand.Parameters.Add(&#8220;@DepartmentID&#8221;, dept.Value)</p>
<p>      myCommand.ExecuteNonQuery()<br />
   Next</p>
<p>   &#8216;If we reach here, all command succeeded, so commit the transaction<br />
   myTrans.Commit</p>
<p>Catch ex as Exception<br />
   &#8216;Something went wrong, so rollback the transaction<br />
   myTrans.Rollback()</p>
<p>   Throw 		&#8216;Bubble up the exception<br />
Finally<br />
   myConnection.Close()	&#8216;Finally, close the connection<br />
End Try</p>
<br /><img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/rajashri.wordpress.com/4/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/rajashri.wordpress.com/4/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/rajashri.wordpress.com/4/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/rajashri.wordpress.com/4/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/rajashri.wordpress.com/4/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/rajashri.wordpress.com/4/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/rajashri.wordpress.com/4/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/rajashri.wordpress.com/4/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/rajashri.wordpress.com/4/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/rajashri.wordpress.com/4/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/rajashri.wordpress.com/4/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/rajashri.wordpress.com/4/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/rajashri.wordpress.com/4/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/rajashri.wordpress.com/4/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/rajashri.wordpress.com/4/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/rajashri.wordpress.com/4/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=rajashri.wordpress.com&amp;blog=1986833&amp;post=4&amp;subd=rajashri&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://rajashri.wordpress.com/2007/10/25/transaction-management-stored-procedures-or-adonet/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/90fbc04c7f2e5cf3eb6a377a14e52e9a?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">rajashri</media:title>
		</media:content>
	</item>
		<item>
		<title>How to use Transaction inside Stored Procedure Using Sql Server 2000</title>
		<link>http://rajashri.wordpress.com/2007/10/25/how-to-use-transaction-inside-stored-procedure-using-sql-server-2000/</link>
		<comments>http://rajashri.wordpress.com/2007/10/25/how-to-use-transaction-inside-stored-procedure-using-sql-server-2000/#comments</comments>
		<pubDate>Thu, 25 Oct 2007 10:08:49 +0000</pubDate>
		<dc:creator>rajashri</dc:creator>
				<category><![CDATA[Sql Server]]></category>

		<guid isPermaLink="false">http://rajashri.wordpress.com/2007/10/25/how-to-use-transaction-inside-stored-procedure-using-sql-server-2000/</guid>
		<description><![CDATA[An Example&#8230; The following snippet shows a stored procedure that uses a transaction to maintain data consistency. In this particular example, there are two related tables, Departments and Employees, with the stored procedure deleting a specific department. Each Employees record &#8230; <a href="http://rajashri.wordpress.com/2007/10/25/how-to-use-transaction-inside-stored-procedure-using-sql-server-2000/">Continue reading <span class="meta-nav">&#8594;</span></a><img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=rajashri.wordpress.com&amp;blog=1986833&amp;post=3&amp;subd=rajashri&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>An Example&#8230;<br />
The following snippet shows a stored procedure that uses a transaction to maintain data consistency. In this particular example, there are two related tables, Departments and Employees, with the stored procedure deleting a specific department. Each Employees record has a foreign key constraint to the Departments table. Therefore, in order to delete a record from the Departments table all associated records from the Employees table must be deleted first. Since we want to ensure that either all of the associated employees and the department are deleted, or none of the records are deleted, we&#8217;ll wrap these two DELETE statements within a transaction</p>
<p>CREATE PROCEDURE DeleteDepartment<br />
(<br />
   @DepartmentID    int<br />
)<br />
AS</p>
<p>&#8211; This sproc performs two DELETEs.  First it deletes all of the<br />
&#8211; department&#8217;s associated employees.  Next, it deletes the department.</p>
<p>&#8211; STEP 1: Start the transaction<br />
BEGIN TRANSACTION</p>
<p>&#8211; STEP 2 &amp; 3: Issue the DELETE statements, checking @@ERROR after each statement<br />
DELETE FROM Employees<br />
WHERE DepartmentID = @DepartmentID</p>
<p>&#8211; Rollback the transaction if there were any errors<br />
IF @@ERROR  0<br />
 BEGIN<br />
    &#8212; Rollback the transaction<br />
    ROLLBACK</p>
<p>    &#8212; Raise an error and return<br />
    RAISERROR (&#8216;Error in deleting employees in DeleteDepartment.&#8217;, 16, 1)<br />
    RETURN<br />
 END</p>
<p>DELETE FROM Departments<br />
WHERE DepartmentID = @DepartmentID</p>
<p>&#8211; Rollback the transaction if there were any errors<br />
IF @@ERROR  0<br />
 BEGIN<br />
    &#8212; Rollback the transaction<br />
    ROLLBACK</p>
<p>    &#8212; Raise an error and return<br />
    RAISERROR (&#8216;Error in deleting department in DeleteDepartment.&#8217;, 16, 1)<br />
    RETURN<br />
 END</p>
<p>&#8211; STEP 4: If we reach this point, the commands completed successfully<br />
&#8211;         Commit the transaction&#8230;.<br />
COMMIT</p>
<br /><img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/rajashri.wordpress.com/3/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/rajashri.wordpress.com/3/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/rajashri.wordpress.com/3/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/rajashri.wordpress.com/3/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/rajashri.wordpress.com/3/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/rajashri.wordpress.com/3/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/rajashri.wordpress.com/3/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/rajashri.wordpress.com/3/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/rajashri.wordpress.com/3/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/rajashri.wordpress.com/3/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/rajashri.wordpress.com/3/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/rajashri.wordpress.com/3/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/rajashri.wordpress.com/3/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/rajashri.wordpress.com/3/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/rajashri.wordpress.com/3/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/rajashri.wordpress.com/3/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=rajashri.wordpress.com&amp;blog=1986833&amp;post=3&amp;subd=rajashri&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://rajashri.wordpress.com/2007/10/25/how-to-use-transaction-inside-stored-procedure-using-sql-server-2000/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/90fbc04c7f2e5cf3eb6a377a14e52e9a?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">rajashri</media:title>
		</media:content>
	</item>
		<item>
		<title>Hello world!</title>
		<link>http://rajashri.wordpress.com/2007/10/25/hello-world/</link>
		<comments>http://rajashri.wordpress.com/2007/10/25/hello-world/#comments</comments>
		<pubDate>Thu, 25 Oct 2007 09:48:13 +0000</pubDate>
		<dc:creator>rajashri</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false"></guid>
		<description><![CDATA[Welcome to WordPress.com. This is your first post. Edit or delete it and start blogging!<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=rajashri.wordpress.com&amp;blog=1986833&amp;post=1&amp;subd=rajashri&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>Welcome to <a href="http://wordpress.com/">WordPress.com</a>. This is your first post. Edit or delete it and start blogging!</p>
<br /><img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/rajashri.wordpress.com/1/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/rajashri.wordpress.com/1/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/rajashri.wordpress.com/1/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/rajashri.wordpress.com/1/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/rajashri.wordpress.com/1/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/rajashri.wordpress.com/1/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/rajashri.wordpress.com/1/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/rajashri.wordpress.com/1/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/rajashri.wordpress.com/1/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/rajashri.wordpress.com/1/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/rajashri.wordpress.com/1/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/rajashri.wordpress.com/1/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/rajashri.wordpress.com/1/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/rajashri.wordpress.com/1/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/rajashri.wordpress.com/1/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/rajashri.wordpress.com/1/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=rajashri.wordpress.com&amp;blog=1986833&amp;post=1&amp;subd=rajashri&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://rajashri.wordpress.com/2007/10/25/hello-world/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/90fbc04c7f2e5cf3eb6a377a14e52e9a?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">rajashri</media:title>
		</media:content>
	</item>
	</channel>
</rss>
