<?xml version='1.0' encoding='UTF-8'?><?xml-stylesheet href="http://www.blogger.com/styles/atom.css" type="text/css"?><feed xmlns='http://www.w3.org/2005/Atom' xmlns:openSearch='http://a9.com/-/spec/opensearchrss/1.0/' xmlns:blogger='http://schemas.google.com/blogger/2008' xmlns:georss='http://www.georss.org/georss' xmlns:gd="http://schemas.google.com/g/2005" xmlns:thr='http://purl.org/syndication/thread/1.0'><id>tag:blogger.com,1999:blog-1331387060948995865</id><updated>2026-10-13T13:25:28.275-07:00</updated><category term="SQL Server"/><category term=".Net"/><category term="C#"/><category term="MVC"/><category term="Entity Framework"/><category term="Office 2003 / 2007 / 2010"/><category term="Visual web developer ( vwd 2010 )"/><category term="WCF"/><title type='text'>Complete Solution</title><subtitle type='html'>This blog provides you all topic with of practical examples. Here you will find most of posts related to SQL Server and .Net.</subtitle><link rel='http://schemas.google.com/g/2005#feed' type='application/atom+xml' href='http://rajeshbailwal.blogspot.com/feeds/posts/default'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1331387060948995865/posts/default?redirect=false'/><link rel='alternate' type='text/html' href='http://rajeshbailwal.blogspot.com/'/><link rel='hub' href='http://pubsubhubbub.appspot.com/'/><author><name>Rajesh</name><uri>http://www.blogger.com/profile/13411886056681990229</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhfGxMDfbXjdx9s7OivC7Rcz6xWeOZ3XASP1R_IQ-Lo6Md6GFX0AunAdeuDr8tLoTnLCVtmkF8PzkSwQQXOmH3s4k3ZDdGzJSDpB9JMf8nqVmsobp32fByrKK0adOE5ljw/s220/My+Collage.jpg'/></author><generator version='7.00' uri='http://www.blogger.com'>Blogger</generator><openSearch:totalResults>20</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>25</openSearch:itemsPerPage><entry><id>tag:blogger.com,1999:blog-1331387060948995865.post-5076549409941160506</id><published>2013-06-24T07:36:00.000-07:00</published><updated>2013-06-24T07:38:34.654-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term=".Net"/><category scheme="http://www.blogger.com/atom/ns#" term="C#"/><title type='text'>Export Datatable to Excel in C#</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;div style=&quot;border-bottom: 0px; border-left: 0px; border-right: 0px; border-top: 0px; color: #44525e; font-family: &#39;Segoe UI&#39;, Tahoma, Arial, Helvetica, sans-serif; font-size: 13px; line-height: 18px; margin-bottom: 18px; outline-color: invert; outline-style: none; outline-width: 0px; padding-bottom: 1px; padding-left: 1px; padding-right: 1px; padding-top: 1px; vertical-align: baseline;&quot;&gt;
&lt;b&gt;
&lt;/b&gt;

First, add the &quot;Microsoft.Office.Interop.Excel&quot; assembly reference in your project. Please make sure your project uses .Net Framework 4.0&lt;br /&gt;
&lt;br /&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;pre class=&quot;C#&quot; name=&quot;code&quot;&gt;Microsoft.Office.Interop.Excel.Application ExcelApp =
            new Microsoft.Office.Interop.Excel.Application();
            ExcelApp.Application.Workbooks.Add(Type.Missing);

            // Change properties of the Workbook 

            ExcelApp.Columns.ColumnWidth = 20;

            // Storing header part in Excel
            for (int i = 1; i &amp;lt; dataGridView1.Columns.Count + 1; i++)
            {
                ExcelApp.Cells[1, i] = dataGridView1.Columns[i - 1].HeaderText;
            }

            // Storing Each row and column value to excel sheet
            for (int i = 0; i &amp;lt; dataGridView1.Rows.Count - 1; i++)
            {
                for (int j = 0; j &amp;lt; dataGridView1.Columns.Count; j++)
                {
                    ExcelApp.Cells[i + 2, j + 1] = dataGridView1.Rows[i].Cells[j].Value.ToString();
                }
            }
            MessageBox.Show(&quot;Excel file created , you can find the file D:\\Employee Data.xlsx&quot;);
            ExcelApp.Visible = true;
            ExcelApp.ActiveWorkbook.SaveCopyAs(&quot;D:\\Employee Data.xlsx&quot;);
 ExcelApp.ActiveWorkbook.Saved = true;
 Marshal.FinalReleaseComObject(ExcelApp);
&lt;/pre&gt;
&lt;div&gt;
&lt;/div&gt;
&lt;span style=&quot;color: #44525e; font-family: &#39;Segoe UI&#39;, Tahoma, Arial, Helvetica, sans-serif; font-size: 13px; line-height: 18px;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;div style=&quot;border-bottom: 0px; border-left: 0px; border-right: 0px; border-top: 0px; margin-bottom: 18px; outline-color: invert; outline-style: none; outline-width: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; vertical-align: baseline;&quot;&gt;
&lt;/div&gt;
Enjoy..
&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='http://rajeshbailwal.blogspot.com/feeds/5076549409941160506/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://rajeshbailwal.blogspot.com/2013/06/exporting-dataset-to-excel-in-windows.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1331387060948995865/posts/default/5076549409941160506'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1331387060948995865/posts/default/5076549409941160506'/><link rel='alternate' type='text/html' href='http://rajeshbailwal.blogspot.com/2013/06/exporting-dataset-to-excel-in-windows.html' title='Export Datatable to Excel in C#'/><author><name>Rajesh</name><uri>http://www.blogger.com/profile/13411886056681990229</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhfGxMDfbXjdx9s7OivC7Rcz6xWeOZ3XASP1R_IQ-Lo6Md6GFX0AunAdeuDr8tLoTnLCVtmkF8PzkSwQQXOmH3s4k3ZDdGzJSDpB9JMf8nqVmsobp32fByrKK0adOE5ljw/s220/My+Collage.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1331387060948995865.post-6960856187557896574</id><published>2013-03-14T03:01:00.001-07:00</published><updated>2013-03-14T03:35:13.392-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term=".Net"/><category scheme="http://www.blogger.com/atom/ns#" term="Visual web developer ( vwd 2010 )"/><category scheme="http://www.blogger.com/atom/ns#" term="WCF"/><title type='text'>Fault contract in WCF</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;div style=&quot;border: 0px; color: #44525e; font-family: &#39;Segoe UI&#39;, Tahoma, Arial, Helvetica, sans-serif; font-size: 13px; line-height: 18.203125px; margin-bottom: 18px; outline: 0px; padding: 1px; vertical-align: baseline;&quot;&gt;
I have created one sample project and uploaded on goggle drive. To download click the below click then open the &quot;File&quot; option from the menu and then you will find the &quot;Download&quot; option.
&lt;br /&gt;
&lt;a href=&quot;https://docs.google.com/file/d/0B0njXeHvCX5NWUJMNXNhQzRZTlk/edit?usp=sharing&quot; target=&quot;_blank&quot;&gt;&lt;b&gt;WCFServiceUsingFaultContract Project&lt;/b&gt;&lt;/a&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;What is Fault Contract:&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
In simple WCF Service errors/Exceptions can be passed to the Client(WCF Service Consumer) by using FaultContract

How do you handle errors in ASP.NET? It&#39;s very simple just by adding the simple Try &amp;amp; Catch blocks. But when you come to WCF Service if any unexpected error occurred (like SQL server down/Unavailability of data/Divide By Zero) in service then error/Exception details can be passed to Client by using Fault Contract.&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;Predicted:&lt;/b&gt; (Divide By Zero/Channel Exceptions/Application exceptions etc..)&lt;/div&gt;
&lt;/div&gt;
&lt;pre class=&quot;C#&quot; name=&quot;code&quot;&gt;using System;
 public void Divide(float number, float divideBy) 
       {
           If(dividBy ==0)
           {
             myServiceData.Result = false;
             myServiceData.ErrorMessage = &quot;Invalid Operation.&quot;;
             myServiceData.ErrorDetails = &quot;Can not divide by 0.&quot;;
             throw new FaultException&lt;servicedata&gt;(myServiceData);
           }
           return number/divideBy;
       }
&lt;/servicedata&gt;&lt;/pre&gt;
&lt;span style=&quot;color: #44525e; font-family: &#39;Segoe UI&#39;, Tahoma, Arial, Helvetica, sans-serif; font-size: 13px; line-height: 18.203125px;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;color: #44525e; font-family: &#39;Segoe UI&#39;, Tahoma, Arial, Helvetica, sans-serif; font-size: 13px; line-height: 18.203125px;&quot;&gt;&lt;b&gt;UnPredicted:&lt;/b&gt; (which I explained in this article like connection failures/SQL Server down/Transport errors/Business logic errors.)&lt;/span&gt;&lt;br /&gt;
&lt;pre class=&quot;C#&quot; name=&quot;code&quot;&gt;using System;
try
            {
                SqlConnection con = new SqlConnection(StrConnectionString);
                con.Open();
                myServiceData.Result = true;
             //Your logic to retrieve data &amp;amp; and return it. If any exception occur while opening the connection or any other unexpected exception occur it can be thrown to Client (WCF Consumer) by below catch blocks.
           }
            catch (SqlException sqlEx)
            {
                myServiceData.Result = true;
                myServiceData.ErrorMessage = &quot;Connection can not open this &quot; + 
                   &quot;time either connection string is wrong or Sever is down. Try later&quot;;
                myServiceData.ErrorDetails = sqlEx.ToString();
                throw new FaultException&lt;servicedata&gt;(myServiceData, sqlEx.ToString());
            }
            catch (Exception ex)
            {
                myServiceData.Result = false;
                myServiceData.ErrorMessage = &quot;unforeseen error occured. Please try later.&quot;;
                myServiceData.ErrorDetails = ex.ToString();
                throw new FaultException&lt;servicedata&gt;(myServiceData, ex.ToString());
            }
&lt;/servicedata&gt;&lt;/servicedata&gt;&lt;/pre&gt;
&lt;div style=&quot;border: 0px; margin-bottom: 18px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;div style=&quot;color: #44525e; font-family: &#39;Segoe UI&#39;, Tahoma, Arial, Helvetica, sans-serif; font-size: 13px; line-height: 18.203125px;&quot;&gt;
&lt;/div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='http://rajeshbailwal.blogspot.com/feeds/6960856187557896574/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://rajeshbailwal.blogspot.com/2013/03/fault-contract-in-wcf.html#comment-form' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1331387060948995865/posts/default/6960856187557896574'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1331387060948995865/posts/default/6960856187557896574'/><link rel='alternate' type='text/html' href='http://rajeshbailwal.blogspot.com/2013/03/fault-contract-in-wcf.html' title='Fault contract in WCF'/><author><name>Rajesh</name><uri>http://www.blogger.com/profile/13411886056681990229</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhfGxMDfbXjdx9s7OivC7Rcz6xWeOZ3XASP1R_IQ-Lo6Md6GFX0AunAdeuDr8tLoTnLCVtmkF8PzkSwQQXOmH3s4k3ZDdGzJSDpB9JMf8nqVmsobp32fByrKK0adOE5ljw/s220/My+Collage.jpg'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1331387060948995865.post-8903103259921572661</id><published>2013-03-10T20:41:00.001-07:00</published><updated>2013-03-10T20:45:42.374-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term=".Net"/><category scheme="http://www.blogger.com/atom/ns#" term="C#"/><category scheme="http://www.blogger.com/atom/ns#" term="MVC"/><title type='text'>Action Filters in C# (MVC)</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;div style=&quot;border: 0px; color: #44525e; font-family: &#39;Segoe UI&#39;, Tahoma, Arial, Helvetica, sans-serif; font-size: 13px; line-height: 18.203125px; margin-bottom: 18px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
The goal of this tutorial is to explain action filters. An action filter is an attribute that you can apply to a controller action -- or an entire controller -- that modifies the way in which the action is executed. The ASP.NET MVC framework includes several action filters:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;ul style=&quot;border: 0px; list-style-image: initial; list-style-position: initial; margin: 0px 0px 18px 30px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;li style=&quot;border: 0px; margin: 0px 0px 5px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;OutputCache – This action filter caches the output of a controller action for a specified amount of time.&lt;/li&gt;
&lt;li style=&quot;border: 0px; margin: 0px 0px 5px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;HandleError – This action filter handles errors raised when a controller action executes.&lt;/li&gt;
&lt;li style=&quot;border: 0px; margin: 0px 0px 5px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;Authorize – This action filter enables you to restrict access to a particular user or role.&lt;/li&gt;
&lt;/ul&gt;
&lt;/div&gt;
&lt;div style=&quot;border: 0px; color: #44525e; font-family: &#39;Segoe UI&#39;, Tahoma, Arial, Helvetica, sans-serif; font-size: 13px; line-height: 18.203125px; margin-bottom: 18px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
You also can create your own custom action filters. For example, you might want to create a custom action filter in order to implement a custom authentication system. Or, you might want to create an action filter that modifies the view data returned by a controller action.&lt;/div&gt;
&lt;span style=&quot;color: #44525e; font-family: &#39;Segoe UI&#39;, Tahoma, Arial, Helvetica, sans-serif; font-size: 13px; line-height: 18.203125px;&quot;&gt;In this tutorial, you learn how to build an action filter from the ground up. We create a Log action filter that logs different stages of the processing of an action to the Visual Studio Output window.&lt;/span&gt;.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;h3 style=&quot;border: 0px; color: #343434; font-family: &#39;Segoe UI&#39;, Tahoma, Arial, Helvetica, sans-serif; font-size: 1.231em; font-weight: normal; line-height: 18.203125px; margin: 0px 0px 10px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
Using an Action Filter&lt;/h3&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;div style=&quot;border: 0px; color: #44525e; font-family: &#39;Segoe UI&#39;, Tahoma, Arial, Helvetica, sans-serif; font-size: 13px; line-height: 18.203125px; margin-bottom: 18px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
An action filter is an attribute. You can apply most action filters to either an individual controller action or an entire controller.&lt;/div&gt;
&lt;div style=&quot;border: 0px; color: #44525e; font-family: &#39;Segoe UI&#39;, Tahoma, Arial, Helvetica, sans-serif; font-size: 13px; line-height: 18.203125px; margin-bottom: 18px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
For example, the Data controller in Listing 1 exposes an action named&amp;nbsp;&lt;code style=&quot;border: 0px; color: #800039; font-family: Consolas, monospace; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;Index()&lt;/code&gt;&amp;nbsp;that returns the current time. This action is decorated with the&amp;nbsp;&lt;code style=&quot;border: 0px; color: #800039; font-family: Consolas, monospace; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;OutputCache&lt;/code&gt;&amp;nbsp;action filter. This filter causes the value returned by the action to be cached for 10 seconds.&lt;/div&gt;
&lt;pre name=&quot;code&quot; class=&quot;C#&quot;&gt;
using System;
using System.Web.Mvc;

namespace MvcApplication1.Controllers
{
     public class DataController : Controller
     {
          [OutputCache(Duration=10)]
          public string Index()
          {
               return DateTime.Now.ToString(&quot;T&quot;);

          }
     }
}
&lt;/pre&gt;
&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://rajeshbailwal.blogspot.com/feeds/8903103259921572661/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://rajeshbailwal.blogspot.com/2013/03/action-filters-in-c-mvc.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1331387060948995865/posts/default/8903103259921572661'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1331387060948995865/posts/default/8903103259921572661'/><link rel='alternate' type='text/html' href='http://rajeshbailwal.blogspot.com/2013/03/action-filters-in-c-mvc.html' title='Action Filters in C# (MVC)'/><author><name>Rajesh</name><uri>http://www.blogger.com/profile/13411886056681990229</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhfGxMDfbXjdx9s7OivC7Rcz6xWeOZ3XASP1R_IQ-Lo6Md6GFX0AunAdeuDr8tLoTnLCVtmkF8PzkSwQQXOmH3s4k3ZDdGzJSDpB9JMf8nqVmsobp32fByrKK0adOE5ljw/s220/My+Collage.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1331387060948995865.post-7940706460722563533</id><published>2013-03-09T19:45:00.002-08:00</published><updated>2013-03-10T20:45:23.708-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term=".Net"/><category scheme="http://www.blogger.com/atom/ns#" term="MVC"/><title type='text'>Filtering in ASP.NET MVC</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;div style=&quot;color: #2a2a2a; font-family: &#39;Segoe UI&#39;, Tahoma, Arial, Helvetica, sans-serif; font-size: 13px; line-height: 18px; padding-bottom: 15px; white-space: normal;&quot;&gt;
In ASP.NET MVC, controllers define action methods that usually have a one-to-one relationship with possible user interactions, such as clicking a link or submitting a form. For example, when the user clicks a link, a request is routed to the designated controller, and the corresponding action method is called.
Sometimes you want to perform logic either before an action method is called or after an action method runs. To support this, ASP.NET MVC provides filters. Filters are custom classes that provide both a declarative and programmatic means to add pre-action and post-action behavior to controller action methods.

&lt;b&gt;ASP.NET MVC Filter Types&lt;/b&gt;

ASP.NET MVC supports the following types of:
&lt;ol style=&quot;text-align: left;&quot;&gt;
&lt;li&gt;&lt;b&gt;Authorization filters: &lt;/b&gt;These implement IAuthorizationFilter and make security decisions about whether to execute an action method, such as performing authentication or validating properties of the request. The AuthorizeAttribute class and the RequireHttpsAttribute class are examples of an authorization filter. Authorization filters run before any other filter.&lt;/li&gt;
&lt;li&gt;&lt;b&gt;Action filters:&lt;/b&gt; These implement IActionFilter and wrap the action method execution. The IActionFilter interface declares two methods: OnActionExecuting and OnActionExecuted. OnActionExecuting runs before the action method. OnActionExecuted runs after the action method and can perform additional processing, such as providing extra data to the action method, inspecting the return value, or canceling execution of the action method.&lt;/li&gt;
&lt;li&gt;&lt;b&gt;Result filters:&lt;/b&gt; These implement IResultFilter and wrap execution of the ActionResult object. IResultFilter declares two methods: OnResultExecuting and OnResultExecuted. OnResultExecuting runs before the ActionResult object is executed. OnResultExecuted runs after the result and can perform additional processing of the result, such as modifying the HTTP response. The OutputCacheAttribute class is one example of a result filter.&lt;/li&gt;
&lt;li&gt;&lt;b&gt;Exception filters:&lt;/b&gt; These implement IExceptionFilter and execute if there is an unhandled exception thrown during the execution of the ASP.NET MVC pipeline. Exception filters can be used for tasks such as logging or displaying an error page. The HandleErrorAttribute class is one example of an exception filter.&lt;/li&gt;
&lt;/ol&gt;
The&amp;nbsp;&lt;a href=&quot;http://msdn.microsoft.com/en-us/library/system.web.mvc.controller(v=vs.98).aspx&quot; style=&quot;color: #03697a; text-decoration: initial;&quot;&gt;Controller&lt;/a&gt;&amp;nbsp;class implements each of the filter interfaces. You can implement any of the filters for a specific controller by overriding the controller&#39;s&amp;nbsp;&lt;span class=&quot;input&quot; style=&quot;font-weight: 700;&quot;&gt;On&amp;lt;Filter&amp;gt;&lt;/span&gt;&amp;nbsp;method. For example, you can override the&amp;nbsp;&lt;a href=&quot;http://msdn.microsoft.com/en-us/library/system.web.mvc.controller.onauthorization(v=vs.98).aspx&quot; style=&quot;color: #03697a; text-decoration: initial;&quot;&gt;OnAuthorization&lt;/a&gt;&amp;nbsp;method. The simple controller included in the downloadable sample overrides each of the filters and writes out diagnostic information when each filter runs. You can implement the following&amp;nbsp;&lt;span class=&quot;input&quot; style=&quot;font-weight: 700;&quot;&gt;On&amp;lt;Filter&amp;gt;&lt;/span&gt;&amp;nbsp;methods in a controller:&lt;/div&gt;
&lt;ul style=&quot;font-family: &#39;Segoe UI&#39;, Tahoma, Arial, Helvetica, sans-serif; font-size: 13px; line-height: 16px; white-space: normal;&quot;&gt;
&lt;li style=&quot;list-style-image: none;&quot;&gt;&lt;div style=&quot;color: #2a2a2a; line-height: 18px; padding-bottom: 15px;&quot;&gt;
&lt;a href=&quot;http://msdn.microsoft.com/en-us/library/system.web.mvc.controller.onauthorization(v=vs.98).aspx&quot; style=&quot;color: #03697a; text-decoration: initial;&quot;&gt;OnAuthorization&lt;/a&gt;&lt;/div&gt;
&lt;/li&gt;
&lt;li style=&quot;list-style-image: none;&quot;&gt;&lt;div style=&quot;color: #2a2a2a; line-height: 18px; padding-bottom: 15px;&quot;&gt;
&lt;a href=&quot;http://msdn.microsoft.com/en-us/library/system.web.mvc.controller.onexception(v=vs.98).aspx&quot; style=&quot;color: #03697a; text-decoration: initial;&quot;&gt;OnException&lt;/a&gt;&lt;/div&gt;
&lt;/li&gt;
&lt;li style=&quot;list-style-image: none;&quot;&gt;&lt;div style=&quot;color: #2a2a2a; line-height: 18px; padding-bottom: 15px;&quot;&gt;
&lt;a href=&quot;http://msdn.microsoft.com/en-us/library/system.web.mvc.controller.onactionexecuting(v=vs.98).aspx&quot; style=&quot;color: #03697a; text-decoration: initial;&quot;&gt;OnActionExecuting&lt;/a&gt;&lt;/div&gt;
&lt;/li&gt;
&lt;li style=&quot;list-style-image: none;&quot;&gt;&lt;div style=&quot;color: #2a2a2a; line-height: 18px; padding-bottom: 15px;&quot;&gt;
&lt;a href=&quot;http://msdn.microsoft.com/en-us/library/system.web.mvc.controller.onactionexecuted(v=vs.98).aspx&quot; style=&quot;color: #03697a; text-decoration: initial;&quot;&gt;OnActionExecuted&lt;/a&gt;&lt;/div&gt;
&lt;/li&gt;
&lt;li style=&quot;list-style-image: none;&quot;&gt;&lt;div style=&quot;color: #2a2a2a; line-height: 18px; padding-bottom: 15px;&quot;&gt;
&lt;a href=&quot;http://msdn.microsoft.com/en-us/library/system.web.mvc.controller.onresultexecuting(v=vs.98).aspx&quot; style=&quot;color: #03697a; text-decoration: initial;&quot;&gt;OnResultExecuting&lt;/a&gt;&lt;/div&gt;
&lt;/li&gt;
&lt;li style=&quot;list-style-image: none;&quot;&gt;&lt;div style=&quot;color: #2a2a2a; line-height: 18px; padding-bottom: 15px;&quot;&gt;
&lt;a href=&quot;http://msdn.microsoft.com/en-us/library/system.web.mvc.controller.onresultexecuted(v=vs.98).aspx&quot; style=&quot;color: #03697a; text-decoration: initial;&quot;&gt;OnResultExecuted&lt;/a&gt;&lt;/div&gt;
&lt;/li&gt;
&lt;/ul&gt;
Reference from http://msdn.microsoft.com/en-us/library/gg416513(v=vs.98).aspx
&lt;br /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://rajeshbailwal.blogspot.com/feeds/7940706460722563533/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://rajeshbailwal.blogspot.com/2013/03/filtering-in-aspnet-mvc.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1331387060948995865/posts/default/7940706460722563533'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1331387060948995865/posts/default/7940706460722563533'/><link rel='alternate' type='text/html' href='http://rajeshbailwal.blogspot.com/2013/03/filtering-in-aspnet-mvc.html' title='Filtering in ASP.NET MVC'/><author><name>Rajesh</name><uri>http://www.blogger.com/profile/13411886056681990229</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhfGxMDfbXjdx9s7OivC7Rcz6xWeOZ3XASP1R_IQ-Lo6Md6GFX0AunAdeuDr8tLoTnLCVtmkF8PzkSwQQXOmH3s4k3ZDdGzJSDpB9JMf8nqVmsobp32fByrKK0adOE5ljw/s220/My+Collage.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1331387060948995865.post-7723276798177319024</id><published>2013-03-07T09:50:00.002-08:00</published><updated>2013-03-09T19:46:16.854-08:00</updated><category scheme="http://www.blogger.com/atom/ns#" term=".Net"/><category scheme="http://www.blogger.com/atom/ns#" term="C#"/><category scheme="http://www.blogger.com/atom/ns#" term="Entity Framework"/><category scheme="http://www.blogger.com/atom/ns#" term="MVC"/><title type='text'>Profiling Database activity in Entity Framework</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;b&gt;Profiling Database activity in Entity Framework&lt;/b&gt;&lt;br/&gt;
&lt;div class=&quot;line number1 index0 alt2&quot; style=&quot;background-color: white !important; background-image: none !important;&quot;&gt;
&lt;br /&gt;

&lt;span style=&quot;color: #333333; font-family: Verdana, sans-serif;&quot;&gt;&lt;span style=&quot;line-height: 10px;&quot;&gt;In Entity framework the LINQ to entities query can be traced by method,&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;&lt;span style=&quot;background-color: white; color: #333333; line-height: 16px;&quot;&gt;ToTraceString. For doing this first it needs to be converted in&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;background-color: white; color: #333333; font-family: &#39;Segoe UI&#39;, &#39;Lucida Grande&#39;, Verdana, Arial, Helvetica, sans-serif; line-height: 16px;&quot;&gt;ObjectQuery.&lt;/span&gt;
&lt;pre style=&quot;background: #eee; color: black;&quot;&gt;&lt;span style=&quot;color: blue;&quot;&gt;var&lt;/span&gt; objQuery = from c in context.Customers where c.CustomerID&lt;span style=&quot;color: blue;&quot;&gt; == &lt;/span&gt;&lt;span style=&quot;color: #0066ff;&quot;&gt;3&lt;/span&gt; &lt;span style=&quot;color: #3333ff; font-weight: 700;&quot;&gt;select&lt;/span&gt; c;

&lt;span style=&quot;color: blue;&quot;&gt;var&lt;/span&gt; objectQuery=objQuery as System.Data.Objects.ObjectQuery;

Console.WriteLine(objectQuery.ToTraceString());
&lt;/pre&gt;
&lt;/div&gt;
&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='http://rajeshbailwal.blogspot.com/feeds/7723276798177319024/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://rajeshbailwal.blogspot.com/2013/03/profiling-database-activity-in-entity.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1331387060948995865/posts/default/7723276798177319024'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1331387060948995865/posts/default/7723276798177319024'/><link rel='alternate' type='text/html' href='http://rajeshbailwal.blogspot.com/2013/03/profiling-database-activity-in-entity.html' title='Profiling Database activity in Entity Framework'/><author><name>Rajesh</name><uri>http://www.blogger.com/profile/13411886056681990229</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhfGxMDfbXjdx9s7OivC7Rcz6xWeOZ3XASP1R_IQ-Lo6Md6GFX0AunAdeuDr8tLoTnLCVtmkF8PzkSwQQXOmH3s4k3ZDdGzJSDpB9JMf8nqVmsobp32fByrKK0adOE5ljw/s220/My+Collage.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1331387060948995865.post-8011123331652695815</id><published>2012-12-26T02:17:00.005-08:00</published><updated>2012-12-26T06:27:15.005-08:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="SQL Server"/><title type='text'>Granting execute permission on all stored procedure in SQL</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;span style=&quot;font-family: Trebuchet MS, sans-serif;&quot;&gt;In SQL many times we need to provide execute permission to all stored procedure for specific user for any database. To achieve this you can make the execute statement by below query.&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Trebuchet MS, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;font-family: Trebuchet MS, sans-serif;&quot;&gt;The query for it is just simple:&lt;/span&gt;&lt;/div&gt;
&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;div id=&quot;codeSnippetWrapper&quot; style=&quot;background-color: #f4f4f4; border: 1px solid silver; cursor: text; direction: ltr; line-height: 12pt; margin: 20px 0px 10px; max-height: 200px; overflow: auto; padding: 4px; text-align: left; width: 97.5%;&quot;&gt;
&lt;div id=&quot;codeSnippet&quot; style=&quot;background-color: #f4f4f4; border-style: none; direction: ltr; line-height: 12pt; overflow: visible; padding: 0px; text-align: left; width: 100%;&quot;&gt;
&lt;code style=&quot;font-size: 12px;&quot;&gt;&lt;span style=&quot;color: blue;&quot;&gt;SELECT &lt;/span&gt;&lt;span style=&quot;color: red;&quot;&gt;&#39;Grant Execute on &#39; &lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;+ &lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;name &lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;+&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: red;&quot;&gt;&#39; SQLServerUSERName&#39;&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;FROM &lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;sysobjects &lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;WHERE &lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;xtype &lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;IN &lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: red;&quot;&gt;&#39;P&#39;&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;)&lt;/span&gt;&lt;/code&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;For tables and views:&lt;/span&gt;
&lt;br /&gt;
&lt;div id=&quot;codeSnippetWrapper&quot; style=&quot;background-color: #f4f4f4; border: 1px solid silver; cursor: text; direction: ltr; line-height: 12pt; margin: 20px 0px 10px; max-height: 200px; overflow: auto; padding: 4px; width: 100%;&quot;&gt;
&lt;code style=&quot;font-size: 12px;&quot;&gt;&lt;span style=&quot;color: blue;&quot;&gt;SELECT &lt;/span&gt;&lt;span style=&quot;color: red;&quot;&gt;&#39;Grant select,insert,update,delete on &#39; &lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;+ &lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;name &lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;+ &lt;/span&gt;&lt;span style=&quot;color: red;&quot;&gt;&#39; SQLServerUSERName&#39;&#39;&lt;br /&gt;from sysobjects where xtype in (&#39;&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;U&lt;/span&gt;&lt;span style=&quot;color: red;&quot;&gt;&#39;,&#39;&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;V&lt;/span&gt;&lt;span style=&quot;color: red;&quot;&gt;&#39;)&#39;&lt;/span&gt;&lt;/code&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;span style=&quot;font-family: Trebuchet MS, sans-serif;&quot;&gt;Enjoy.&lt;/span&gt;
&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='http://rajeshbailwal.blogspot.com/feeds/8011123331652695815/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://rajeshbailwal.blogspot.com/2012/12/granting-execute-permission-on-all.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1331387060948995865/posts/default/8011123331652695815'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1331387060948995865/posts/default/8011123331652695815'/><link rel='alternate' type='text/html' href='http://rajeshbailwal.blogspot.com/2012/12/granting-execute-permission-on-all.html' title='Granting execute permission on all stored procedure in SQL'/><author><name>Rajesh</name><uri>http://www.blogger.com/profile/13411886056681990229</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhfGxMDfbXjdx9s7OivC7Rcz6xWeOZ3XASP1R_IQ-Lo6Md6GFX0AunAdeuDr8tLoTnLCVtmkF8PzkSwQQXOmH3s4k3ZDdGzJSDpB9JMf8nqVmsobp32fByrKK0adOE5ljw/s220/My+Collage.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1331387060948995865.post-2317308210295889616</id><published>2012-12-26T02:02:00.000-08:00</published><updated>2012-12-26T02:02:28.931-08:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="SQL Server"/><title type='text'>Getting Month name from any date</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
Getting Month name from any date in SQL:&lt;br /&gt;
&lt;br /&gt;
Just use the below query and you will get the result.&lt;br /&gt;
&lt;br /&gt;
&lt;span style=&quot;background-color: #f4f4f4; color: red; font-family: monospace; font-size: 12px; line-height: 16px; white-space: pre;&quot;&gt;&lt;code style=&quot;font-size: 12px;&quot;&gt;&lt;span style=&quot;color: blue;&quot;&gt;SELECT &lt;/span&gt;&lt;span style=&quot;color: magenta;&quot;&gt;DATENAME&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: magenta;&quot;&gt;MONTH&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;, &lt;/span&gt;&lt;span style=&quot;color: magenta;&quot;&gt;DATEADD&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: magenta;&quot;&gt;MONTH&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;, &lt;/span&gt;&lt;span style=&quot;color: magenta;&quot;&gt;MONTH&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: magenta;&quot;&gt;GETDATE&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;()), -&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;1 &lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;))&lt;/span&gt;&lt;/code&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;background-color: #f4f4f4; color: red; font-family: monospace; font-size: 12px; line-height: 16px; white-space: pre;&quot;&gt;&lt;code style=&quot;font-size: 12px;&quot;&gt;&lt;span style=&quot;color: grey;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/code&gt;&lt;/span&gt;
&lt;span style=&quot;background-color: #f4f4f4; color: red; font-family: monospace; font-size: 12px; line-height: 16px; white-space: pre;&quot;&gt;&lt;code style=&quot;font-size: 12px;&quot;&gt;&lt;span style=&quot;color: grey;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/code&gt;&lt;/span&gt;
&lt;span style=&quot;font-family: monospace;&quot;&gt;&lt;span style=&quot;font-size: 12px; line-height: 16px; white-space: pre;&quot;&gt;&lt;u&gt;Example with result:&lt;/u&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;div&gt;
&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEghFRQriS7HpB3YlTzEy4dUyY6HGVs5iqEDaK7VKjZvGFpBxUOgw3GqskauSxqRYOpE80nESeWLKyQwI18VBXQM1ecZ1S3T8LC0Ie34uXNFest0JX6TWZ5-VjLoThQSRc-yWTkfZUT9AjA/s1600/untitled.bmp&quot; imageanchor=&quot;1&quot; style=&quot;clear: left; float: left; margin-bottom: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEghFRQriS7HpB3YlTzEy4dUyY6HGVs5iqEDaK7VKjZvGFpBxUOgw3GqskauSxqRYOpE80nESeWLKyQwI18VBXQM1ecZ1S3T8LC0Ie34uXNFest0JX6TWZ5-VjLoThQSRc-yWTkfZUT9AjA/s1600/untitled.bmp&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Done.&lt;/div&gt;
&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='http://rajeshbailwal.blogspot.com/feeds/2317308210295889616/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://rajeshbailwal.blogspot.com/2012/12/getting-month-name-from-any-date.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1331387060948995865/posts/default/2317308210295889616'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1331387060948995865/posts/default/2317308210295889616'/><link rel='alternate' type='text/html' href='http://rajeshbailwal.blogspot.com/2012/12/getting-month-name-from-any-date.html' title='Getting Month name from any date'/><author><name>Rajesh</name><uri>http://www.blogger.com/profile/13411886056681990229</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhfGxMDfbXjdx9s7OivC7Rcz6xWeOZ3XASP1R_IQ-Lo6Md6GFX0AunAdeuDr8tLoTnLCVtmkF8PzkSwQQXOmH3s4k3ZDdGzJSDpB9JMf8nqVmsobp32fByrKK0adOE5ljw/s220/My+Collage.jpg'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEghFRQriS7HpB3YlTzEy4dUyY6HGVs5iqEDaK7VKjZvGFpBxUOgw3GqskauSxqRYOpE80nESeWLKyQwI18VBXQM1ecZ1S3T8LC0Ie34uXNFest0JX6TWZ5-VjLoThQSRc-yWTkfZUT9AjA/s72-c/untitled.bmp" height="72" width="72"/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1331387060948995865.post-2496004736887969460</id><published>2012-12-24T09:47:00.001-08:00</published><updated>2012-12-25T01:26:23.460-08:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="SQL Server"/><title type='text'>Getting Date from Date Time column</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
While using date time fields in WHERE clause you can face one common problem. Most of time you can&#39;t get the records for which you have used the datetime in where clause. For example:&lt;br /&gt;
&lt;div&gt;
&lt;span style=&quot;background-color: #f4f4f4; color: blue; font-family: monospace; font-size: 12px; line-height: 16px; white-space: pre;&quot;&gt;SELECT &lt;/span&gt;&lt;span style=&quot;background-color: #f4f4f4; color: grey; font-family: monospace; font-size: 12px; line-height: 16px; white-space: pre;&quot;&gt;* &lt;/span&gt;&lt;span style=&quot;background-color: #f4f4f4; color: blue; font-family: monospace; font-size: 12px; line-height: 16px; white-space: pre;&quot;&gt;FROM &lt;/span&gt;&lt;span style=&quot;background-color: #f4f4f4; color: black; font-family: monospace; font-size: 12px; line-height: 16px; white-space: pre;&quot;&gt;tTable &lt;/span&gt;&lt;span style=&quot;background-color: #f4f4f4; color: blue; font-family: monospace; font-size: 12px; line-height: 16px; white-space: pre;&quot;&gt;WHERE &lt;/span&gt;&lt;span style=&quot;background-color: #f4f4f4; color: black; font-family: monospace; font-size: 12px; line-height: 16px; white-space: pre;&quot;&gt;DateTimeColumn&lt;/span&gt;&lt;span style=&quot;background-color: #f4f4f4; color: blue; font-family: monospace; font-size: 12px; line-height: 16px; white-space: pre;&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;background-color: #f4f4f4; color: red; font-family: monospace; font-size: 12px; line-height: 16px; white-space: pre;&quot;&gt;&#39;12/24/2012&#39;&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
In this I don&#39;t get the records which have date 12/24/2012, it is because in table the column contains the time also. Then how to GET these records. Its very simple just convert your date time column with below code:&lt;br /&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;div id=&quot;codeSnippetWrapper&quot; style=&quot;background-color: #f4f4f4; border-bottom-color: silver; border-bottom-style: solid; border-bottom-width: 1px; border-left-color: silver; border-left-style: solid; border-left-width: 1px; border-right-color: silver; border-right-style: solid; border-right-width: 1px; border-top-color: silver; border-top-style: solid; border-top-width: 1px; cursor: text; direction: ltr; font-size: 8pt; line-height: 12pt; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; max-height: 400px; overflow-x: auto; overflow-y: auto; padding-bottom: 4px; padding-left: 4px; padding-right: 4px; padding-top: 4px; text-align: left; width: 97.5%;&quot;&gt;
&lt;div id=&quot;codeSnippet&quot; style=&quot;background-color: #f4f4f4; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; direction: ltr; font-size: 8pt; line-height: 12pt; overflow-x: visible; overflow-y: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;
&lt;pre style=&quot;background-color: #f4f4f4; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; direction: ltr; font-size: 8pt; line-height: 12pt; margin-bottom: 0em; margin-left: 0em; margin-right: 0em; margin-top: 0em; overflow-x: visible; overflow-y: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;font-size: 13px; line-height: normal; text-align: -webkit-auto; white-space: normal;&quot;&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;pre style=&quot;font-size: 12px;margin-right: 0em; margin-top: 0em;&quot;&gt;&lt;span style=&quot;color: magenta;&quot;&gt;CAST&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: magenta;&quot;&gt;FLOOR&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;( &lt;/span&gt;&lt;span style=&quot;color: magenta;&quot;&gt;CAST&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;( &lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;SM.DateDownloaded &lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;AS FLOAT &lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;) )&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;AS DATETIME&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;) &lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;AS &lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;DownloadedDate&lt;/span&gt;&lt;/pre&gt;
&lt;/pre&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://rajeshbailwal.blogspot.com/feeds/2496004736887969460/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://rajeshbailwal.blogspot.com/2012/12/using-pivot-you-can-easily-convert-rows.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1331387060948995865/posts/default/2496004736887969460'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1331387060948995865/posts/default/2496004736887969460'/><link rel='alternate' type='text/html' href='http://rajeshbailwal.blogspot.com/2012/12/using-pivot-you-can-easily-convert-rows.html' title='Getting Date from Date Time column'/><author><name>Rajesh</name><uri>http://www.blogger.com/profile/13411886056681990229</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhfGxMDfbXjdx9s7OivC7Rcz6xWeOZ3XASP1R_IQ-Lo6Md6GFX0AunAdeuDr8tLoTnLCVtmkF8PzkSwQQXOmH3s4k3ZDdGzJSDpB9JMf8nqVmsobp32fByrKK0adOE5ljw/s220/My+Collage.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1331387060948995865.post-2480210068328191591</id><published>2012-12-24T09:23:00.000-08:00</published><updated>2012-12-24T09:28:07.202-08:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="SQL Server"/><title type='text'>Converting rows to columns</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;br /&gt;
Using Pivot you can easily convert rows to columns.&lt;br /&gt;
&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;div id=&quot;codeSnippetWrapper&quot; style=&quot;background-color: #f4f4f4; border: 1px solid silver; cursor: text; direction: ltr; line-height: 12pt; margin: 20px 0px 10px; max-height: 200px; overflow: auto; padding: 4px; text-align: left; width: 97.5%;&quot;&gt;
&lt;div id=&quot;codeSnippet&quot; style=&quot;background-color: #f4f4f4; border-style: none; direction: ltr; line-height: 12pt; overflow: visible; padding: 0px; text-align: left; width: 100%;&quot;&gt;
&lt;pre style=&quot;background-color: #f4f4f4; border-style: none; direction: ltr; line-height: 12pt; margin: 0em; overflow: visible; padding: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span style=&quot;color: blue; font-family: Courier New; font-size: x-small;&quot;&gt;&lt;pre style=&quot;font-size: 12px;&quot;&gt;&lt;span style=&quot;color: blue;&quot;&gt;USE &lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;AdventureWorks
GO
&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;SELECT &lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;VendorID&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;, &lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;[164] &lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;AS &lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;Emp1&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;, &lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;[198] &lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;AS &lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;Emp2&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;, &lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;[223] &lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;AS &lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;Emp3&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;, &lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;[231] &lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;AS &lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;Emp4&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;, &lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;[233] &lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;AS &lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;Emp5&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;FROM &lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;SELECT &lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;PurchaseOrderID&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;, &lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;EmployeeID&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;, &lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;VendorID&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;FROM &lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;Purchasing.PurchaseOrderHeader&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;) &lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;p
PIVOT&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: magenta;&quot;&gt;COUNT &lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;PurchaseOrderID&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;FOR &lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;EmployeeID &lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;IN&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;( &lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;[164]&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;, &lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;[198]&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;, &lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;[223]&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;, &lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;[231]&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;, &lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;[233] &lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;)
) &lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;AS &lt;/span&gt;
ORDER BY VendorID
&lt;/pre&gt;
&lt;/span&gt;
&lt;/pre&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;br /&gt;
Enjoy.&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;br /&gt;&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='http://rajeshbailwal.blogspot.com/feeds/2480210068328191591/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://rajeshbailwal.blogspot.com/2012/12/converting-rows-to-columns.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1331387060948995865/posts/default/2480210068328191591'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1331387060948995865/posts/default/2480210068328191591'/><link rel='alternate' type='text/html' href='http://rajeshbailwal.blogspot.com/2012/12/converting-rows-to-columns.html' title='Converting rows to columns'/><author><name>Rajesh</name><uri>http://www.blogger.com/profile/13411886056681990229</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhfGxMDfbXjdx9s7OivC7Rcz6xWeOZ3XASP1R_IQ-Lo6Md6GFX0AunAdeuDr8tLoTnLCVtmkF8PzkSwQQXOmH3s4k3ZDdGzJSDpB9JMf8nqVmsobp32fByrKK0adOE5ljw/s220/My+Collage.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1331387060948995865.post-4852399648633770845</id><published>2012-12-24T09:10:00.002-08:00</published><updated>2012-12-24T09:17:27.471-08:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="SQL Server"/><title type='text'>Finding foriegn key table names which primary key is using in other tables</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;br /&gt;
Finding table names in which a primary key of any table is used as foriegn key.&lt;br /&gt;
&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;div id=&quot;codeSnippetWrapper&quot; style=&quot;background-color: #f4f4f4; border: 1px solid silver; cursor: text; direction: ltr; line-height: 12pt; margin: 20px 0px 10px; max-height: 200px; overflow: auto; padding: 4px; text-align: left; width: 97.5%;&quot;&gt;
&lt;div id=&quot;codeSnippet&quot; style=&quot;background-color: #f4f4f4; border-style: none; direction: ltr; line-height: 12pt; overflow: visible; padding: 0px; text-align: left; width: 100%;&quot;&gt;
&lt;pre style=&quot;background-color: #f4f4f4; border-style: none; direction: ltr; line-height: 12pt; margin: 0em; overflow: visible; padding: 0px; text-align: left; width: 100%;&quot;&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;font-size: 13px; line-height: normal; text-align: -webkit-auto; white-space: normal;&quot;&gt;
&lt;/div&gt;
&lt;span style=&quot;font-family: Courier New; font-size: x-small;&quot;&gt;&lt;pre style=&quot;font-size: 12px;&quot;&gt;&lt;span style=&quot;color: blue;&quot;&gt;SELECT
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;ConstraintName &lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;= &lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;fk.name&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;,
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;TableName &lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;= &lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;t.name&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;,
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;ColumnName &lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;= &lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;c.name&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;FROM
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;sys.foreign_keys fk&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;INNER JOIN 
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;sys.foreign_key_columns fkc &lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;ON &lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;fkc.constraint_object_id &lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;= &lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;fk.&lt;/span&gt;&lt;span style=&quot;color: magenta;&quot;&gt;OBJECT_ID&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;INNER JOIN 
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;sys.tables t &lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;ON &lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;fk.parent_object_id &lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;= &lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;t.&lt;/span&gt;&lt;span style=&quot;color: magenta;&quot;&gt;OBJECT_ID&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;INNER JOIN 
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;sys.columns c &lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;ON &lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;fkc.parent_object_id &lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;= &lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;c.&lt;/span&gt;&lt;span style=&quot;color: magenta;&quot;&gt;OBJECT_ID &lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;AND &lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;fkc.parent_column_id &lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;= &lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;c.column_id&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;INNER JOIN 
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;sys.tables tref &lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;ON &lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;fk.referenced_object_id &lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;= &lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;tref.&lt;/span&gt;&lt;span style=&quot;color: magenta;&quot;&gt;OBJECT_ID&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;INNER JOIN 
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;sys.columns cref &lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;ON &lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;fkc.referenced_object_id &lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;= &lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;cref.&lt;/span&gt;&lt;span style=&quot;color: magenta;&quot;&gt;OBJECT_ID &lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;AND &lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;fkc.referenced_column_id &lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;= &lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;cref.column_id&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;WHERE
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;tref.Name &lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;= &lt;/span&gt;&lt;span style=&quot;color: red;&quot;&gt;&#39;tCurrencyCode&#39;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;AND &lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;cref.Name &lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;= &lt;/span&gt;&lt;span style=&quot;color: red;&quot;&gt;&#39;CurrencyId&#39;&lt;/span&gt;&lt;/pre&gt;
&lt;/span&gt;&lt;/pre&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;br /&gt;
Enjoy.&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='http://rajeshbailwal.blogspot.com/feeds/4852399648633770845/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://rajeshbailwal.blogspot.com/2012/12/finding-foriegn-key-table-names-which.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1331387060948995865/posts/default/4852399648633770845'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1331387060948995865/posts/default/4852399648633770845'/><link rel='alternate' type='text/html' href='http://rajeshbailwal.blogspot.com/2012/12/finding-foriegn-key-table-names-which.html' title='Finding foriegn key table names which primary key is using in other tables'/><author><name>Rajesh</name><uri>http://www.blogger.com/profile/13411886056681990229</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhfGxMDfbXjdx9s7OivC7Rcz6xWeOZ3XASP1R_IQ-Lo6Md6GFX0AunAdeuDr8tLoTnLCVtmkF8PzkSwQQXOmH3s4k3ZDdGzJSDpB9JMf8nqVmsobp32fByrKK0adOE5ljw/s220/My+Collage.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1331387060948995865.post-5334177058235641655</id><published>2012-08-30T22:08:00.002-07:00</published><updated>2012-08-30T22:09:13.605-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="Office 2003 / 2007 / 2010"/><title type='text'>Problem while installing office 2007 / office 2010</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
Hi,&lt;br /&gt;
&lt;br /&gt;
I just faced one problem while installing MS Office 2010 in my laptop. There is office 2001 already installed in m laptop and that was corrupted and I am to install or upgrade office.&lt;br /&gt;
I got the following error during set up:&lt;br /&gt;
&lt;div class=&quot;kb_errormsgbody&quot;&gt;
&lt;div class=&quot;kb_errorcontent&quot;&gt;
&lt;div class=&quot;errormsg&quot;&gt;
&lt;var&gt;Microsoft Office suite_name&lt;/var&gt; encountered an error during setup. &lt;/div&gt;
&lt;div class=&quot;errormsg&quot;&gt;
&amp;nbsp;&lt;/div&gt;
&lt;div class=&quot;errormsg&quot;&gt;
First you have to unistall previous version of office by Microsoft Fix it:&lt;/div&gt;
&lt;div class=&quot;errormsg&quot;&gt;
&amp;nbsp;&lt;/div&gt;
&lt;div class=&quot;errormsg&quot;&gt;
For uninstalling&amp;nbsp;Office 2003: &lt;a href=&quot;http://go.microsoft.com/?linkid=9730793&quot; target=&quot;_blank&quot;&gt;Fix it 2003&lt;/a&gt;&lt;/div&gt;
&lt;div class=&quot;errormsg&quot;&gt;
For uninstalling&amp;nbsp;Office 2007: &lt;a href=&quot;http://go.microsoft.com/?linkid=9669698&quot; target=&quot;_blank&quot;&gt;Fix it 2007&lt;/a&gt;&lt;/div&gt;
&lt;div class=&quot;errormsg&quot;&gt;
For uninstalling&amp;nbsp;Office 2010: &lt;a href=&quot;http://go.microsoft.com/?linkid=9737366&quot; target=&quot;_blank&quot;&gt;Fix it 2010&lt;/a&gt;&lt;/div&gt;
&lt;h4 class=&quot;errormsg&quot; id=&quot;tocHeadRef&quot;&gt;
Now if you try to install again error will be occured. So one more step to go.&lt;/h4&gt;
&lt;div class=&quot;errormsg&quot;&gt;
&lt;b&gt;In Windows XP&lt;/b&gt; &lt;/div&gt;
&lt;div class=&quot;errormsg&quot;&gt;
&lt;ol&gt;
&lt;li&gt;Click &lt;strong class=&quot;uiterm&quot;&gt;Start&lt;/strong&gt;, click &lt;strong class=&quot;uiterm&quot;&gt;Run&lt;/strong&gt;, type &lt;span class=&quot;userInput&quot;&gt;cmd&lt;/span&gt;, and then click &lt;strong class=&quot;uiterm&quot;&gt;OK&lt;/strong&gt;.&lt;/li&gt;
&lt;li&gt;Type &lt;span class=&quot;userInput&quot;&gt;cd &quot;%allusersprofile%\Application Data\Microsoft Help&quot;&lt;/span&gt;, and then press ENTER.&lt;/li&gt;
&lt;li&gt;Type &lt;span class=&quot;userInput&quot;&gt;attrib -h rgstrtn.lck&lt;/span&gt;, and then press ENTER.&lt;/li&gt;
&lt;li&gt;Type &lt;span class=&quot;userInput&quot;&gt;del rgstrtn.lck&lt;/span&gt;, and then press ENTER.&lt;/li&gt;
&lt;li&gt;Type &lt;b&gt;dir /b /od /ad&lt;/b&gt;, and then press ENTER.&lt;/li&gt;
&lt;li&gt;Type &lt;b&gt;rd /q /s&amp;nbsp;&quot;&lt;/b&gt;&lt;var&gt;&amp;lt;folder names&amp;gt;&lt;b&gt;&quot;&lt;/b&gt;,&amp;nbsp;&lt;/var&gt;and then press ENTER.&lt;br /&gt;&lt;b&gt;&lt;br /&gt;Note&lt;/b&gt;&amp;nbsp;The&amp;nbsp;&lt;i&gt;&amp;lt;folder names&amp;gt;&lt;/i&gt;&amp;nbsp;are the folder names that are listed after you run the command in step 5. There should be a space between each folder-name. For example: rd /q /s &quot;foldername1&quot; &quot;foldername2&quot; &quot;foldername3&quot;.&lt;/li&gt;
&lt;li&gt;Type &lt;span class=&quot;userInput&quot;&gt;exit&lt;/span&gt;, and then press ENTER.&lt;/li&gt;
&lt;/ol&gt;
&lt;/div&gt;
&lt;b&gt;In Windows Vista and Windows 7&lt;/b&gt; 
&lt;ol&gt;
&lt;li&gt;Click &lt;strong class=&quot;uiterm&quot;&gt;Start&lt;/strong&gt;, and then type &lt;span class=&quot;userInput&quot;&gt;cmd&lt;/span&gt; in the &lt;strong class=&quot;uiterm&quot;&gt;Start Search&lt;/strong&gt;&amp;nbsp;box, and then click&amp;nbsp;&lt;b&gt;OK&lt;/b&gt;.&lt;/li&gt;
&lt;li&gt;Type &lt;span class=&quot;userInput&quot;&gt;cd &quot;%allusersprofile%\Microsoft Help&quot;&lt;/span&gt;, and then press ENTER,&lt;/li&gt;
&lt;li&gt;Type &lt;span class=&quot;userInput&quot;&gt;attrib -h rgstrtn.lck&lt;/span&gt;, and then press ENTER.&lt;/li&gt;
&lt;li&gt;Type &lt;span class=&quot;userInput&quot;&gt;del rgstrtn.lck&lt;/span&gt;, and then press ENTER.&lt;/li&gt;
&lt;li&gt;Type&amp;nbsp;&lt;b&gt;dir /b /od /ad&lt;/b&gt;, and then press ENTER.&lt;/li&gt;
&lt;li&gt;Type &lt;b&gt;rd /q /s&amp;nbsp;&quot;&lt;/b&gt;&lt;i&gt;&amp;lt;folder names&amp;gt;&lt;b&gt;&quot;&lt;/b&gt;,&amp;nbsp;&lt;/i&gt;and then press ENTER.&lt;br /&gt;&lt;b&gt;&lt;br /&gt;&lt;br /&gt;Note&lt;/b&gt;&amp;nbsp;The&amp;nbsp;&lt;i&gt;&amp;lt;folder names&amp;gt;&lt;/i&gt;&amp;nbsp;are the folder names that are listed after you run the command in step 5. There should be a space between each folder-name. For example: rd /q /s &quot;foldername1&quot; &quot;foldername2&quot; &quot;foldername3&quot;&lt;/li&gt;
&lt;li&gt;Type &lt;span class=&quot;userInput&quot;&gt;exit&lt;/span&gt;, and then press ENTER.&lt;/li&gt;
&lt;/ol&gt;
&lt;strong&gt;Thats it!!&lt;/strong&gt;&lt;br /&gt;
&lt;strong&gt;Now you can instally any version of Office in your pc. Enjoy!!!!!&lt;/strong&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='http://rajeshbailwal.blogspot.com/feeds/5334177058235641655/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://rajeshbailwal.blogspot.com/2012/08/problem-while-installing-office-2007.html#comment-form' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1331387060948995865/posts/default/5334177058235641655'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1331387060948995865/posts/default/5334177058235641655'/><link rel='alternate' type='text/html' href='http://rajeshbailwal.blogspot.com/2012/08/problem-while-installing-office-2007.html' title='Problem while installing office 2007 / office 2010'/><author><name>Rajesh</name><uri>http://www.blogger.com/profile/13411886056681990229</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhfGxMDfbXjdx9s7OivC7Rcz6xWeOZ3XASP1R_IQ-Lo6Md6GFX0AunAdeuDr8tLoTnLCVtmkF8PzkSwQQXOmH3s4k3ZDdGzJSDpB9JMf8nqVmsobp32fByrKK0adOE5ljw/s220/My+Collage.jpg'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1331387060948995865.post-1455260005887506834</id><published>2012-03-31T08:40:00.000-07:00</published><updated>2012-03-31T08:41:06.818-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="C#"/><title type='text'>Machine Key for Load  Balancing</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
In my project there is requirement to change the field length eg CompanyCode. Problem is with this field name there are many tables who not created the foriegn keys and this field is used in many procedures and functions. To find the text company code I found this simple code:
&lt;br /&gt;
&lt;div id=&quot;codeSnippetWrapper&quot; style=&quot;background-color: #f4f4f4; border-bottom-color: silver; border-bottom-style: solid; border-bottom-width: 1px; border-left-color: silver; border-left-style: solid; border-left-width: 1px; border-right-color: silver; border-right-style: solid; border-right-width: 1px; border-top-color: silver; border-top-style: solid; border-top-width: 1px; cursor: text; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin-bottom: 10px; margin-left: 0px; margin-right: 0px; margin-top: 20px; max-height: 350px; overflow-x: auto; overflow-y: auto; padding-bottom: 4px; padding-left: 4px; padding-right: 4px; padding-top: 4px; width: 97.5%;&quot;&gt;
&lt;div id=&quot;codeSnippet&quot; style=&quot;border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; direction: ltr; font-size: 8pt; line-height: 12pt; overflow-x: visible; overflow-y: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; width: 100%;&quot;&gt;
&lt;pre style=&quot;border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin-bottom: 0em; margin-left: 0em; margin-right: 0em; margin-top: 0em; overflow-x: visible; overflow-y: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; width: 100%;&quot;&gt;&lt;pre style=&quot;line-height: normal; text-align: -webkit-auto; white-space: pre-wrap; word-wrap: break-word;&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;
&lt;pre&gt;&lt;span style=&quot;color: #007020;&quot;&gt;&lt;b&gt;&lt;pre style=&quot;background: color: black;&quot;&gt;&lt;span style=&quot;color: dimgrey;&quot;&gt;/// &amp;lt;summary&amp;gt;&lt;/span&gt;
&lt;span style=&quot;color: dimgrey;&quot;&gt;/// Version arguments to MachineKey.Generate() method.&lt;/span&gt;
&lt;span style=&quot;color: dimgrey;&quot;&gt;/// &amp;lt;/summary&amp;gt;&lt;/span&gt;
&lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;public&lt;/span&gt; &lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;enum&lt;/span&gt; MachineKeyVersion
&lt;span style=&quot;color: purple;&quot;&gt;{&lt;/span&gt;
    &lt;span style=&quot;color: dimgrey;&quot;&gt;/// &amp;lt;summary&amp;gt;&lt;/span&gt;
    &lt;span style=&quot;color: dimgrey;&quot;&gt;/// .NET version 1.1.&lt;/span&gt;
    &lt;span style=&quot;color: dimgrey;&quot;&gt;/// &amp;lt;/summary&amp;gt;&lt;/span&gt;
    Net1&lt;span style=&quot;color: #808030;&quot;&gt;,&lt;/span&gt;

    &lt;span style=&quot;color: dimgrey;&quot;&gt;/// &amp;lt;summary&amp;gt;&lt;/span&gt;
    &lt;span style=&quot;color: dimgrey;&quot;&gt;/// .NET version 2.0 and up.&lt;/span&gt;
    &lt;span style=&quot;color: dimgrey;&quot;&gt;/// &amp;lt;/summary&amp;gt;&lt;/span&gt;
    Net2&lt;span style=&quot;color: #808030;&quot;&gt;,&lt;/span&gt;
&lt;span style=&quot;color: purple;&quot;&gt;}&lt;/span&gt;

&lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;public&lt;/span&gt; &lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;class&lt;/span&gt; MachineKey
&lt;span style=&quot;color: purple;&quot;&gt;{&lt;/span&gt;
    &lt;span style=&quot;color: dimgrey;&quot;&gt;/// &amp;lt;summary&amp;gt;&lt;/span&gt;
    &lt;span style=&quot;color: dimgrey;&quot;&gt;/// Generates the contents of a machineKey element suitable for use in&lt;/span&gt;
    &lt;span style=&quot;color: dimgrey;&quot;&gt;/// an ASP.NET web.config file.&lt;/span&gt;
    &lt;span style=&quot;color: dimgrey;&quot;&gt;/// &amp;lt;/summary&amp;gt;&lt;/span&gt;
    &lt;span style=&quot;color: dimgrey;&quot;&gt;/// &amp;lt;param name=&quot;version&quot;&amp;gt;Indicates if keys should be generated for&lt;/span&gt;
    &lt;span style=&quot;color: dimgrey;&quot;&gt;/// ASP.NET 1.1 or 2.0 and later.&amp;lt;/param&amp;gt;&lt;/span&gt;
    &lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;public&lt;/span&gt; &lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;static&lt;/span&gt; &lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;string&lt;/span&gt; Generate&lt;span style=&quot;color: #808030;&quot;&gt;(&lt;/span&gt;MachineKeyVersion version&lt;span style=&quot;color: #808030;&quot;&gt;)&lt;/span&gt;
    &lt;span style=&quot;color: purple;&quot;&gt;{&lt;/span&gt;
        &lt;span style=&quot;color: dimgrey;&quot;&gt;// Generate keys&lt;/span&gt;
        &lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;string&lt;/span&gt; validationKey &lt;span style=&quot;color: #808030;&quot;&gt;=&lt;/span&gt; GenerateKey&lt;span style=&quot;color: #808030;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #008c00;&quot;&gt;64&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;
        &lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;string&lt;/span&gt; decryptionKey&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;
        &lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;if&lt;/span&gt; &lt;span style=&quot;color: #808030;&quot;&gt;(&lt;/span&gt;version &lt;span style=&quot;color: #808030;&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;=&lt;/span&gt; MachineKeyVersion&lt;span style=&quot;color: #808030;&quot;&gt;.&lt;/span&gt;Net1&lt;span style=&quot;color: #808030;&quot;&gt;)&lt;/span&gt;
            decryptionKey &lt;span style=&quot;color: #808030;&quot;&gt;=&lt;/span&gt; GenerateKey&lt;span style=&quot;color: #808030;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #008c00;&quot;&gt;24&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;
        &lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;else&lt;/span&gt;
            decryptionKey &lt;span style=&quot;color: #808030;&quot;&gt;=&lt;/span&gt; GenerateKey&lt;span style=&quot;color: #808030;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #008c00;&quot;&gt;32&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;

        &lt;span style=&quot;color: dimgrey;&quot;&gt;// Construct &amp;lt;machineKey&amp;gt; tag&lt;/span&gt;
        StringBuilder builder &lt;span style=&quot;color: #808030;&quot;&gt;=&lt;/span&gt; &lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;new&lt;/span&gt; StringBuilder&lt;span style=&quot;color: #808030;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;
        builder&lt;span style=&quot;color: #808030;&quot;&gt;.&lt;/span&gt;Append&lt;span style=&quot;color: #808030;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: maroon;&quot;&gt;&quot;&lt;/span&gt;&lt;span style=&quot;color: #0000e6;&quot;&gt;&amp;lt;machineKey&lt;/span&gt;&lt;span style=&quot;color: maroon;&quot;&gt;&quot;&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;
        builder&lt;span style=&quot;color: #808030;&quot;&gt;.&lt;/span&gt;AppendFormat&lt;span style=&quot;color: #808030;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: maroon;&quot;&gt;&quot;&lt;/span&gt;&lt;span style=&quot;color: #0000e6;&quot;&gt; validationKey=\&quot;{0}\&quot;&lt;/span&gt;&lt;span style=&quot;color: maroon;&quot;&gt;&quot;&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;,&lt;/span&gt; validationKey&lt;span style=&quot;color: #808030;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;
        builder&lt;span style=&quot;color: #808030;&quot;&gt;.&lt;/span&gt;AppendFormat&lt;span style=&quot;color: #808030;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: maroon;&quot;&gt;&quot;&lt;/span&gt;&lt;span style=&quot;color: #0000e6;&quot;&gt; decryptionKey=\&quot;{0}\&quot;&lt;/span&gt;&lt;span style=&quot;color: maroon;&quot;&gt;&quot;&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;,&lt;/span&gt; decryptionKey&lt;span style=&quot;color: #808030;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;
        builder&lt;span style=&quot;color: #808030;&quot;&gt;.&lt;/span&gt;Append&lt;span style=&quot;color: #808030;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: maroon;&quot;&gt;&quot;&lt;/span&gt;&lt;span style=&quot;color: #0000e6;&quot;&gt; validation=\&quot;SHA1\&quot;&lt;/span&gt;&lt;span style=&quot;color: maroon;&quot;&gt;&quot;&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;
        &lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;if&lt;/span&gt; &lt;span style=&quot;color: #808030;&quot;&gt;(&lt;/span&gt;version &lt;span style=&quot;color: #808030;&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;=&lt;/span&gt; MachineKeyVersion&lt;span style=&quot;color: #808030;&quot;&gt;.&lt;/span&gt;Net2&lt;span style=&quot;color: #808030;&quot;&gt;)&lt;/span&gt;
            builder&lt;span style=&quot;color: #808030;&quot;&gt;.&lt;/span&gt;Append&lt;span style=&quot;color: #808030;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: maroon;&quot;&gt;&quot;&lt;/span&gt;&lt;span style=&quot;color: #0000e6;&quot;&gt; decryption=\&quot;AES\&quot;&lt;/span&gt;&lt;span style=&quot;color: maroon;&quot;&gt;&quot;&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;
        builder&lt;span style=&quot;color: #808030;&quot;&gt;.&lt;/span&gt;Append&lt;span style=&quot;color: #808030;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: maroon;&quot;&gt;&quot;&lt;/span&gt;&lt;span style=&quot;color: #0000e6;&quot;&gt; /&amp;gt;&lt;/span&gt;&lt;span style=&quot;color: maroon;&quot;&gt;&quot;&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;
        &lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;return&lt;/span&gt; builder&lt;span style=&quot;color: #808030;&quot;&gt;.&lt;/span&gt;ToString&lt;span style=&quot;color: #808030;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;
    &lt;span style=&quot;color: purple;&quot;&gt;}&lt;/span&gt;

    &lt;span style=&quot;color: dimgrey;&quot;&gt;/// &amp;lt;summary&amp;gt;&lt;/span&gt;
    &lt;span style=&quot;color: dimgrey;&quot;&gt;/// Generates a string of random hex digits of the specified&lt;/span&gt;
    &lt;span style=&quot;color: dimgrey;&quot;&gt;/// number of bytes.&lt;/span&gt;
    &lt;span style=&quot;color: dimgrey;&quot;&gt;/// &amp;lt;/summary&amp;gt;&lt;/span&gt;
    &lt;span style=&quot;color: dimgrey;&quot;&gt;/// &amp;lt;param name=&quot;length&quot;&amp;gt;Number of bytes to generate&amp;lt;/param&amp;gt;&lt;/span&gt;
    &lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;protected&lt;/span&gt; &lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;static&lt;/span&gt; &lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;string&lt;/span&gt; GenerateKey&lt;span style=&quot;color: #808030;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;int&lt;/span&gt; length&lt;span style=&quot;color: #808030;&quot;&gt;)&lt;/span&gt;
    &lt;span style=&quot;color: purple;&quot;&gt;{&lt;/span&gt;
        RNGCryptoServiceProvider rngCsp &lt;span style=&quot;color: #808030;&quot;&gt;=&lt;/span&gt; &lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;new&lt;/span&gt; RNGCryptoServiceProvider&lt;span style=&quot;color: #808030;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;
        &lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;byte&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;[&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;]&lt;/span&gt; buff &lt;span style=&quot;color: #808030;&quot;&gt;=&lt;/span&gt; &lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;new&lt;/span&gt; &lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;byte&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;[&lt;/span&gt;length&lt;span style=&quot;color: #808030;&quot;&gt;]&lt;/span&gt;&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;
        rngCsp&lt;span style=&quot;color: #808030;&quot;&gt;.&lt;/span&gt;GetBytes&lt;span style=&quot;color: #808030;&quot;&gt;(&lt;/span&gt;buff&lt;span style=&quot;color: #808030;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;
        StringBuilder sb &lt;span style=&quot;color: #808030;&quot;&gt;=&lt;/span&gt; &lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;new&lt;/span&gt; StringBuilder&lt;span style=&quot;color: #808030;&quot;&gt;(&lt;/span&gt;buff&lt;span style=&quot;color: #808030;&quot;&gt;.&lt;/span&gt;Length &lt;span style=&quot;color: #808030;&quot;&gt;*&lt;/span&gt; &lt;span style=&quot;color: #008c00;&quot;&gt;2&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;
        &lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;for&lt;/span&gt; &lt;span style=&quot;color: #808030;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;int&lt;/span&gt; i &lt;span style=&quot;color: #808030;&quot;&gt;=&lt;/span&gt; &lt;span style=&quot;color: #008c00;&quot;&gt;0&lt;/span&gt;&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt; i &lt;span style=&quot;color: #808030;&quot;&gt;&amp;lt;&lt;/span&gt; buff&lt;span style=&quot;color: #808030;&quot;&gt;.&lt;/span&gt;Length&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt; i&lt;span style=&quot;color: #808030;&quot;&gt;+&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;+&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;)&lt;/span&gt;
            sb&lt;span style=&quot;color: #808030;&quot;&gt;.&lt;/span&gt;Append&lt;span style=&quot;color: #808030;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;string&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;.&lt;/span&gt;Format&lt;span style=&quot;color: #808030;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: maroon;&quot;&gt;&quot;&lt;/span&gt;&lt;span style=&quot;color: #0000e6;&quot;&gt;{0:X2}&lt;/span&gt;&lt;span style=&quot;color: maroon;&quot;&gt;&quot;&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;,&lt;/span&gt; buff&lt;span style=&quot;color: #808030;&quot;&gt;[&lt;/span&gt;i&lt;span style=&quot;color: #808030;&quot;&gt;]&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;
        &lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;return&lt;/span&gt; sb&lt;span style=&quot;color: #808030;&quot;&gt;.&lt;/span&gt;ToString&lt;span style=&quot;color: #808030;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #808030;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;
    &lt;span style=&quot;color: purple;&quot;&gt;}&lt;/span&gt;
&lt;span style=&quot;color: purple;&quot;&gt;}&lt;/span&gt;&lt;/pre&gt;
&lt;/b&gt;&lt;/span&gt;&lt;/pre&gt;
&lt;/div&gt;
&lt;/pre&gt;
&lt;/pre&gt;
&lt;/div&gt;
&lt;/div&gt;
Now just call the MachineKey.Generate method&lt;br /&gt;
&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;div id=&quot;codeSnippetWrapper&quot; style=&quot;background-color: #f4f4f4; border-bottom-color: silver; border-bottom-style: solid; border-bottom-width: 1px; border-left-color: silver; border-left-style: solid; border-left-width: 1px; border-right-color: silver; border-right-style: solid; border-right-width: 1px; border-top-color: silver; border-top-style: solid; border-top-width: 1px; cursor: text; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin-bottom: 10px; margin-left: 0px; margin-right: 0px; margin-top: 20px; max-height: 350px; overflow-x: auto; overflow-y: auto; padding-bottom: 4px; padding-left: 4px; padding-right: 4px; padding-top: 4px; width: 97.5%;&quot;&gt;
&lt;div id=&quot;codeSnippet&quot; style=&quot;border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; direction: ltr; font-size: 8pt; line-height: 12pt; overflow-x: visible; overflow-y: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; width: 100%;&quot;&gt;
&lt;pre style=&quot;border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin-bottom: 0em; margin-left: 0em; margin-right: 0em; margin-top: 0em; overflow-x: visible; overflow-y: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; width: 100%;&quot;&gt;&lt;pre style=&quot;line-height: normal; text-align: -webkit-auto; white-space: pre-wrap; word-wrap: break-word;&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;
&lt;pre&gt;&lt;span style=&quot;color: #007020;&quot;&gt;&lt;b&gt;&lt;pre style=&quot;background: color: black;&quot;&gt;&lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;private&lt;/span&gt; &lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;void&lt;/span&gt; btnGenerate_Click&lt;span style=&quot;color: #808030;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;object&lt;/span&gt; sender&lt;span style=&quot;color: #808030;&quot;&gt;,&lt;/span&gt; EventArgs e&lt;span style=&quot;color: #808030;&quot;&gt;)&lt;/span&gt;
&lt;span style=&quot;color: purple;&quot;&gt;{&lt;/span&gt;
    MachineKeyVersion version&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;

    &lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;if&lt;/span&gt; &lt;span style=&quot;color: #808030;&quot;&gt;(&lt;/span&gt;radNet1&lt;span style=&quot;color: #808030;&quot;&gt;.&lt;/span&gt;Checked&lt;span style=&quot;color: #808030;&quot;&gt;)&lt;/span&gt;
        version &lt;span style=&quot;color: #808030;&quot;&gt;=&lt;/span&gt; MachineKeyVersion&lt;span style=&quot;color: #808030;&quot;&gt;.&lt;/span&gt;Net1&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;
    &lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;else&lt;/span&gt;
        version &lt;span style=&quot;color: #808030;&quot;&gt;=&lt;/span&gt; MachineKeyVersion&lt;span style=&quot;color: #808030;&quot;&gt;.&lt;/span&gt;Net2&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;

    txtMachineKey&lt;span style=&quot;color: #808030;&quot;&gt;.&lt;/span&gt;Text &lt;span style=&quot;color: #808030;&quot;&gt;=&lt;/span&gt; MachineKey&lt;span style=&quot;color: #808030;&quot;&gt;.&lt;/span&gt;Generate&lt;span style=&quot;color: #808030;&quot;&gt;(&lt;/span&gt;version&lt;span style=&quot;color: #808030;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: purple;&quot;&gt;;&lt;/span&gt;
&lt;span style=&quot;color: purple;&quot;&gt;}&lt;/span&gt;&lt;/pre&gt;
&lt;/b&gt;&lt;/span&gt;&lt;/pre&gt;
&lt;/div&gt;
&lt;/pre&gt;
&lt;/pre&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;br /&gt;
Reference:&amp;nbsp;&lt;a href=&quot;http://www.blackbeltcoder.com/Articles/asp/generating-a-machinekey-element&quot;&gt;http://www.blackbeltcoder.com/Articles/asp/generating-a-machinekey-element&lt;/a&gt;&amp;nbsp;&lt;/div&gt;
&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://rajeshbailwal.blogspot.com/feeds/1455260005887506834/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://rajeshbailwal.blogspot.com/2012/03/machine-key-for-load-balancing.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1331387060948995865/posts/default/1455260005887506834'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1331387060948995865/posts/default/1455260005887506834'/><link rel='alternate' type='text/html' href='http://rajeshbailwal.blogspot.com/2012/03/machine-key-for-load-balancing.html' title='Machine Key for Load  Balancing'/><author><name>Rajesh</name><uri>http://www.blogger.com/profile/13411886056681990229</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhfGxMDfbXjdx9s7OivC7Rcz6xWeOZ3XASP1R_IQ-Lo6Md6GFX0AunAdeuDr8tLoTnLCVtmkF8PzkSwQQXOmH3s4k3ZDdGzJSDpB9JMf8nqVmsobp32fByrKK0adOE5ljw/s220/My+Collage.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1331387060948995865.post-8969006461320294695</id><published>2012-03-22T22:51:00.001-07:00</published><updated>2012-03-31T08:41:01.719-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="SQL Server"/><title type='text'>Searching Text in Procedures, Tables and Functions</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
In my project there is requirement to change the field length eg CompanyCode. Problem is with this field name there are many tables who not created the foriegn keys and this field is used in many procedures and functions. To find the text company code I found this simple code:
&lt;br /&gt;
&lt;br /&gt;
&lt;div id=&quot;codeSnippetWrapper&quot; style=&quot;background-color: #f4f4f4; border-bottom-color: silver; border-bottom-style: solid; border-bottom-width: 1px; border-left-color: silver; border-left-style: solid; border-left-width: 1px; border-right-color: silver; border-right-style: solid; border-right-width: 1px; border-top-color: silver; border-top-style: solid; border-top-width: 1px; cursor: text; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin-bottom: 10px; margin-left: 0px; margin-right: 0px; margin-top: 20px; max-height: 350px; overflow-x: auto; overflow-y: auto; padding-bottom: 4px; padding-left: 4px; padding-right: 4px; padding-top: 4px; width: 97.5%;&quot;&gt;
&lt;div id=&quot;codeSnippet&quot; style=&quot;border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; direction: ltr; font-size: 8pt; line-height: 12pt; overflow-x: visible; overflow-y: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; width: 100%;&quot;&gt;
&lt;pre style=&quot;border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin-bottom: 0em; margin-left: 0em; margin-right: 0em; margin-top: 0em; overflow-x: visible; overflow-y: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; width: 100%;&quot;&gt;&lt;pre style=&quot;line-height: normal; text-align: -webkit-auto; white-space: pre-wrap; word-wrap: break-word;&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;
&lt;pre&gt;&lt;span style=&quot;color: #007020; font-weight: bold;&quot;&gt;CREATE&lt;/span&gt; &lt;span style=&quot;color: #007020; font-weight: bold;&quot;&gt;PROCEDURE&lt;/span&gt; adhoc_SearchText(&lt;span style=&quot;color: #666666;&quot;&gt;@&lt;/span&gt;&lt;span style=&quot;color: #007020;&quot;&gt;text&lt;/span&gt; &lt;span style=&quot;color: #007020;&quot;&gt;VARCHAR&lt;/span&gt;(&lt;span style=&quot;color: #40a070;&quot;&gt;1024&lt;/span&gt;))
&lt;span style=&quot;color: #007020; font-weight: bold;&quot;&gt;AS&lt;/span&gt;
&lt;span style=&quot;color: #007020; font-weight: bold;&quot;&gt;BEGIN&lt;/span&gt;
 &lt;span style=&quot;color: #60a0b0; font-style: italic;&quot;&gt;-- tables&lt;/span&gt;
&lt;span style=&quot;color: #60a0b0; font-style: italic;&quot;&gt;&lt;/span&gt; &lt;span style=&quot;color: #007020; font-weight: bold;&quot;&gt;SELECT&lt;/span&gt;
  &lt;span style=&quot;color: #007020; font-weight: bold;&quot;&gt;TABLE_NAME&lt;/span&gt;
 &lt;span style=&quot;color: #007020; font-weight: bold;&quot;&gt;FROM&lt;/span&gt;
  INFORMATION_SCHEMA.TABLES T
 &lt;span style=&quot;color: #007020; font-weight: bold;&quot;&gt;WHERE&lt;/span&gt;
  charindex(&lt;span style=&quot;color: #666666;&quot;&gt;@&lt;/span&gt;&lt;span style=&quot;color: #007020;&quot;&gt;text&lt;/span&gt;, T.&lt;span style=&quot;color: #007020; font-weight: bold;&quot;&gt;TABLE_NAME&lt;/span&gt;)&lt;span style=&quot;color: #666666;&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span style=&quot;color: #40a070;&quot;&gt;0&lt;/span&gt;
  
 &lt;span style=&quot;color: #60a0b0; font-style: italic;&quot;&gt;-- columns&lt;/span&gt;
&lt;span style=&quot;color: #60a0b0; font-style: italic;&quot;&gt;&lt;/span&gt; &lt;span style=&quot;color: #007020; font-weight: bold;&quot;&gt;SELECT&lt;/span&gt; 
  &lt;span style=&quot;color: #007020; font-weight: bold;&quot;&gt;C&lt;/span&gt;.&lt;span style=&quot;color: #007020; font-weight: bold;&quot;&gt;TABLE_NAME&lt;/span&gt;, &lt;span style=&quot;color: #007020; font-weight: bold;&quot;&gt;C&lt;/span&gt;.&lt;span style=&quot;color: #007020; font-weight: bold;&quot;&gt;COLUMN_NAME&lt;/span&gt;
 &lt;span style=&quot;color: #007020; font-weight: bold;&quot;&gt;FROM&lt;/span&gt;
  INFORMATION_SCHEMA.COLUMNS &lt;span style=&quot;color: #007020; font-weight: bold;&quot;&gt;C&lt;/span&gt;
 &lt;span style=&quot;color: #007020; font-weight: bold;&quot;&gt;WHERE&lt;/span&gt;
  charindex(&lt;span style=&quot;color: #666666;&quot;&gt;@&lt;/span&gt;&lt;span style=&quot;color: #007020;&quot;&gt;text&lt;/span&gt;, &lt;span style=&quot;color: #007020; font-weight: bold;&quot;&gt;C&lt;/span&gt;.&lt;span style=&quot;color: #007020; font-weight: bold;&quot;&gt;COLUMN_NAME&lt;/span&gt;)&lt;span style=&quot;color: #666666;&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span style=&quot;color: #40a070;&quot;&gt;0&lt;/span&gt;

 &lt;span style=&quot;color: #60a0b0; font-style: italic;&quot;&gt;-- views&lt;/span&gt;
&lt;span style=&quot;color: #60a0b0; font-style: italic;&quot;&gt;&lt;/span&gt; &lt;span style=&quot;color: #007020; font-weight: bold;&quot;&gt;SELECT&lt;/span&gt; 
  V.&lt;span style=&quot;color: #007020; font-weight: bold;&quot;&gt;TABLE_NAME&lt;/span&gt; &lt;span style=&quot;color: #007020; font-weight: bold;&quot;&gt;AS&lt;/span&gt; VIEW_NAME
 &lt;span style=&quot;color: #007020; font-weight: bold;&quot;&gt;FROM&lt;/span&gt; 
  information_schema.VIEWS V
 &lt;span style=&quot;color: #007020; font-weight: bold;&quot;&gt;WHERE&lt;/span&gt; 
  charindex(&lt;span style=&quot;color: #666666;&quot;&gt;@&lt;/span&gt;&lt;span style=&quot;color: #007020;&quot;&gt;text&lt;/span&gt;, V.VIEW_DEFINITION)&lt;span style=&quot;color: #666666;&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span style=&quot;color: #40a070;&quot;&gt;0&lt;/span&gt;
  
 &lt;span style=&quot;color: #60a0b0; font-style: italic;&quot;&gt;-- stored procs&lt;/span&gt;
&lt;span style=&quot;color: #60a0b0; font-style: italic;&quot;&gt;&lt;/span&gt; &lt;span style=&quot;color: #007020; font-weight: bold;&quot;&gt;SELECT&lt;/span&gt; 
  R.&lt;span style=&quot;color: #007020; font-weight: bold;&quot;&gt;ROUTINE_NAME&lt;/span&gt; 
 &lt;span style=&quot;color: #007020; font-weight: bold;&quot;&gt;FROM&lt;/span&gt; 
  information_schema.routines r 
 &lt;span style=&quot;color: #007020; font-weight: bold;&quot;&gt;WHERE&lt;/span&gt; 
  charindex(&lt;span style=&quot;color: #666666;&quot;&gt;@&lt;/span&gt;&lt;span style=&quot;color: #007020;&quot;&gt;text&lt;/span&gt;, r.ROUTINE_DEFINITION)&lt;span style=&quot;color: #666666;&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span style=&quot;color: #40a070;&quot;&gt;0&lt;/span&gt;
&lt;span style=&quot;color: #007020; font-weight: bold;&quot;&gt;END&lt;/span&gt;&lt;/pre&gt;
&lt;/div&gt;
&lt;/pre&gt;
&lt;/pre&gt;
&lt;/div&gt;
&lt;/div&gt;
Hope this helps you!!!!!&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://rajeshbailwal.blogspot.com/feeds/8969006461320294695/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://rajeshbailwal.blogspot.com/2012/03/in-my-project-there-is-requirement-to.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1331387060948995865/posts/default/8969006461320294695'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1331387060948995865/posts/default/8969006461320294695'/><link rel='alternate' type='text/html' href='http://rajeshbailwal.blogspot.com/2012/03/in-my-project-there-is-requirement-to.html' title='Searching Text in Procedures, Tables and Functions'/><author><name>Rajesh</name><uri>http://www.blogger.com/profile/13411886056681990229</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhfGxMDfbXjdx9s7OivC7Rcz6xWeOZ3XASP1R_IQ-Lo6Md6GFX0AunAdeuDr8tLoTnLCVtmkF8PzkSwQQXOmH3s4k3ZDdGzJSDpB9JMf8nqVmsobp32fByrKK0adOE5ljw/s220/My+Collage.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1331387060948995865.post-627296743808447267</id><published>2012-03-20T01:52:00.001-07:00</published><updated>2012-03-20T02:03:55.130-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="C#"/><title type='text'>Password in C# Console Application</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
Today my friend ask me how to make password field in C# Console Application.&lt;br /&gt;
I found the simple solution:&lt;br /&gt;
&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;div id=&quot;codeSnippetWrapper&quot; style=&quot;background-color: #f4f4f4; border-bottom-color: silver; border-bottom-style: solid; border-bottom-width: 1px; border-left-color: silver; border-left-style: solid; border-left-width: 1px; border-right-color: silver; border-right-style: solid; border-right-width: 1px; border-top-color: silver; border-top-style: solid; border-top-width: 1px; cursor: text; direction: ltr; font-size: 8pt; line-height: 12pt; margin-bottom: 10px; margin-left: 0px; margin-right: 0px; margin-top: 20px; max-height: 400px; overflow-x: auto; overflow-y: auto; padding-bottom: 4px; padding-left: 4px; padding-right: 4px; padding-top: 4px; text-align: left; width: 97.5%;&quot;&gt;
&lt;div id=&quot;codeSnippet&quot; style=&quot;background-color: #f4f4f4; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; direction: ltr; font-size: 8pt; line-height: 12pt; overflow-x: visible; overflow-y: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;
&lt;pre style=&quot;background-color: #f4f4f4; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; direction: ltr; font-size: 8pt; line-height: 12pt; margin-bottom: 0em; margin-left: 0em; margin-right: 0em; margin-top: 0em; overflow-x: visible; overflow-y: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;font-size: 13px; line-height: normal; text-align: -webkit-auto; white-space: normal;&quot;&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span style=&quot;color: blue; font-family: &#39;Courier New&#39;; font-size: 10pt;&quot;&gt;class&lt;/span&gt;&lt;span style=&quot;font-family: &#39;Courier New&#39;; font-size: 10pt;&quot;&gt; &lt;span style=&quot;color: #2b91af;&quot;&gt;PasswordExample&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span style=&quot;font-family: &#39;Courier New&#39;; font-size: 10pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span style=&quot;font-family: &#39;Courier New&#39;; font-size: 10pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style=&quot;color: blue;&quot;&gt;static&lt;/span&gt; &lt;span style=&quot;color: blue;&quot;&gt;void&lt;/span&gt; &lt;st1:place w:st=&quot;on&quot;&gt;Main&lt;/st1:place&gt;(&lt;span style=&quot;color: blue;&quot;&gt;string&lt;/span&gt;[] args)&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span style=&quot;font-family: &#39;Courier New&#39;; font-size: 10pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span style=&quot;font-family: &#39;Courier New&#39;; font-size: 10pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style=&quot;color: #2b91af;&quot;&gt;Console&lt;/span&gt;.WriteLine(&lt;span style=&quot;color: #a31515;&quot;&gt;&quot;Pls key in your Login ID&quot;&lt;/span&gt;);&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span style=&quot;font-family: &#39;Courier New&#39;; font-size: 10pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style=&quot;color: blue;&quot;&gt;var&lt;/span&gt;
loginid = &lt;span style=&quot;color: #2b91af;&quot;&gt;Console&lt;/span&gt;.ReadLine();&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span style=&quot;font-family: &#39;Courier New&#39;; font-size: 10pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style=&quot;color: #2b91af;&quot;&gt;Console&lt;/span&gt;.WriteLine(&lt;span style=&quot;color: #a31515;&quot;&gt;&quot;Pls key in your Password&quot;&lt;/span&gt;);&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span style=&quot;font-family: &#39;Courier New&#39;; font-size: 10pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style=&quot;color: blue;&quot;&gt;var&lt;/span&gt;
password = ReadPassword();&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span style=&quot;font-family: &#39;Courier New&#39;; font-size: 10pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style=&quot;color: #2b91af;&quot;&gt;Console&lt;/span&gt;.Write(&lt;span style=&quot;color: #a31515;&quot;&gt;&quot;Your Password is:&quot;&lt;/span&gt; + password);&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span style=&quot;font-family: &#39;Courier New&#39;; font-size: 10pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style=&quot;color: #2b91af;&quot;&gt;Console&lt;/span&gt;.ReadLine();&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;span style=&quot;font-family: &#39;Courier New&#39;; font-size: 10pt;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;font-family: &#39;Courier New&#39;; font-size: 10pt;&quot;&gt;}&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span style=&quot;color: blue; font-family: &#39;Courier New&#39;; font-size: 10pt;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span style=&quot;color: blue; font-family: &#39;Courier New&#39;; font-size: 10pt;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;public&lt;/span&gt;&lt;span style=&quot;font-family: &#39;Courier New&#39;; font-size: 10pt;&quot;&gt; &lt;span style=&quot;color: blue;&quot;&gt;static&lt;/span&gt; &lt;span style=&quot;color: blue;&quot;&gt;string&lt;/span&gt;
ReadPassword()&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span style=&quot;font-family: &#39;Courier New&#39;; font-size: 10pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span style=&quot;font-family: &#39;Courier New&#39;; font-size: 10pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style=&quot;color: blue;&quot;&gt;string&lt;/span&gt;
password = &lt;span style=&quot;color: #a31515;&quot;&gt;&quot;&quot;&lt;/span&gt;;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span style=&quot;font-family: &#39;Courier New&#39;; font-size: 10pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style=&quot;color: #2b91af;&quot;&gt;ConsoleKeyInfo&lt;/span&gt;
info = &lt;span style=&quot;color: #2b91af;&quot;&gt;Console&lt;/span&gt;.ReadKey(&lt;span style=&quot;color: blue;&quot;&gt;true&lt;/span&gt;);&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span style=&quot;font-family: &#39;Courier New&#39;; font-size: 10pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style=&quot;color: blue;&quot;&gt;while&lt;/span&gt;
(info.Key != &lt;span style=&quot;color: #2b91af;&quot;&gt;ConsoleKey&lt;/span&gt;.Enter)&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span style=&quot;font-family: &#39;Courier New&#39;; font-size: 10pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span style=&quot;font-family: &#39;Courier New&#39;; font-size: 10pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style=&quot;color: blue;&quot;&gt;if&lt;/span&gt;
(info.Key != &lt;span style=&quot;color: #2b91af;&quot;&gt;ConsoleKey&lt;/span&gt;.Backspace)&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span style=&quot;font-family: &#39;Courier New&#39;; font-size: 10pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span style=&quot;font-family: &#39;Courier New&#39;; font-size: 10pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style=&quot;color: #2b91af;&quot;&gt;Console&lt;/span&gt;.Write(&lt;span style=&quot;color: #a31515;&quot;&gt;&quot;*&quot;&lt;/span&gt;);&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span style=&quot;font-family: &#39;Courier New&#39;; font-size: 10pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; password += info.KeyChar;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span style=&quot;font-family: &#39;Courier New&#39;; font-size: 10pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span style=&quot;font-family: &#39;Courier New&#39;; font-size: 10pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style=&quot;color: blue;&quot;&gt;else&lt;/span&gt;
&lt;span style=&quot;color: blue;&quot;&gt;if&lt;/span&gt; (info.Key == &lt;span style=&quot;color: #2b91af;&quot;&gt;ConsoleKey&lt;/span&gt;.Backspace)&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span style=&quot;font-family: &#39;Courier New&#39;; font-size: 10pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span style=&quot;font-family: &#39;Courier New&#39;; font-size: 10pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style=&quot;color: blue;&quot;&gt;if&lt;/span&gt;
(!&lt;span style=&quot;color: blue;&quot;&gt;string&lt;/span&gt;.IsNullOrEmpty(password))&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span style=&quot;font-family: &#39;Courier New&#39;; font-size: 10pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span style=&quot;font-family: &#39;Courier New&#39;; font-size: 10pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style=&quot;color: green;&quot;&gt;// remove one character from the list of password characters&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span style=&quot;font-family: &#39;Courier New&#39;; font-size: 10pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; password =
password.Substring(0, password.Length - 1);&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span style=&quot;font-family: &#39;Courier New&#39;; font-size: 10pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style=&quot;color: green;&quot;&gt;// get the location of the cursor&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span style=&quot;font-family: &#39;Courier New&#39;; font-size: 10pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style=&quot;color: blue;&quot;&gt;int&lt;/span&gt; pos = &lt;span style=&quot;color: #2b91af;&quot;&gt;Console&lt;/span&gt;.CursorLeft;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span style=&quot;font-family: &#39;Courier New&#39;; font-size: 10pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style=&quot;color: green;&quot;&gt;// move the cursor to the left by one character&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span style=&quot;font-family: &#39;Courier New&#39;; font-size: 10pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style=&quot;color: #2b91af;&quot;&gt;Console&lt;/span&gt;.SetCursorPosition(pos - 1, &lt;span style=&quot;color: #2b91af;&quot;&gt;Console&lt;/span&gt;.CursorTop);&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span style=&quot;font-family: &#39;Courier New&#39;; font-size: 10pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style=&quot;color: green;&quot;&gt;// replace it with space&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span style=&quot;font-family: &#39;Courier New&#39;; font-size: 10pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style=&quot;color: #2b91af;&quot;&gt;Console&lt;/span&gt;.Write(&lt;span style=&quot;color: #a31515;&quot;&gt;&quot; &quot;&lt;/span&gt;);&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span style=&quot;font-family: &#39;Courier New&#39;; font-size: 10pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style=&quot;color: green;&quot;&gt;// move the cursor to the left by one character again&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span style=&quot;font-family: &#39;Courier New&#39;; font-size: 10pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style=&quot;color: #2b91af;&quot;&gt;Console&lt;/span&gt;.SetCursorPosition(pos - 1, &lt;span style=&quot;color: #2b91af;&quot;&gt;Console&lt;/span&gt;.CursorTop);&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span style=&quot;font-family: &#39;Courier New&#39;; font-size: 10pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span style=&quot;font-family: &#39;Courier New&#39;; font-size: 10pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span style=&quot;font-family: &#39;Courier New&#39;; font-size: 10pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; info = &lt;span style=&quot;color: #2b91af;&quot;&gt;Console&lt;/span&gt;.ReadKey(&lt;span style=&quot;color: blue;&quot;&gt;true&lt;/span&gt;);&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span style=&quot;font-family: &#39;Courier New&#39;; font-size: 10pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span style=&quot;font-family: &#39;Courier New&#39;; font-size: 10pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style=&quot;color: green;&quot;&gt;// add a
new line because user pressed enter at the end of their password&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span style=&quot;font-family: &#39;Courier New&#39;; font-size: 10pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style=&quot;color: #2b91af;&quot;&gt;Console&lt;/span&gt;.WriteLine();&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span style=&quot;font-family: &#39;Courier New&#39;; font-size: 10pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style=&quot;color: blue;&quot;&gt;return&lt;/span&gt;
password;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span style=&quot;font-family: &#39;Courier New&#39;; font-size: 10pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; } &lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span style=&quot;font-family: &#39;Courier New&#39;; font-size: 10pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;/span&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/pre&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;br /&gt;
That&#39;s it.&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://rajeshbailwal.blogspot.com/feeds/627296743808447267/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://rajeshbailwal.blogspot.com/2012/03/password-in-c-console-application.html#comment-form' title='6 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1331387060948995865/posts/default/627296743808447267'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1331387060948995865/posts/default/627296743808447267'/><link rel='alternate' type='text/html' href='http://rajeshbailwal.blogspot.com/2012/03/password-in-c-console-application.html' title='Password in C# Console Application'/><author><name>Rajesh</name><uri>http://www.blogger.com/profile/13411886056681990229</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhfGxMDfbXjdx9s7OivC7Rcz6xWeOZ3XASP1R_IQ-Lo6Md6GFX0AunAdeuDr8tLoTnLCVtmkF8PzkSwQQXOmH3s4k3ZDdGzJSDpB9JMf8nqVmsobp32fByrKK0adOE5ljw/s220/My+Collage.jpg'/></author><thr:total>6</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1331387060948995865.post-4507976810008273349</id><published>2012-03-19T05:39:00.002-07:00</published><updated>2012-03-19T07:30:45.003-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="SQL Server"/><title type='text'>Bulk Insert From XML To Table</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
If you want to insert large number of data in table with just one shot then you can do it by this article. While doing my project I came to scenario where I want to send the large number to data to SQL and then insert into tables. I found this very useful. What I did is I passed all records in form of XML in SQL Procedure.&lt;br /&gt;
&lt;br /&gt;
Below is the example: Open Query analyzer and paste the below code&lt;br /&gt;
&lt;br /&gt;
1) Declared the XML Variable first and set the value to it.&lt;br /&gt;
&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;div id=&quot;codeSnippetWrapper&quot; style=&quot;background-color: #f4f4f4; border-bottom-color: silver; border-bottom-style: solid; border-bottom-width: 1px; border-left-color: silver; border-left-style: solid; border-left-width: 1px; border-right-color: silver; border-right-style: solid; border-right-width: 1px; border-top-color: silver; border-top-style: solid; border-top-width: 1px; cursor: text; direction: ltr; font-size: 8pt; line-height: 12pt; margin-bottom: 10px; margin-left: 0px; margin-right: 0px; margin-top: 20px; max-height: 200px; overflow-x: auto; overflow-y: auto; padding-bottom: 4px; padding-left: 4px; padding-right: 4px; padding-top: 4px; text-align: left; width: 97.5%;&quot;&gt;
&lt;div id=&quot;codeSnippet&quot; style=&quot;background-color: #f4f4f4; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; direction: ltr; font-size: 8pt; line-height: 12pt; overflow-x: visible; overflow-y: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;
&lt;pre style=&quot;background-color: #f4f4f4; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; direction: ltr; font-size: 8pt; line-height: 12pt; margin-bottom: 0em; margin-left: 0em; margin-right: 0em; margin-top: 0em; overflow-x: visible; overflow-y: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;font-size: 13px; line-height: normal; text-align: -webkit-auto; white-space: normal;&quot;&gt;
&lt;span style=&quot;color: blue; font-family: &#39;Courier New&#39;; font-size: 10pt; text-align: left; white-space: pre;&quot;&gt;DECLARE&lt;/span&gt;&lt;span style=&quot;font-family: &#39;Courier New&#39;; font-size: 10pt; text-align: left; white-space: pre;&quot;&gt; @idoc &lt;span style=&quot;color: blue;&quot;&gt;int&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: blue; font-family: &#39;Courier New&#39;;&quot;&gt;
&lt;/span&gt;&lt;br /&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;color: #222222; font-family: arial, sans-serif;&quot;&gt;
&lt;span style=&quot;color: blue; font-family: &#39;Courier New&#39;; font-size: 10pt;&quot;&gt;DECLARE&lt;/span&gt;&lt;span style=&quot;font-family: &#39;Courier New&#39;; font-size: 10pt;&quot;&gt; @doc &lt;span style=&quot;color: blue;&quot;&gt;varchar&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;(&lt;/span&gt;8000&lt;span style=&quot;color: grey;&quot;&gt;)&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;color: #222222; font-family: arial, sans-serif;&quot;&gt;
&lt;span style=&quot;color: blue; font-family: &#39;Courier New&#39;; font-size: 10pt;&quot;&gt;SET&lt;/span&gt;&lt;span style=&quot;font-family: &#39;Courier New&#39;; font-size: 10pt;&quot;&gt; @doc &lt;span style=&quot;color: grey;&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: red;&quot;&gt;&#39;&amp;lt;ROOT&amp;gt;&amp;lt;student&amp;gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;color: #222222; font-family: arial, sans-serif;&quot;&gt;
&lt;span style=&quot;color: red; font-family: &#39;Courier New&#39;; font-size: 10pt;&quot;&gt;&amp;lt;id&amp;gt;1&amp;lt;/id&amp;gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;color: #222222; font-family: arial, sans-serif;&quot;&gt;
&lt;span style=&quot;color: red; font-family: &#39;Courier New&#39;; font-size: 10pt;&quot;&gt;&amp;lt;name&amp;gt;Prashant&amp;lt;/name&amp;gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;color: #222222; font-family: arial, sans-serif;&quot;&gt;
&lt;span style=&quot;color: red; font-family: &#39;Courier New&#39;; font-size: 10pt;&quot;&gt;&amp;lt;age&amp;gt;32&amp;lt;/age&amp;gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;color: #222222; font-family: arial, sans-serif;&quot;&gt;
&lt;span style=&quot;color: red; font-family: &#39;Courier New&#39;; font-size: 10pt;&quot;&gt;&amp;lt;/student&amp;gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;color: #222222; font-family: arial, sans-serif;&quot;&gt;
&lt;span style=&quot;color: red; font-family: &#39;Courier New&#39;; font-size: 10pt;&quot;&gt;&amp;lt;student&amp;gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;color: #222222; font-family: arial, sans-serif;&quot;&gt;
&lt;span style=&quot;color: red; font-family: &#39;Courier New&#39;; font-size: 10pt;&quot;&gt;&amp;lt;id&amp;gt;2&amp;lt;/id&amp;gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;color: #222222; font-family: arial, sans-serif;&quot;&gt;
&lt;span style=&quot;color: red; font-family: &#39;Courier New&#39;; font-size: 10pt;&quot;&gt;&amp;lt;name&amp;gt;Swami&amp;lt;/name&amp;gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;color: #222222; font-family: arial, sans-serif;&quot;&gt;
&lt;span style=&quot;color: red; font-family: &#39;Courier New&#39;; font-size: 10pt;&quot;&gt;&amp;lt;age&amp;gt;42&amp;lt;/age&amp;gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;color: #222222; font-family: arial, sans-serif;&quot;&gt;
&lt;span style=&quot;color: red; font-family: &#39;Courier New&#39;; font-size: 10pt;&quot;&gt;&amp;lt;/student&amp;gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;color: #222222; font-family: arial, sans-serif;&quot;&gt;
&lt;span style=&quot;color: red; font-family: &#39;Courier New&#39;; font-size: 10pt;&quot;&gt;&amp;lt;student&amp;gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;color: #222222; font-family: arial, sans-serif;&quot;&gt;
&lt;span style=&quot;color: red; font-family: &#39;Courier New&#39;; font-size: 10pt;&quot;&gt;&amp;lt;id&amp;gt;3&amp;lt;/id&amp;gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;color: #222222; font-family: arial, sans-serif;&quot;&gt;
&lt;span style=&quot;color: red; font-family: &#39;Courier New&#39;; font-size: 10pt;&quot;&gt;&amp;lt;name&amp;gt;Ash&amp;lt;/name&amp;gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;color: #222222; font-family: arial, sans-serif;&quot;&gt;
&lt;span style=&quot;color: red; font-family: &#39;Courier New&#39;; font-size: 10pt;&quot;&gt;&amp;lt;age&amp;gt;23&amp;lt;/age&amp;gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;color: #222222; font-family: arial, sans-serif;&quot;&gt;
&lt;span style=&quot;color: red; font-family: &#39;Courier New&#39;; font-size: 10pt;&quot;&gt;&amp;lt;/student&amp;gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;color: #222222; font-family: arial, sans-serif;&quot;&gt;
&lt;span style=&quot;color: red; font-family: &#39;Courier New&#39;; font-size: 10pt;&quot;&gt;&amp;lt;student&amp;gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;color: #222222; font-family: arial, sans-serif;&quot;&gt;
&lt;span style=&quot;color: red; font-family: &#39;Courier New&#39;; font-size: 10pt;&quot;&gt;&amp;lt;id&amp;gt;4&amp;lt;/id&amp;gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;color: #222222; font-family: arial, sans-serif;&quot;&gt;
&lt;span style=&quot;color: red; font-family: &#39;Courier New&#39;; font-size: 10pt;&quot;&gt;&amp;lt;name&amp;gt;Kris&amp;lt;/name&amp;gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;color: #222222; font-family: arial, sans-serif;&quot;&gt;
&lt;span style=&quot;color: red; font-family: &#39;Courier New&#39;; font-size: 10pt;&quot;&gt;&amp;lt;age&amp;gt;12&amp;lt;/age&amp;gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;color: #222222; font-family: arial, sans-serif;&quot;&gt;
&lt;span style=&quot;color: red; font-family: &#39;Courier New&#39;; font-size: 10pt;&quot;&gt;&amp;lt;/student&amp;gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;color: #222222; font-family: arial, sans-serif;&quot;&gt;
&lt;span style=&quot;color: red; font-family: &#39;Courier New&#39;; font-size: 10pt;&quot;&gt;&amp;lt;student&amp;gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;color: #222222; font-family: arial, sans-serif;&quot;&gt;
&lt;span style=&quot;color: red; font-family: &#39;Courier New&#39;; font-size: 10pt;&quot;&gt;&amp;lt;id&amp;gt;5&amp;lt;/id&amp;gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;color: #222222; font-family: arial, sans-serif;&quot;&gt;
&lt;span style=&quot;color: red; font-family: &#39;Courier New&#39;; font-size: 10pt;&quot;&gt;&amp;lt;name&amp;gt;Derek&amp;lt;/name&amp;gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;color: #222222; font-family: arial, sans-serif;&quot;&gt;
&lt;span style=&quot;color: red; font-family: &#39;Courier New&#39;; font-size: 10pt;&quot;&gt;&amp;lt;age&amp;gt;75&amp;lt;/age&amp;gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;color: #222222; font-family: arial, sans-serif;&quot;&gt;
&lt;span style=&quot;color: red; font-family: &#39;Courier New&#39;; font-size: 10pt;&quot;&gt;&amp;lt;/student&amp;gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;color: #222222; font-family: arial, sans-serif;&quot;&gt;
&lt;span style=&quot;color: red; font-family: &#39;Courier New&#39;; font-size: 10pt;&quot;&gt;&amp;lt;/ROOT&amp;gt;&#39;&lt;/span&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/pre&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;br /&gt;
2) Now Include this:&lt;br /&gt;
&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;div id=&quot;codeSnippetWrapper&quot; style=&quot;background-color: #f4f4f4; border-bottom-color: silver; border-bottom-style: solid; border-bottom-width: 1px; border-left-color: silver; border-left-style: solid; border-left-width: 1px; border-right-color: silver; border-right-style: solid; border-right-width: 1px; border-top-color: silver; border-top-style: solid; border-top-width: 1px; cursor: text; direction: ltr; font-size: 8pt; line-height: 12pt; margin-bottom: 10px; margin-left: 0px; margin-right: 0px; margin-top: 20px; max-height: 200px; overflow-x: auto; overflow-y: auto; padding-bottom: 4px; padding-left: 4px; padding-right: 4px; padding-top: 4px; text-align: left; width: 97.5%;&quot;&gt;
&lt;div id=&quot;codeSnippet&quot; style=&quot;background-color: #f4f4f4; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; direction: ltr; font-size: 8pt; line-height: 12pt; overflow-x: visible; overflow-y: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;
&lt;pre style=&quot;background-color: #f4f4f4; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; direction: ltr; font-size: 8pt; line-height: 12pt; margin-bottom: 0em; margin-left: 0em; margin-right: 0em; margin-top: 0em; overflow-x: visible; overflow-y: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;font-size: 13px; line-height: normal; text-align: -webkit-auto; white-space: normal;&quot;&gt;
&lt;br /&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span style=&quot;color: green; font-family: &amp;quot;Courier New&amp;quot;; font-size: 10.0pt; mso-no-proof: yes;&quot;&gt;--Create an internal representation of the XML document.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span style=&quot;color: blue; font-family: &amp;quot;Courier New&amp;quot;; font-size: 10.0pt; mso-no-proof: yes;&quot;&gt;EXEC&lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;; font-size: 10.0pt; mso-no-proof: yes;&quot;&gt; &lt;span style=&quot;color: maroon;&quot;&gt;sp_xml_preparedocument&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt; &lt;/span&gt;@idoc&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span style=&quot;color: blue; font-family: &amp;quot;Courier New&amp;quot;; font-size: 10.0pt; mso-no-proof: yes;&quot;&gt;OUTPUT&lt;/span&gt;&lt;span style=&quot;color: grey; font-family: &amp;quot;Courier New&amp;quot;; font-size: 10.0pt; mso-no-proof: yes;&quot;&gt;,&lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;; font-size: 10.0pt; mso-no-proof: yes;&quot;&gt; @doc&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span style=&quot;color: green; font-family: &#39;Courier New&#39;; font-size: 10pt;&quot;&gt;-- Execute a SELECT statement that uses the OPENXML rowset provider.&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span style=&quot;color: blue; font-family: &#39;Courier New&#39;; font-size: 10pt;&quot;&gt;Insert&lt;/span&gt;&lt;span style=&quot;color: #222222; font-family: &#39;Courier New&#39;; font-size: 10pt;&quot;&gt; &lt;span style=&quot;color: blue;&quot;&gt;into&lt;/span&gt;&amp;nbsp;Students &lt;span style=&quot;color: blue;&quot;&gt;SELECT&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: #222222; font-family: &#39;Courier New&#39;; font-size: 10pt;&quot;&gt;id&lt;/span&gt;&lt;span style=&quot;color: grey; font-family: &#39;Courier New&#39;; font-size: 10pt;&quot;&gt;,&lt;/span&gt;&lt;span style=&quot;color: #222222; font-family: &#39;Courier New&#39;; font-size: 10pt;&quot;&gt; name&lt;/span&gt;&lt;span style=&quot;color: grey; font-family: &#39;Courier New&#39;; font-size: 10pt;&quot;&gt;,&lt;/span&gt;&lt;span style=&quot;color: #222222; font-family: &#39;Courier New&#39;; font-size: 10pt;&quot;&gt; age &lt;/span&gt;&lt;span style=&quot;color: blue; font-family: &#39;Courier New&#39;; font-size: 10pt;&quot;&gt;from&amp;nbsp;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span style=&quot;color: blue; font-family: &#39;Courier New&#39;; font-size: 10pt;&quot;&gt;OPENXML&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: grey; font-family: &#39;Courier New&#39;; font-size: 10pt;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #222222; font-family: &#39;Courier New&#39;; font-size: 10pt;&quot;&gt;@idoc&lt;span style=&quot;color: grey;&quot;&gt;,&lt;/span&gt; &lt;span style=&quot;color: red;&quot;&gt;&#39;/ROOT/student&#39;&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;,&lt;/span&gt;2&lt;span style=&quot;color: grey;&quot;&gt;)&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span style=&quot;color: blue; font-family: &#39;Courier New&#39;; font-size: 10pt;&quot;&gt;WITH
&lt;/span&gt;&lt;span style=&quot;color: grey; font-family: &#39;Courier New&#39;; font-size: 10pt;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #222222; font-family: &#39;Courier New&#39;; font-size: 10pt;&quot;&gt;id&amp;nbsp; &lt;span style=&quot;color: blue;&quot;&gt;int&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;,&lt;/span&gt; name &lt;span style=&quot;color: blue;&quot;&gt;varchar&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;(&lt;/span&gt;50&lt;span style=&quot;color: grey;&quot;&gt;),&lt;/span&gt; age &lt;span style=&quot;color: blue;&quot;&gt;int&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;)&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span style=&quot;color: blue; font-family: &#39;Courier New&#39;; font-size: 10pt;&quot;&gt;
&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span style=&quot;color: blue; font-family: &#39;Courier New&#39;; font-size: 10pt;&quot;&gt;Select&lt;/span&gt;&lt;span style=&quot;color: #222222; font-family: &#39;Courier New&#39;; font-size: 10pt;&quot;&gt; &lt;span style=&quot;color: grey;&quot;&gt;*&lt;/span&gt; &lt;span style=&quot;color: blue;&quot;&gt;from&lt;/span&gt;
@Students&lt;/span&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;/pre&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;br /&gt;
Enjoy!!!!!!&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://rajeshbailwal.blogspot.com/feeds/4507976810008273349/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://rajeshbailwal.blogspot.com/2012/03/bulk-insert-from-xml-to-table.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1331387060948995865/posts/default/4507976810008273349'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1331387060948995865/posts/default/4507976810008273349'/><link rel='alternate' type='text/html' href='http://rajeshbailwal.blogspot.com/2012/03/bulk-insert-from-xml-to-table.html' title='Bulk Insert From XML To Table'/><author><name>Rajesh</name><uri>http://www.blogger.com/profile/13411886056681990229</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhfGxMDfbXjdx9s7OivC7Rcz6xWeOZ3XASP1R_IQ-Lo6Md6GFX0AunAdeuDr8tLoTnLCVtmkF8PzkSwQQXOmH3s4k3ZDdGzJSDpB9JMf8nqVmsobp32fByrKK0adOE5ljw/s220/My+Collage.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1331387060948995865.post-8206359164541751647</id><published>2012-03-19T04:58:00.001-07:00</published><updated>2012-03-19T07:30:45.005-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="SQL Server"/><title type='text'>Retrieving Last Inserted Identity of Record</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
While writing procedure in SQL somewhere I want the Identity value of inserted record but confused which way is the best to use and what&#39;s the difference between them. I found very useful article on this which I am sharing.&lt;br /&gt;
&lt;br /&gt;
There are 3 ways to get the Identity value of last inserted record in SQL Server procedures:&lt;br /&gt;
&lt;b&gt;@@IDENTITY,&amp;nbsp;SCOPE_IDENTITY,&amp;nbsp;IDENT_CURRENT&lt;/b&gt;&lt;br /&gt;
&lt;b&gt;&lt;br /&gt;&lt;/b&gt;&lt;br /&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;/div&gt;
&lt;div style=&quot;background-color: rgba(255, 255, 255, 0.917969); color: #333333; font-family: verdana, tahoma, arial, sans-serif; font-size: 12px; line-height: 1.6em; margin-bottom: 0.7em; margin-top: 0.7em; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot;&gt;
&lt;strong style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot;&gt;SELECT @@IDENTITY&lt;/strong&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;It returns the last IDENTITY value produced on a connection, regardless of the table that produced the value, and regardless of the scope of the statement that produced the value.&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;@@IDENTITY will return the last identity value entered into a table in your current session. While @@IDENTITY is limited to the current session, it is not limited to the current scope. If you have a trigger on a table that causes an identity to be created in another table, you will get the identity that was created last, even if it was the trigger that created it.&lt;/div&gt;
&lt;div style=&quot;background-color: rgba(255, 255, 255, 0.917969); color: #333333; font-family: verdana, tahoma, arial, sans-serif; font-size: 12px; line-height: 1.6em; margin-bottom: 0.7em; margin-top: 0.7em; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot;&gt;
&lt;strong style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot;&gt;SELECT SCOPE_IDENTITY()&lt;/strong&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;It returns the last IDENTITY value produced on a connection and by a statement in the same scope, regardless of the table that produced the value.&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;SCOPE_IDENTITY(), like @@IDENTITY, will return the last identity value created in the current session, but it will also limit it to your current scope as well. In other words, it will return the last identity value that you explicitly created, rather than any identity that was created by a trigger or a user defined function.&lt;/div&gt;
&lt;div style=&quot;background-color: rgba(255, 255, 255, 0.917969); color: #333333; font-family: verdana, tahoma, arial, sans-serif; font-size: 12px; line-height: 1.6em; margin-bottom: 0.7em; margin-top: 0.7em; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot;&gt;
&lt;strong style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot;&gt;SELECT IDENT_CURRENT(‘tablename’)&lt;/strong&gt;&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;It returns the last IDENTITY value produced in a table, regardless of the connection that created the value, and regardless of the scope of the statement that produced the value.&lt;br style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; /&gt;IDENT_CURRENT is not limited by scope and session; it is limited to a specified table. IDENT_CURRENT returns the identity value generated for a specific table in any session and any scope.&lt;/div&gt;
&lt;div style=&quot;background-color: rgba(255, 255, 255, 0.917969); color: #333333; font-family: verdana, tahoma, arial, sans-serif; font-size: 12px; line-height: 1.6em; margin-bottom: 0.7em; margin-top: 0.7em; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot;&gt;
&lt;em style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot;&gt;To avoid the potential problems associated with adding a trigger later on, always use SCOPE_IDENTITY() to return the identity of the recently added row in your T SQL Statement or Stored Procedure.&lt;/em&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;br /&gt;
Enjoy!!!!!!&lt;br /&gt;
&lt;br /&gt;
Thanks to Pinal Dave where I found this useful topic.&lt;br /&gt;
Reference:&amp;nbsp;&lt;em style=&quot;color: #333333; font-family: verdana, tahoma, arial, sans-serif; font-size: 12px; line-height: 19px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: justify;&quot;&gt;&lt;a href=&quot;http://blog.sqlauthority.com/2007/03/25/sql-server-identity-vs-scope_identity-vs-ident_current-retrieve-last-inserted-identity-of-record/&quot; style=&quot;color: #1155cc;&quot; target=&quot;_blank&quot;&gt;http://blog.sqlauthority.com/&lt;wbr&gt;&lt;/wbr&gt;2007/03/25/sql-server-&lt;wbr&gt;&lt;/wbr&gt;identity-vs-scope_identity-vs-&lt;wbr&gt;&lt;/wbr&gt;ident_current-retrieve-last-&lt;wbr&gt;&lt;/wbr&gt;inserted-identity-of-record/&lt;/a&gt;&lt;/em&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://rajeshbailwal.blogspot.com/feeds/8206359164541751647/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://rajeshbailwal.blogspot.com/2012/03/retrieving-last-inserted-identity-of.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1331387060948995865/posts/default/8206359164541751647'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1331387060948995865/posts/default/8206359164541751647'/><link rel='alternate' type='text/html' href='http://rajeshbailwal.blogspot.com/2012/03/retrieving-last-inserted-identity-of.html' title='Retrieving Last Inserted Identity of Record'/><author><name>Rajesh</name><uri>http://www.blogger.com/profile/13411886056681990229</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhfGxMDfbXjdx9s7OivC7Rcz6xWeOZ3XASP1R_IQ-Lo6Md6GFX0AunAdeuDr8tLoTnLCVtmkF8PzkSwQQXOmH3s4k3ZDdGzJSDpB9JMf8nqVmsobp32fByrKK0adOE5ljw/s220/My+Collage.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1331387060948995865.post-3944050522599940082</id><published>2012-03-19T04:34:00.001-07:00</published><updated>2012-03-19T04:58:36.960-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="SQL Server"/><title type='text'>Finding Nth row in SQL Server</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
Finding nth row in SQL Server. Here is the simple query using ROW_NUMBER() function. In below example I am finding the 2 row:&lt;br /&gt;
&lt;div id=&quot;codeSnippetWrapper&quot; style=&quot;background-color: #f4f4f4; border-bottom-color: silver; border-bottom-style: solid; border-bottom-width: 1px; border-left-color: silver; border-left-style: solid; border-left-width: 1px; border-right-color: silver; border-right-style: solid; border-right-width: 1px; border-top-color: silver; border-top-style: solid; border-top-width: 1px; cursor: text; direction: ltr; font-size: 8pt; line-height: 12pt; margin-bottom: 10px; margin-left: 0px; margin-right: 0px; margin-top: 20px; max-height: 200px; overflow-x: auto; overflow-y: auto; padding-bottom: 4px; padding-left: 4px; padding-right: 4px; padding-top: 4px; text-align: left; width: 97.5%;&quot;&gt;
&lt;div id=&quot;codeSnippet&quot; style=&quot;background-color: #f4f4f4; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; direction: ltr; font-size: 8pt; line-height: 12pt; overflow-x: visible; overflow-y: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;
&lt;pre style=&quot;background-color: #f4f4f4; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; direction: ltr; font-size: 8pt; line-height: 12pt; margin-bottom: 0em; margin-left: 0em; margin-right: 0em; margin-top: 0em; overflow-x: visible; overflow-y: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;font-size: 13px; line-height: normal; text-align: -webkit-auto; white-space: normal;&quot;&gt;
&lt;span style=&quot;color: blue; font-family: &#39;Courier New&#39;; font-size: x-small;&quot;&gt;&lt;span style=&quot;font-size: 10pt;&quot;&gt;SELECT&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: #222222; font-family: &#39;Courier New&#39;; font-size: x-small;&quot;&gt;&lt;span style=&quot;font-size: 10pt;&quot;&gt;&amp;nbsp;&lt;span style=&quot;color: grey;&quot;&gt;*&lt;/span&gt;&amp;nbsp;&lt;span style=&quot;color: blue;&quot;&gt;FROM&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;color: #222222; font-family: arial, sans-serif;&quot;&gt;
&lt;span style=&quot;font-family: &#39;Courier New&#39;; font-size: x-small;&quot;&gt;&lt;span style=&quot;font-size: 10pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: grey;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;SELECT&lt;/span&gt;&amp;nbsp;ROW_NUMBER&lt;span style=&quot;color: grey;&quot;&gt;()&lt;/span&gt;&lt;u&gt;&lt;/u&gt;&lt;u&gt;&lt;/u&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;color: #222222; font-family: arial, sans-serif;&quot;&gt;
&lt;span style=&quot;font-family: &#39;Courier New&#39;; font-size: x-small;&quot;&gt;&lt;span style=&quot;font-size: 10pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: blue;&quot;&gt;OVER&lt;/span&gt;&amp;nbsp;&lt;span style=&quot;color: grey;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;ORDER&lt;/span&gt;&amp;nbsp;&lt;span style=&quot;color: blue;&quot;&gt;BY&lt;/span&gt;&amp;nbsp;id&lt;span style=&quot;color: grey;&quot;&gt;)&lt;/span&gt;&amp;nbsp;&lt;span style=&quot;color: blue;&quot;&gt;AS&lt;/span&gt;&amp;nbsp;Row&lt;span style=&quot;color: grey;&quot;&gt;,&lt;/span&gt;&lt;u&gt;&lt;/u&gt;&lt;u&gt;&lt;/u&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;color: #222222; font-family: arial, sans-serif;&quot;&gt;
&lt;span style=&quot;font-family: &#39;Courier New&#39;; font-size: x-small;&quot;&gt;&lt;span style=&quot;font-size: 10pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; id&lt;u&gt;&lt;/u&gt;&lt;u&gt;&lt;/u&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;color: #222222; font-family: arial, sans-serif;&quot;&gt;
&lt;span style=&quot;font-family: &#39;Courier New&#39;; font-size: x-small;&quot;&gt;&lt;span style=&quot;font-size: 10pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: blue;&quot;&gt;FROM&lt;/span&gt;&amp;nbsp;Table&lt;span style=&quot;color: grey;&quot;&gt;)&lt;/span&gt;&amp;nbsp;&lt;span style=&quot;color: blue;&quot;&gt;AS&lt;/span&gt;&amp;nbsp;EMP&lt;u&gt;&lt;/u&gt;&lt;u&gt;&lt;/u&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;color: #222222; font-family: arial, sans-serif;&quot;&gt;
&lt;span style=&quot;color: blue; font-family: &#39;Courier New&#39;; font-size: x-small;&quot;&gt;&lt;span style=&quot;font-size: 10pt;&quot;&gt;WHERE&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-family: &#39;Courier New&#39;; font-size: x-small;&quot;&gt;&lt;span style=&quot;font-size: 10pt;&quot;&gt;&amp;nbsp;Row&amp;nbsp;&lt;span style=&quot;color: grey;&quot;&gt;=&lt;/span&gt;&amp;nbsp;2&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;/pre&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;br /&gt;
Enjoy!!!!!!&lt;/div&gt;
&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://rajeshbailwal.blogspot.com/feeds/3944050522599940082/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://rajeshbailwal.blogspot.com/2012/03/finding-nth-row-in-sql-server.html#comment-form' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1331387060948995865/posts/default/3944050522599940082'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1331387060948995865/posts/default/3944050522599940082'/><link rel='alternate' type='text/html' href='http://rajeshbailwal.blogspot.com/2012/03/finding-nth-row-in-sql-server.html' title='Finding Nth row in SQL Server'/><author><name>Rajesh</name><uri>http://www.blogger.com/profile/13411886056681990229</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhfGxMDfbXjdx9s7OivC7Rcz6xWeOZ3XASP1R_IQ-Lo6Md6GFX0AunAdeuDr8tLoTnLCVtmkF8PzkSwQQXOmH3s4k3ZDdGzJSDpB9JMf8nqVmsobp32fByrKK0adOE5ljw/s220/My+Collage.jpg'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1331387060948995865.post-7047264581147217616</id><published>2012-03-19T04:30:00.000-07:00</published><updated>2012-03-19T04:30:27.989-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="SQL Server"/><title type='text'>Deleting duplicate records in SQL Server</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
Deleting duplicate records in SQL Server:&lt;br /&gt;
&lt;div id=&quot;codeSnippetWrapper&quot; style=&quot;background-color: #f4f4f4; border-bottom: silver 1px solid; border-left: silver 1px solid; border-right: silver 1px solid; border-top: silver 1px solid; cursor: text; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 20px 0px 10px; max-height: 200px; overflow: auto; padding-bottom: 4px; padding-left: 4px; padding-right: 4px; padding-top: 4px; text-align: left; width: 97.5%;&quot;&gt;
&lt;div id=&quot;codeSnippet&quot; style=&quot;background-color: #f4f4f4; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; overflow-x: visible; overflow-y: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;
&lt;pre style=&quot;background-color: #f4f4f4; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin-bottom: 0em; margin-left: 0em; margin-right: 0em; margin-top: 0em; overflow-x: visible; overflow-y: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;color: #222222; font-family: arial, sans-serif; font-size: 13px; line-height: normal; text-align: -webkit-auto; white-space: normal;&quot;&gt;
&lt;span style=&quot;color: blue; font-family: &#39;Courier New&#39;; font-size: x-small;&quot;&gt;&lt;span style=&quot;font-size: 10pt;&quot;&gt;WITH&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-family: &#39;Courier New&#39;; font-size: x-small;&quot;&gt;&lt;span style=&quot;font-size: 10pt;&quot;&gt;&amp;nbsp;emp&amp;nbsp;&lt;span style=&quot;color: blue;&quot;&gt;AS&lt;/span&gt;&amp;nbsp;&lt;span style=&quot;color: grey;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;SELECT&lt;/span&gt;&amp;nbsp;ROW_NUMBER&amp;nbsp;&lt;span style=&quot;color: grey;&quot;&gt;(&lt;/span&gt;&amp;nbsp;&lt;span style=&quot;color: grey;&quot;&gt;)&lt;/span&gt;&amp;nbsp;&lt;span style=&quot;color: blue;&quot;&gt;OVER&lt;/span&gt;&amp;nbsp;&lt;span style=&quot;color: grey;&quot;&gt;(&lt;/span&gt;&amp;nbsp;&lt;span style=&quot;color: blue;&quot;&gt;PARTITION&lt;/span&gt;&amp;nbsp;&lt;span style=&quot;color: blue;&quot;&gt;BY&lt;/span&gt;&amp;nbsp;id&lt;span style=&quot;color: grey;&quot;&gt;,&lt;/span&gt;&amp;nbsp;firstname&amp;nbsp;&lt;span style=&quot;color: blue;&quot;&gt;ORDER&lt;/span&gt;&amp;nbsp;&lt;span style=&quot;color: blue;&quot;&gt;BY&lt;/span&gt;&amp;nbsp;id&amp;nbsp;&lt;span style=&quot;color: grey;&quot;&gt;)&lt;/span&gt;&amp;nbsp;&lt;span style=&quot;color: blue;&quot;&gt;AS&lt;/span&gt;&amp;nbsp;RNUM&amp;nbsp;&lt;span style=&quot;color: blue;&quot;&gt;FROM&lt;/span&gt;table1&amp;nbsp;&lt;span style=&quot;color: grey;&quot;&gt;)&lt;u&gt;&lt;/u&gt;&lt;u&gt;&lt;/u&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;color: #222222; font-family: arial, sans-serif; font-size: 13px; line-height: normal; text-align: -webkit-auto; white-space: normal;&quot;&gt;
&lt;span style=&quot;color: green; font-family: &#39;Courier New&#39;; font-size: x-small;&quot;&gt;&lt;span style=&quot;font-size: 10pt;&quot;&gt;--select * from emp&lt;u&gt;&lt;/u&gt;&lt;u&gt;&lt;/u&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;color: #222222; font-family: arial, sans-serif; font-size: 13px; line-height: normal; text-align: -webkit-auto; white-space: normal;&quot;&gt;
&lt;span style=&quot;color: blue; font-family: &#39;Courier New&#39;; font-size: x-small;&quot;&gt;&lt;span style=&quot;font-size: 10pt;&quot;&gt;DELETE&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-family: &#39;Courier New&#39;; font-size: x-small;&quot;&gt;&lt;span style=&quot;font-size: 10pt;&quot;&gt;&amp;nbsp;&lt;span style=&quot;color: blue;&quot;&gt;FROM&lt;/span&gt;&amp;nbsp;Emp&amp;nbsp;&lt;span style=&quot;color: blue;&quot;&gt;WHERE&lt;/span&gt;&amp;nbsp;RNUM&amp;nbsp;&lt;span style=&quot;color: grey;&quot;&gt;&amp;gt;&lt;/span&gt;&amp;nbsp;1&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;/pre&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;br /&gt;
Enjoy!!!!!!&lt;br /&gt;
&lt;br /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://rajeshbailwal.blogspot.com/feeds/7047264581147217616/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://rajeshbailwal.blogspot.com/2012/03/deleting-duplicate-records-in-sql.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1331387060948995865/posts/default/7047264581147217616'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1331387060948995865/posts/default/7047264581147217616'/><link rel='alternate' type='text/html' href='http://rajeshbailwal.blogspot.com/2012/03/deleting-duplicate-records-in-sql.html' title='Deleting duplicate records in SQL Server'/><author><name>Rajesh</name><uri>http://www.blogger.com/profile/13411886056681990229</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhfGxMDfbXjdx9s7OivC7Rcz6xWeOZ3XASP1R_IQ-Lo6Md6GFX0AunAdeuDr8tLoTnLCVtmkF8PzkSwQQXOmH3s4k3ZDdGzJSDpB9JMf8nqVmsobp32fByrKK0adOE5ljw/s220/My+Collage.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1331387060948995865.post-5100997801384315506</id><published>2011-09-15T19:38:00.000-07:00</published><updated>2011-09-15T19:40:04.861-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="SQL Server"/><title type='text'>Using Nested Transactions In SQL Server 2005</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
Recently&lt;b&gt; &lt;/b&gt;I have done Nested transaction in SQL Server 2005.&lt;br /&gt;
In this post, I will show you how to use Nested Transactions.&lt;br /&gt;
&lt;br /&gt;
Below is the inner procedure which will be called from another procedure.&lt;br /&gt;
&lt;div id=&quot;codeSnippetWrapper&quot; style=&quot;background-color: #f4f4f4; border-bottom: silver 1px solid; border-left: silver 1px solid; border-right: silver 1px solid; border-top: silver 1px solid; cursor: text; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 20px 0px 10px; max-height: 200px; overflow: auto; padding-bottom: 4px; padding-left: 4px; padding-right: 4px; padding-top: 4px; text-align: left; width: 97.5%;&quot;&gt;
&lt;div id=&quot;codeSnippet&quot; style=&quot;background-color: #f4f4f4; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;
&lt;pre style=&quot;background-color: #f4f4f4; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span style=&quot;color: blue;&quot;&gt;CREATE&lt;/span&gt; PROCEDURE pInnerProcdureName1&lt;/pre&gt;
&lt;pre style=&quot;background-color: #f4f4f4; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt; &lt;span style=&quot;color: blue;&quot;&gt;AS&lt;/span&gt;&lt;/pre&gt;
&lt;pre style=&quot;background-color: #f4f4f4; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum4&quot; style=&quot;color: #606060;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;BEGIN&lt;/span&gt;&lt;/pre&gt;
&lt;pre style=&quot;background-color: #f4f4f4; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum5&quot; style=&quot;color: #606060;&quot;&gt;   &lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;BEGIN&lt;/span&gt; try&lt;/pre&gt;
&lt;pre style=&quot;background-color: #f4f4f4; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum6&quot; style=&quot;color: #606060;&quot;&gt;   &lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;  BEGIN TRANSACTION&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;&lt;/span&gt;&lt;/pre&gt;
&lt;pre style=&quot;background-color: #f4f4f4; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum7&quot; style=&quot;color: #606060;&quot;&gt;   &lt;/span&gt;    &lt;span style=&quot;color: blue;&quot;&gt; PRINT&lt;/span&gt; &lt;span style=&quot;color: #006080;&quot;&gt;&#39;&lt;/span&gt;pProcdureName1&lt;span style=&quot;color: #006080;&quot;&gt; : &#39;&lt;/span&gt; + &lt;span style=&quot;color: blue;&quot;&gt;cast&lt;/span&gt;(@@TRANCOUNT &lt;span style=&quot;color: blue;&quot;&gt;as&lt;/span&gt; &lt;span style=&quot;color: blue;&quot;&gt;varchar&lt;/span&gt;(&lt;span style=&quot;color: blue;&quot;&gt;max&lt;/span&gt;))     &lt;/pre&gt;
&lt;pre style=&quot;background-color: #f4f4f4; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum8&quot; style=&quot;color: #606060;&quot;&gt;   &lt;/span&gt;    &lt;span style=&quot;color: blue;&quot;&gt; DELETE FROM &lt;span style=&quot;color: black;&quot;&gt;tablename&lt;/span&gt;&lt;/span&gt;&lt;/pre&gt;
&lt;pre style=&quot;background-color: #f4f4f4; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum9&quot; style=&quot;color: #606060;&quot;&gt;   &lt;/span&gt;&amp;nbsp; &lt;/pre&gt;
&lt;pre style=&quot;background-color: #f4f4f4; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum10&quot; style=&quot;color: #606060;&quot;&gt;   &lt;/span&gt;     &lt;span style=&quot;color: blue;&quot;&gt;COMMIT TRANSACTION&lt;/span&gt;&lt;/pre&gt;
&lt;pre style=&quot;background-color: #f4f4f4; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum11&quot; style=&quot;color: #606060;&quot;&gt;  &lt;/span&gt;    &lt;span style=&quot;color: blue;&quot;&gt;PRINT&lt;/span&gt; &lt;span style=&quot;color: #006080;&quot;&gt;&#39;&lt;/span&gt;pProcdureName1&lt;span style=&quot;color: #006080;&quot;&gt; &lt;span style=&quot;color: black;&quot;&gt;Completed :&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: #006080;&quot;&gt; &#39;&lt;/span&gt; + &lt;span style=&quot;color: blue;&quot;&gt;cast&lt;/span&gt;(@@TRANCOUNT &lt;span style=&quot;color: blue;&quot;&gt;as&lt;/span&gt; &lt;span style=&quot;color: blue;&quot;&gt;varchar&lt;/span&gt;(&lt;span style=&quot;color: blue;&quot;&gt;max&lt;/span&gt;)) &lt;/pre&gt;
&lt;pre style=&quot;background-color: #f4f4f4; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum12&quot; style=&quot;color: #606060;&quot;&gt;  &lt;/span&gt;   &lt;span style=&quot;color: blue;&quot;&gt;END &lt;/span&gt;try&lt;/pre&gt;
&lt;pre style=&quot;background-color: #f4f4f4; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum13&quot; style=&quot;color: #606060;&quot;&gt;  &lt;/span&gt;   &lt;span style=&quot;color: blue;&quot;&gt;BEGIN&lt;/span&gt; catch&lt;/pre&gt;
&lt;pre style=&quot;background-color: #f4f4f4; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum14&quot; style=&quot;color: #606060;&quot;&gt;  &lt;/span&gt;     &lt;span style=&quot;color: blue;&quot;&gt;if&lt;/span&gt; &lt;span style=&quot;color: #cc6633;&quot;&gt;@@ERROR&lt;/span&gt; &amp;gt; 0&lt;/pre&gt;
&lt;pre style=&quot;background-color: #f4f4f4; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum15&quot; style=&quot;color: #606060;&quot;&gt;  &lt;/span&gt;     &lt;span style=&quot;color: blue;&quot;&gt;begin&lt;/span&gt;&lt;/pre&gt;
&lt;pre style=&quot;background-color: #f4f4f4; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum16&quot; style=&quot;color: #606060;&quot;&gt;   &lt;/span&gt;      &lt;span style=&quot;color: blue;&quot;&gt;PRINT&lt;/span&gt; error_message()&lt;/pre&gt;
&lt;pre style=&quot;background-color: #f4f4f4; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum18&quot; style=&quot;color: #606060;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #606060;&quot;&gt; &lt;/span&gt;     &lt;span style=&quot;color: blue;&quot;&gt;end&lt;/span&gt;&lt;/pre&gt;
&lt;pre style=&quot;background-color: #f4f4f4; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum20&quot; style=&quot;color: #606060;&quot;&gt;  &lt;/span&gt;     &lt;span style=&quot;color: blue;&quot;&gt;rollback&lt;/span&gt; &lt;span style=&quot;color: blue;&quot;&gt;transaction&lt;/span&gt;&lt;/pre&gt;
&lt;pre style=&quot;background-color: #f4f4f4; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum21&quot; style=&quot;color: #606060;&quot;&gt;  &lt;/span&gt;     &lt;span style=&quot;color: blue;&quot;&gt;print&lt;/span&gt; &lt;span style=&quot;color: #006080;&quot;&gt;&#39;&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;Rollback&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;Transaction&lt;/span&gt;&lt;span style=&quot;color: #006080;&quot;&gt; :&#39;&lt;/span&gt; + &lt;span style=&quot;color: blue;&quot;&gt;cast&lt;/span&gt;(@@TRANCOUNT &lt;span style=&quot;color: blue;&quot;&gt;as&lt;/span&gt; &lt;span style=&quot;color: blue;&quot;&gt;varchar&lt;/span&gt;(&lt;span style=&quot;color: blue;&quot;&gt;max&lt;/span&gt;)) &lt;/pre&gt;
&lt;pre style=&quot;background-color: #f4f4f4; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum22&quot; style=&quot;color: #606060;&quot;&gt;  &lt;/span&gt;   &lt;span style=&quot;color: blue;&quot;&gt;end&lt;/span&gt; catch    &lt;/pre&gt;
&lt;pre style=&quot;background-color: #f4f4f4; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum23&quot; style=&quot;color: #606060;&quot;&gt;  &lt;/span&gt; &lt;span style=&quot;color: blue;&quot;&gt;end&lt;/span&gt; &lt;/pre&gt;
&lt;pre style=&quot;background-color: #f4f4f4; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span style=&quot;color: blue;&quot;&gt;GO&lt;/span&gt;&lt;/pre&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;br /&gt;
Now creating the outer transaction:&lt;br /&gt;
&lt;div id=&quot;codeSnippetWrapper&quot; style=&quot;background-color: #f4f4f4; border-bottom: silver 1px solid; border-left: silver 1px solid; border-right: silver 1px solid; border-top: silver 1px solid; cursor: text; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 20px 0px 10px; max-height: 200px; overflow: auto; padding-bottom: 4px; padding-left: 4px; padding-right: 4px; padding-top: 4px; text-align: left; width: 97.5%;&quot;&gt;
&lt;div id=&quot;codeSnippet&quot; style=&quot;background-color: #f4f4f4; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;
&lt;pre style=&quot;background-color: #f4f4f4; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum1&quot; style=&quot;color: #606060;&quot;&gt;&lt;span style=&quot;color: blue;&quot;&gt;CREATE PROCEDURE&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;&lt;/span&gt; pOuterProcedureName&lt;/pre&gt;
&lt;pre style=&quot;background-color: #f4f4f4; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum4&quot; style=&quot;color: #606060;&quot;&gt;   &lt;/span&gt; &lt;span style=&quot;color: blue;&quot;&gt;as&lt;/span&gt;&lt;/pre&gt;
&lt;pre style=&quot;background-color: #f4f4f4; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum5&quot; style=&quot;color: #606060;&quot;&gt;   &lt;/span&gt; &lt;span style=&quot;color: blue;&quot;&gt;begin&lt;/span&gt;&lt;/pre&gt;
&lt;pre style=&quot;background-color: #f4f4f4; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum6&quot; style=&quot;color: #606060;&quot;&gt;   &lt;/span&gt;   &lt;span style=&quot;color: blue;&quot;&gt;begin&lt;/span&gt; try&lt;/pre&gt;
&lt;pre style=&quot;background-color: #f4f4f4; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum7&quot; style=&quot;color: #606060;&quot;&gt;   &lt;/span&gt;     &lt;span style=&quot;color: blue;&quot;&gt;begin&lt;/span&gt; &lt;span style=&quot;color: blue;&quot;&gt;transaction&lt;/span&gt;&lt;/pre&gt;
&lt;pre style=&quot;background-color: #f4f4f4; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum8&quot; style=&quot;color: #606060;&quot;&gt;   &lt;/span&gt;         &lt;span style=&quot;color: blue;&quot;&gt;print&lt;/span&gt; &lt;span style=&quot;color: #006080;&quot;&gt;&#39;&lt;/span&gt;pOuterProcedureName&lt;span style=&quot;color: #006080;&quot;&gt; : &#39;&lt;/span&gt; + &lt;span style=&quot;color: blue;&quot;&gt;cast&lt;/span&gt;(@@TRANCOUNT &lt;span style=&quot;color: blue;&quot;&gt;as&lt;/span&gt; &lt;span style=&quot;color: blue;&quot;&gt;varchar&lt;/span&gt;(&lt;span style=&quot;color: blue;&quot;&gt;max&lt;/span&gt;)) &lt;/pre&gt;
&lt;pre style=&quot;background-color: #f4f4f4; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum9&quot; style=&quot;color: #606060;&quot;&gt;   &lt;/span&gt;             &lt;/pre&gt;
&lt;pre style=&quot;background-color: #f4f4f4; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum10&quot; style=&quot;color: #606060;&quot;&gt;  &lt;/span&gt;             &lt;span style=&quot;color: blue;&quot;&gt;exec&lt;/span&gt; pInnerProcdureName1&lt;/pre&gt;
&lt;pre style=&quot;background-color: #f4f4f4; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum11&quot; style=&quot;color: #606060;&quot;&gt;  &lt;/span&gt;             &lt;span style=&quot;color: blue;&quot;&gt;commit&lt;/span&gt; &lt;span style=&quot;color: blue;&quot;&gt;transaction&lt;/span&gt;&lt;/pre&gt;
&lt;pre style=&quot;background-color: #f4f4f4; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum15&quot; style=&quot;color: #606060;&quot;&gt;  &lt;/span&gt;         &lt;span style=&quot;color: blue;&quot;&gt;print&lt;/span&gt; &lt;span style=&quot;color: #006080;&quot;&gt;&#39;&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;pOuterProcedureName &lt;/span&gt;&lt;span style=&quot;color: #006080;&quot;&gt;&lt;span style=&quot;color: black;&quot;&gt;Transaction Committed&lt;/span&gt; : &#39;&lt;/span&gt; + &lt;span style=&quot;color: blue;&quot;&gt;cast&lt;/span&gt;(@@TRANCOUNT &lt;span style=&quot;color: blue;&quot;&gt;as&lt;/span&gt; &lt;span style=&quot;color: blue;&quot;&gt;varchar&lt;/span&gt;(&lt;span style=&quot;color: blue;&quot;&gt;max&lt;/span&gt;)) &lt;/pre&gt;
&lt;pre style=&quot;background-color: #f4f4f4; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum16&quot; style=&quot;color: #606060;&quot;&gt;  &lt;/span&gt;   &lt;span style=&quot;color: blue;&quot;&gt;end&lt;/span&gt; try&lt;/pre&gt;
&lt;pre style=&quot;background-color: #f4f4f4; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum17&quot; style=&quot;color: #606060;&quot;&gt;  &lt;/span&gt;   &lt;span style=&quot;color: blue;&quot;&gt;begin&lt;/span&gt; catch&lt;/pre&gt;
&lt;pre style=&quot;background-color: #f4f4f4; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum18&quot; style=&quot;color: #606060;&quot;&gt;  &lt;/span&gt;     &lt;span style=&quot;color: blue;&quot;&gt;if&lt;/span&gt; &lt;span style=&quot;color: #cc6633;&quot;&gt;@@TRANCOUNT&lt;/span&gt; &amp;gt; 0&lt;/pre&gt;
&lt;pre style=&quot;background-color: #f4f4f4; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum19&quot; style=&quot;color: #606060;&quot;&gt;  &lt;/span&gt;     &lt;span style=&quot;color: blue;&quot;&gt;begin&lt;/span&gt;&lt;/pre&gt;
&lt;pre style=&quot;background-color: #f4f4f4; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum20&quot; style=&quot;color: #606060;&quot;&gt;  &lt;/span&gt;         &lt;span style=&quot;color: blue;&quot;&gt;rollback&lt;/span&gt; &lt;span style=&quot;color: blue;&quot;&gt;transaction&lt;/span&gt;&lt;/pre&gt;
&lt;pre style=&quot;background-color: #f4f4f4; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum21&quot; style=&quot;color: #606060;&quot;&gt;  &lt;/span&gt;     &lt;span style=&quot;color: blue;&quot;&gt;end&lt;/span&gt;&lt;/pre&gt;
&lt;pre style=&quot;background-color: #f4f4f4; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum22&quot; style=&quot;color: #606060;&quot;&gt;  &lt;/span&gt;    &lt;span style=&quot;color: blue;&quot;&gt;print&lt;/span&gt; &lt;span style=&quot;color: #006080;&quot;&gt;&#39;&lt;span style=&quot;color: black;&quot;&gt;Rollback &lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;pOuterProcedureName &lt;/span&gt;&lt;span style=&quot;color: #006080;&quot;&gt; : &#39;&lt;/span&gt; + &lt;span style=&quot;color: blue;&quot;&gt;cast&lt;/span&gt;(@@TRANCOUNT &lt;span style=&quot;color: blue;&quot;&gt;as&lt;/span&gt; &lt;span style=&quot;color: blue;&quot;&gt;varchar&lt;/span&gt;(&lt;span style=&quot;color: blue;&quot;&gt;max&lt;/span&gt;))&lt;/pre&gt;
&lt;pre style=&quot;background-color: #f4f4f4; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum23&quot; style=&quot;color: #606060;&quot;&gt;  &lt;/span&gt;     &lt;span style=&quot;color: blue;&quot;&gt;if&lt;/span&gt; &lt;span style=&quot;color: #cc6633;&quot;&gt;@@ERROR&lt;/span&gt; &amp;gt; 0&lt;/pre&gt;
&lt;pre style=&quot;background-color: #f4f4f4; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum24&quot; style=&quot;color: #606060;&quot;&gt;  &lt;/span&gt;     &lt;span style=&quot;color: blue;&quot;&gt;begin&lt;/span&gt;&lt;/pre&gt;
&lt;pre style=&quot;background-color: #f4f4f4; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum25&quot; style=&quot;color: #606060;&quot;&gt;  &lt;/span&gt;         &lt;span id=&quot;lnum26&quot; style=&quot;color: #606060;&quot;&gt;&lt;span style=&quot;color: blue;&quot;&gt;SELECT&lt;/span&gt;&lt;/span&gt; error_message()&lt;/pre&gt;
&lt;pre style=&quot;background-color: #f4f4f4; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum27&quot; style=&quot;color: #606060;&quot;&gt;  &lt;/span&gt;     &lt;span style=&quot;color: blue;&quot;&gt;end&lt;/span&gt; &lt;/pre&gt;
&lt;pre style=&quot;background-color: #f4f4f4; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum29&quot; style=&quot;color: #606060;&quot;&gt;  &lt;/span&gt;   &lt;span style=&quot;color: blue;&quot;&gt;end&lt;/span&gt; catch    &lt;/pre&gt;
&lt;pre style=&quot;background-color: #f4f4f4; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum30&quot; style=&quot;color: #606060;&quot;&gt;  &lt;/span&gt; end&lt;/pre&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;br /&gt;
&lt;br /&gt;
Now just execute your Outer Transaction and Done.&lt;br /&gt;
&lt;br /&gt;
&lt;div id=&quot;codeSnippetWrapper&quot; style=&quot;background-color: #f4f4f4; border-bottom: silver 1px solid; border-left: silver 1px solid; border-right: silver 1px solid; border-top: silver 1px solid; cursor: text; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 20px 0px 10px; max-height: 200px; overflow: auto; padding-bottom: 4px; padding-left: 4px; padding-right: 4px; padding-top: 4px; text-align: left; width: 97.5%;&quot;&gt;
&lt;div id=&quot;codeSnippet&quot; style=&quot;background-color: #f4f4f4; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;
&lt;pre style=&quot;background-color: #f4f4f4; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: &#39;Courier New&#39;, courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;&quot;&gt;&lt;span id=&quot;lnum1&quot; style=&quot;color: #606060;&quot;&gt;&lt;span style=&quot;color: blue;&quot;&gt;EXEC&lt;/span&gt;&lt;/span&gt; pOuterProcedureName&lt;/pre&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;br /&gt;
Enjoy!!!!!! &lt;br /&gt;
&lt;br /&gt;&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='http://rajeshbailwal.blogspot.com/feeds/5100997801384315506/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://rajeshbailwal.blogspot.com/2011/09/using-nested-transactions-in-sql-server.html#comment-form' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1331387060948995865/posts/default/5100997801384315506'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1331387060948995865/posts/default/5100997801384315506'/><link rel='alternate' type='text/html' href='http://rajeshbailwal.blogspot.com/2011/09/using-nested-transactions-in-sql-server.html' title='Using Nested Transactions In SQL Server 2005'/><author><name>Rajesh</name><uri>http://www.blogger.com/profile/13411886056681990229</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhfGxMDfbXjdx9s7OivC7Rcz6xWeOZ3XASP1R_IQ-Lo6Md6GFX0AunAdeuDr8tLoTnLCVtmkF8PzkSwQQXOmH3s4k3ZDdGzJSDpB9JMf8nqVmsobp32fByrKK0adOE5ljw/s220/My+Collage.jpg'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1331387060948995865.post-1683483556673477030</id><published>2011-09-14T23:40:00.000-07:00</published><updated>2011-09-15T19:40:04.856-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="SQL Server"/><title type='text'>Inserting Multiple Rows in One Insert Statement In SQL SERVER 2008</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;div style=&quot;background-color: white; color: #0b5394; font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;
&lt;b&gt;&lt;span style=&quot;color: black;&quot;&gt;You can insert multiple records with one insert statement. Syntax is:&lt;/span&gt; &lt;/b&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; color: #0b5394; font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; color: #38761d; font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;
&lt;b&gt;I&lt;/b&gt;&lt;b&gt;nsert Into TableName (field1,field2)&lt;br /&gt;VALUES&amp;nbsp;&lt;/b&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; color: #38761d; font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;
&lt;b&gt;(value1,value2),&lt;/b&gt;&lt;/div&gt;
&lt;div style=&quot;color: #0b5394;&quot;&gt;
&lt;b&gt;&lt;span style=&quot;background-color: white; color: #38761d; font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;(value3,value4) &lt;/span&gt;&lt;/b&gt;&lt;/div&gt;
&lt;br /&gt;&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='http://rajeshbailwal.blogspot.com/feeds/1683483556673477030/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://rajeshbailwal.blogspot.com/2011/09/inserting-multiple-rows-in-one-insert.html#comment-form' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1331387060948995865/posts/default/1683483556673477030'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1331387060948995865/posts/default/1683483556673477030'/><link rel='alternate' type='text/html' href='http://rajeshbailwal.blogspot.com/2011/09/inserting-multiple-rows-in-one-insert.html' title='Inserting Multiple Rows in One Insert Statement In SQL SERVER 2008'/><author><name>Rajesh</name><uri>http://www.blogger.com/profile/13411886056681990229</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhfGxMDfbXjdx9s7OivC7Rcz6xWeOZ3XASP1R_IQ-Lo6Md6GFX0AunAdeuDr8tLoTnLCVtmkF8PzkSwQQXOmH3s4k3ZDdGzJSDpB9JMf8nqVmsobp32fByrKK0adOE5ljw/s220/My+Collage.jpg'/></author><thr:total>2</thr:total></entry></feed>