<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	xmlns:georss="http://www.georss.org/georss" xmlns:geo="http://www.w3.org/2003/01/geo/wgs84_pos#" xmlns:media="http://search.yahoo.com/mrss/"
	>

<channel>
	<title>Umang Patel</title>
	<atom:link href="http://umangpatel.wordpress.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://umangpatel.wordpress.com</link>
	<description>HTML5, Javascript, CSS3, Silverlight, WPF, MVVM, WCF, RESTfull, Finance, Trading</description>
	<lastBuildDate>Mon, 09 Mar 2009 17:54:58 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.com/</generator>
<cloud domain='umangpatel.wordpress.com' port='80' path='/?rsscloud=notify' registerProcedure='' protocol='http-post' />
<image>
		<url>http://s2.wp.com/i/buttonw-com.png</url>
		<title>Umang Patel</title>
		<link>http://umangpatel.wordpress.com</link>
	</image>
	<atom:link rel="search" type="application/opensearchdescription+xml" href="http://umangpatel.wordpress.com/osd.xml" title="Umang Patel" />
	<atom:link rel='hub' href='http://umangpatel.wordpress.com/?pushpress=hub'/>
		<item>
		<title>Find Replace in Text Column Type</title>
		<link>http://umangpatel.wordpress.com/2009/03/09/find-replace-in-text-column-type/</link>
		<comments>http://umangpatel.wordpress.com/2009/03/09/find-replace-in-text-column-type/#comments</comments>
		<pubDate>Mon, 09 Mar 2009 17:30:02 +0000</pubDate>
		<dc:creator>Umang Patel</dc:creator>
				<category><![CDATA[SQL Server]]></category>

		<guid isPermaLink="false">http://umangpatel.wordpress.com/?p=25</guid>
		<description><![CDATA[Text Data Type Most of the functions and techniques you can use for other character data types will not work on a text data type. The data in columns of data type text are not normally stored on the same &#8230; <a href="http://umangpatel.wordpress.com/2009/03/09/find-replace-in-text-column-type/">Continue reading <span class="meta-nav">&#8594;</span></a><img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=umangpatel.wordpress.com&amp;blog=5823987&amp;post=25&amp;subd=umangpatel&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<h3>Text Data Type</h3>
<p>Most of the functions and techniques you can use for other character data types will not work on a text data type. The data in columns of data type text are not normally stored on the same data page with the data in other columns of a table. What is stored with the other columns of a table is the pointer that tells SQL Server where it can find the characters you store in the text column. I believe this is what makes SQL Server treat the text data type differently.</p>
<p>You can’t concatenate characters to a text data type the way you would for a varchar column. You must first cast the text column to a varchar and then concatenate. That works fine until you have more than 8,000 characters in your text column.</p>
<p>You can’t use the function’s LEFT, RIGHT, or LEN on a column of data type text without casting the column as varchar(8000). Again, you will be fine unless you have more than 8,000 characters in the column. To get the length you can use the function DATALENGTH instead of LEN.</p>
<p><strong>UPDATETEXT</strong></p>
<p>Use the below SQL script to make find and replace work in the Text type column. </p>
<p><span style="font-size:x-small;color:#0000ff;"><span style="font-size:x-small;color:#0000ff;"> </p>
<p></span></span></p>
<div>/*** Search &amp; Replace ** Use Ctrl+Shift+M to replace template values**/</div>
<div>set xact_abort on</div>
<div>begin tran</div>
<div>declare @otxt varchar(1000)<br />
set @otxt = &#8216;&lt;string1, text, text to be replaced&gt;&#8217;</div>
<div>declare @ntxt varchar(1000)<br />
set @ntxt = &#8216;&lt;string2, text, replacing text&gt;&#8217;</div>
<div>declare @txtlen int<br />
set @txtlen = len(@otxt)</div>
<div>declare @ptr binary(16)<br />
declare @pos int<br />
declare @id int</div>
<div>declare curs cursor local fast_forward<br />
for<br />
 select id,<br />
 textptr(&lt;field_name, sysname, target text field&gt;),<br />
 charindex(@otxt, &lt;field_name, sysname, target text field&gt;)-1<br />
 from<br />
 &lt;table_name, sysname, target table&gt;<br />
 where<br />
 PATINDEX(&#8216;%&#8217; + @otxt + &#8216;%&#8217;, &lt;field_name, sysname, target text field&gt; ) &gt; 0</div>
<div>open curs</div>
<div>fetch next from curs into @id, @ptr, @pos</div>
<div>while @@fetch_status = 0<br />
begin<br />
While @pos &gt; 0<br />
 BEGIN<br />
  Select<br />
  @pos = CHARINDEX(@otxt, solution) &#8211; 1 <br />
  FROM &lt;table_name, sysname, target table&gt;<br />
  Where id = @id</div>
<div>  print &#8216;Text found in row id=&#8217; + cast(@id as varchar) + &#8216; at pos=&#8217; + cast(@pos as varchar)</div>
<div>  updatetext &lt;table_name, sysname, target table&gt; .&lt;field_name, sysname, target text field&gt; @ptr @pos @txtlen @ntxt<br />
 END<br />
fetch next from curs into @id, @ptr, @pos</div>
<div>end<br />
close curs<br />
deallocate curs<br />
commit tran</div>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/umangpatel.wordpress.com/25/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/umangpatel.wordpress.com/25/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/umangpatel.wordpress.com/25/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/umangpatel.wordpress.com/25/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/umangpatel.wordpress.com/25/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/umangpatel.wordpress.com/25/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/umangpatel.wordpress.com/25/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/umangpatel.wordpress.com/25/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/umangpatel.wordpress.com/25/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/umangpatel.wordpress.com/25/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/umangpatel.wordpress.com/25/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/umangpatel.wordpress.com/25/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/umangpatel.wordpress.com/25/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/umangpatel.wordpress.com/25/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=umangpatel.wordpress.com&amp;blog=5823987&amp;post=25&amp;subd=umangpatel&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://umangpatel.wordpress.com/2009/03/09/find-replace-in-text-column-type/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/d351aba40c2a5e2f2e1ea6a70799b188?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">Umang</media:title>
		</media:content>
	</item>
		<item>
		<title>Working Hours in a Month &#8211; SQL Server</title>
		<link>http://umangpatel.wordpress.com/2009/02/02/working-hours-in-a-month-sql-server/</link>
		<comments>http://umangpatel.wordpress.com/2009/02/02/working-hours-in-a-month-sql-server/#comments</comments>
		<pubDate>Mon, 02 Feb 2009 21:09:53 +0000</pubDate>
		<dc:creator>Umang Patel</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://umangpatel.wordpress.com/?p=21</guid>
		<description><![CDATA[/* Type:  Function Name:  dbo.fnGetWorkingHoursInMonth Author:  Umang Patel Dependencies: None Usage:  select dbo.fnGetWorkingHoursInMonth(getdate(), null)   select dbo.fnGetWorkingHoursInMonth(&#8217;01/01/2008&#8242;, 4) Parameters: @currentDate(datetime)   - The date to use as a starting point   @workingHoursInADay(int) &#8211; Optional, default is 8   - The number of working hours in a day Description: Gets the &#8230; <a href="http://umangpatel.wordpress.com/2009/02/02/working-hours-in-a-month-sql-server/">Continue reading <span class="meta-nav">&#8594;</span></a><img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=umangpatel.wordpress.com&amp;blog=5823987&amp;post=21&amp;subd=umangpatel&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>/*<br />
Type:  Function<br />
Name:  dbo.fnGetWorkingHoursInMonth<br />
Author:  Umang Patel<br />
Dependencies: None<br />
Usage:  select dbo.fnGetWorkingHoursInMonth(getdate(), null)<br />
  select dbo.fnGetWorkingHoursInMonth(&#8217;01/01/2008&#8242;, 4)<br />
Parameters: @currentDate(datetime)<br />
  - The date to use as a starting point</p>
<p>  @workingHoursInADay(int) &#8211; Optional, default is 8<br />
  - The number of working hours in a day<br />
Description:</p>
<p>Gets the number of business days in a month<br />
*/<br />
create function dbo.fnGetWorkingHoursInMonth(<br />
 @currentDate datetime,<br />
 @workingHoursInADay int = null<br />
)<br />
returns int<br />
as</p>
<p>begin</p>
<p>if @workingHoursInADay is null<br />
 set @workingHoursInADay = 8</p>
<p>return dbo.fnGetBusinessDaysInMonth(@currentDate) * @workingHoursInADay</p>
<p>end</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/umangpatel.wordpress.com/21/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/umangpatel.wordpress.com/21/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/umangpatel.wordpress.com/21/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/umangpatel.wordpress.com/21/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/umangpatel.wordpress.com/21/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/umangpatel.wordpress.com/21/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/umangpatel.wordpress.com/21/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/umangpatel.wordpress.com/21/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/umangpatel.wordpress.com/21/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/umangpatel.wordpress.com/21/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/umangpatel.wordpress.com/21/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/umangpatel.wordpress.com/21/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/umangpatel.wordpress.com/21/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/umangpatel.wordpress.com/21/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=umangpatel.wordpress.com&amp;blog=5823987&amp;post=21&amp;subd=umangpatel&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://umangpatel.wordpress.com/2009/02/02/working-hours-in-a-month-sql-server/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/d351aba40c2a5e2f2e1ea6a70799b188?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">Umang</media:title>
		</media:content>
	</item>
		<item>
		<title>Working Days in a Month &#8211; SQL Server</title>
		<link>http://umangpatel.wordpress.com/2009/02/02/working-days-in-a-month-sql-server/</link>
		<comments>http://umangpatel.wordpress.com/2009/02/02/working-days-in-a-month-sql-server/#comments</comments>
		<pubDate>Mon, 02 Feb 2009 21:08:49 +0000</pubDate>
		<dc:creator>Umang Patel</dc:creator>
				<category><![CDATA[SQL Server]]></category>

		<guid isPermaLink="false">http://umangpatel.wordpress.com/?p=19</guid>
		<description><![CDATA[/* Type:  Function Name:  dbo.fnGetBusinessDaysInMonth Author:  Umang Patel Dependencies: None Usage:  select dbo.fnGetBusinessDaysInMonth(getdate())   select dbo.fnGetBusinessDaysInMonth(&#8217;01/01/2008&#8242;) Parameters: @currentDate(datetime)   - The date to use as a starting point Description: Gets the number of business days in a month */ alter function dbo.fnGetBusinessDaysInMonth(  @currentDate datetime ) returns int as &#8230; <a href="http://umangpatel.wordpress.com/2009/02/02/working-days-in-a-month-sql-server/">Continue reading <span class="meta-nav">&#8594;</span></a><img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=umangpatel.wordpress.com&amp;blog=5823987&amp;post=19&amp;subd=umangpatel&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>/*<br />
Type:  Function<br />
Name:  dbo.fnGetBusinessDaysInMonth<br />
Author:  Umang Patel<br />
Dependencies: None<br />
Usage:  select dbo.fnGetBusinessDaysInMonth(getdate())<br />
  select dbo.fnGetBusinessDaysInMonth(&#8217;01/01/2008&#8242;)<br />
Parameters: @currentDate(datetime)<br />
  - The date to use as a starting point<br />
Description:</p>
<p>Gets the number of business days in a month<br />
*/<br />
alter function dbo.fnGetBusinessDaysInMonth(<br />
 @currentDate datetime<br />
)<br />
returns int<br />
as<br />
begin</p>
<p>declare @dateRange int<br />
declare @beginningOfMonthDate datetime, @endOfMonthDate datetime</p>
<p>&#8211; Get the beginning of the month<br />
set @beginningOfMonthDate = dateadd(month, -1, dateadd(day, -1, dateadd(month, datediff(month, 0, @currentDate) + 1, 1)))</p>
<p>&#8211; Get the the beginning date of the next month<br />
set @endOfMonthDate = dateadd(day, -1, dateadd(month, datediff(month, 0, @currentDate) + 1, 1))</p>
<p>&#8211; Get the date range between the beginning and the end of the month<br />
set @dateRange = datediff(day, @beginningOfMonthDate, @endOfMonthDate)</p>
<p>return<br />
(<br />
 &#8211; Get the number of business days by getting the number<br />
 &#8211; of full weeks * 5 days a week plus the number days remaining<br />
 &#8211; minus any days from the remaining days that are a weekend day<br />
 select @dateRange / 7 * 5 + @dateRange % 7 - <br />
 (<br />
         select count(*)<br />
  from<br />
         (<br />
             select 0 as d<br />
             union<br />
             select 1<br />
             union<br />
             select 2<br />
             union<br />
             select 3<br />
             union<br />
             select 4<br />
             union<br />
             select 5<br />
             union<br />
             select 6<br />
         ) weekdays<br />
         where d &lt; @dateRange % 7<br />
          and<br />
   datename(weekday, dateadd(day, -1, @endOfMonthDate) &#8211; d)<br />
          in (&#8216;Saturday&#8217;, &#8216;Sunday&#8217;)<br />
 )<br />
)</p>
<p>end</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/umangpatel.wordpress.com/19/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/umangpatel.wordpress.com/19/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/umangpatel.wordpress.com/19/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/umangpatel.wordpress.com/19/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/umangpatel.wordpress.com/19/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/umangpatel.wordpress.com/19/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/umangpatel.wordpress.com/19/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/umangpatel.wordpress.com/19/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/umangpatel.wordpress.com/19/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/umangpatel.wordpress.com/19/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/umangpatel.wordpress.com/19/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/umangpatel.wordpress.com/19/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/umangpatel.wordpress.com/19/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/umangpatel.wordpress.com/19/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=umangpatel.wordpress.com&amp;blog=5823987&amp;post=19&amp;subd=umangpatel&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://umangpatel.wordpress.com/2009/02/02/working-days-in-a-month-sql-server/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/d351aba40c2a5e2f2e1ea6a70799b188?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">Umang</media:title>
		</media:content>
	</item>
		<item>
		<title>SSIS Package Protection Level</title>
		<link>http://umangpatel.wordpress.com/2009/01/07/ssis-package-protection-level/</link>
		<comments>http://umangpatel.wordpress.com/2009/01/07/ssis-package-protection-level/#comments</comments>
		<pubDate>Wed, 07 Jan 2009 21:01:15 +0000</pubDate>
		<dc:creator>Umang Patel</dc:creator>
				<category><![CDATA[SQL Server]]></category>
		<category><![CDATA[SQL Server Integration Service]]></category>
		<category><![CDATA[SSIS]]></category>

		<guid isPermaLink="false">http://umangpatel.wordpress.com/?p=16</guid>
		<description><![CDATA[Decrypt package secrets The default setting for the SSIS package ProtectionLevel property is EncryptSensitiveWithUserKey. When the package is saved, SSIS encrypts only the parts of the package that contain properties that are marked &#8220;sensitive,&#8221; such as passwords, usernames, and connection &#8230; <a href="http://umangpatel.wordpress.com/2009/01/07/ssis-package-protection-level/">Continue reading <span class="meta-nav">&#8594;</span></a><img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=umangpatel.wordpress.com&amp;blog=5823987&amp;post=16&amp;subd=umangpatel&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<h3>Decrypt package secrets</h3>
<p>The default setting for the SSIS package <strong>ProtectionLevel</strong> property is EncryptSensitiveWithUserKey. When the package is saved, SSIS encrypts only the parts of the package that contain properties that are marked &#8220;sensitive,&#8221; such as passwords, usernames, and connection strings. Therefore, when the package is reloaded, the current user must satisfy the encryption requirements for the sensitive properties to be decrypted. However, the current user does not have to satisfy the encryption requirements to load the package. When you run the package through a SQL Server Agent job step, the default account is the SQL Server Agent Service account. This default account is most likely a different user than the package author. Therefore, the SQL Server Agent job step can load and start to run the job step, but the package fails because it cannot complete a connection. For example, the package cannot complete an OLE DB connection or an FTP connection. The package fails because it cannot decrypt the credentials that it must have to connect.</p>
<p><strong>Important</strong> Consider the development process and the environment to determine which accounts are needed and used on each computer. The EncryptSensitiveWithUserKey setting of the <strong>ProtectionLevel</strong> property is a powerful setting. This setting should not be discounted because it causes deployment complications at first. You can encrypt the packages when you are logged in to the appropriate account. You can also use the Dtutil.exe SSIS command-line utility to change the protection levels by using a .cmd file and the SQL Server Agent command subsystem. For example, follow these steps. Because you can use the Dtutil.exe utility in batch files and loops, you can follow these steps for several packages at the same time.</p>
<ol>
<li>Modify the package that you want to encrypt by using a password.</li>
<li>Use the Dtutil.exe utility through an <strong class="uiterm">Operating System (cmd Exec)</strong> SQL Server Agent job step to change the <strong>ProtectionLevel</strong> property to EncryptSensitiveWithUserKey. This process involves decrypting the package by using the password, and then re-encrypting the package. The user key that is used to encrypt the package is the SQL Server Agent job step setting in the <strong class="uiterm">Run As</strong> list.
<p><strong>Note</strong> Because the key includes the user name and the computer name, the effect of moving the packages to another computer may be limited.</li>
</ol>
<p><strong>Other Solution</strong></p>
<p>Set the SSIS Package protection level to EncryptSensitiveWithPassword and this will require to set the protection level password when Package is being run by the SQL Job, its require to set the password while configuring the steps.</p>
<p>But this will resolve the issue with development environment and deploying in the SQL Server.</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/umangpatel.wordpress.com/16/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/umangpatel.wordpress.com/16/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/umangpatel.wordpress.com/16/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/umangpatel.wordpress.com/16/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/umangpatel.wordpress.com/16/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/umangpatel.wordpress.com/16/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/umangpatel.wordpress.com/16/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/umangpatel.wordpress.com/16/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/umangpatel.wordpress.com/16/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/umangpatel.wordpress.com/16/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/umangpatel.wordpress.com/16/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/umangpatel.wordpress.com/16/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/umangpatel.wordpress.com/16/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/umangpatel.wordpress.com/16/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=umangpatel.wordpress.com&amp;blog=5823987&amp;post=16&amp;subd=umangpatel&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://umangpatel.wordpress.com/2009/01/07/ssis-package-protection-level/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/d351aba40c2a5e2f2e1ea6a70799b188?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">Umang</media:title>
		</media:content>
	</item>
		<item>
		<title>Delete .svn Folders in Windows</title>
		<link>http://umangpatel.wordpress.com/2008/12/30/delete-svn-folders-in-windows/</link>
		<comments>http://umangpatel.wordpress.com/2008/12/30/delete-svn-folders-in-windows/#comments</comments>
		<pubDate>Tue, 30 Dec 2008 14:24:47 +0000</pubDate>
		<dc:creator>Umang Patel</dc:creator>
				<category><![CDATA[Script]]></category>

		<guid isPermaLink="false">http://umangpatel.wordpress.com/?p=11</guid>
		<description><![CDATA[I found this good script to remove the .svn folders from Windows. FOR /F &#8220;tokens=*&#8221; %%G IN (&#8216;DIR /B /AD /S *.svn*&#8217;) DO RMDIR /S /Q %%G Just copy and paste above script and create a batch file with conventional &#8230; <a href="http://umangpatel.wordpress.com/2008/12/30/delete-svn-folders-in-windows/">Continue reading <span class="meta-nav">&#8594;</span></a><img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=umangpatel.wordpress.com&amp;blog=5823987&amp;post=11&amp;subd=umangpatel&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>I found this good script to remove the .svn folders from Windows.</p>
<p><strong>FOR /F &#8220;tokens=*&#8221; %%G IN (&#8216;DIR /B /AD /S *.svn*&#8217;) DO RMDIR /S /Q %%G</strong></p>
<p>Just copy and paste above script and create a batch file with conventional name, and run the batch file from parent folder.</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/umangpatel.wordpress.com/11/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/umangpatel.wordpress.com/11/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/umangpatel.wordpress.com/11/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/umangpatel.wordpress.com/11/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/umangpatel.wordpress.com/11/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/umangpatel.wordpress.com/11/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/umangpatel.wordpress.com/11/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/umangpatel.wordpress.com/11/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/umangpatel.wordpress.com/11/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/umangpatel.wordpress.com/11/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/umangpatel.wordpress.com/11/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/umangpatel.wordpress.com/11/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/umangpatel.wordpress.com/11/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/umangpatel.wordpress.com/11/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=umangpatel.wordpress.com&amp;blog=5823987&amp;post=11&amp;subd=umangpatel&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://umangpatel.wordpress.com/2008/12/30/delete-svn-folders-in-windows/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/d351aba40c2a5e2f2e1ea6a70799b188?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">Umang</media:title>
		</media:content>
	</item>
		<item>
		<title>Extension Methods in C# 3.0</title>
		<link>http://umangpatel.wordpress.com/2008/12/12/extension-methods-in-c-30/</link>
		<comments>http://umangpatel.wordpress.com/2008/12/12/extension-methods-in-c-30/#comments</comments>
		<pubDate>Fri, 12 Dec 2008 19:34:58 +0000</pubDate>
		<dc:creator>Umang Patel</dc:creator>
				<category><![CDATA[C#]]></category>

		<guid isPermaLink="false">http://umangpatel.wordpress.com/?p=9</guid>
		<description><![CDATA[Extension methods are static methods that can be invoked using instance method syntax. In effect, extension methods make it possible to extend existing types and constructed types with additional methods. Note Extension methods are less discoverable and more limited in &#8230; <a href="http://umangpatel.wordpress.com/2008/12/12/extension-methods-in-c-30/">Continue reading <span class="meta-nav">&#8594;</span></a><img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=umangpatel.wordpress.com&amp;blog=5823987&amp;post=9&amp;subd=umangpatel&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p class="MsoNormal" style="margin:0;"><span style="font-size:10pt;color:#333333;font-family:Verdana;">Extension methods are static methods that can be invoked using instance method syntax. In effect, extension methods make it possible to extend existing types and constructed types with additional methods.</p>
<p>Note Extension methods are less discoverable and more limited in functionality than instance methods. For those reasons, it is recommended that extension methods be used sparingly and only in situations where instance methods are not feasible or possible.</p>
<p>Extension members of other kinds, such as properties, events, and operators, are being considered but are currently not supported.</p>
<p><strong>Declaring Extension Methods<br />
</strong>Extension methods are declared by specifying the keyword this as a modifier on the first parameter of the methods. Extension methods can only be declared in static classes. The following is an example of a static class that declares two extension methods:namespace</p>
<p>Acme.Utilities<br />
{<br />
public static class Extensions<br />
{<br />
public static int ToInt32(this string s) {<br />
return Int32.Parse(s);<br />
}<br />
public static T[] Slice(this T[] source, int index, int count) {<br />
if (index &lt; result =&#8221; new&#8221;&gt;</span></p>
<p class="MsoNormal" style="margin:0;"><span style="font-size:10pt;color:#333333;font-family:Verdana;"> </span></p>
<p class="MsoNormal" style="margin:0;"><strong><span style="font-size:10pt;color:#333333;font-family:Verdana;">Importing Extension Methods<br />
</span></strong><span style="font-size:10pt;color:#333333;font-family:Verdana;">Extension methods are imported through using-namespace-directives. In addition to importing the types contained in a namespace, a using-namespace-directive imports all extension methods in all static classes in the namespace. In effect, imported extension methods appear as additional methods on the types that are given by their first parameter and have lower precedence than regular instance methods. For example, when the Acme.Utilities namespace from the example above is imported with the using-namespace-directiveusing</p>
<p>Acme.Utilities;<br />
it becomes possible to invoke the extension methods in the static class Extensions </span></p>
<p class="MsoNormal" style="margin:0;"><span style="font-size:10pt;color:#333333;font-family:Verdana;"> </span></p>
<p class="MsoNormal" style="margin:0;"><span style="font-size:10pt;color:#333333;font-family:Verdana;">using instance method syntax:string s = &#8220;1234&#8243;;<br />
int i = s.ToInt32(); // Same as Extensions.ToInt32(s)<br />
int[] digits = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9};<br />
int[] a = digits.Slice(4, 3); // Same as Extensions.Slice(digits, 4, 3)</p>
<p><strong>Extension Method Invocations<br />
</strong>The detailed rules for extension method invocation are described in the following. In a method invocation of one of the </span></p>
<p class="MsoNormal" style="margin:0;"><span style="font-size:10pt;color:#333333;font-family:Verdana;"> </span></p>
<p class="MsoNormal" style="margin:0;"><span style="font-size:10pt;color:#333333;font-family:Verdana;">formsexpr.identifier( )<br />
expr . identifier ( args )<br />
expr . identifier &lt;&gt; ( )<br />
expr . identifier &lt;&gt; ( args )</p>
<p>if the normal processing of the invocation finds no applicable instance methods (specifically, if the set of candidate methods for the invocation is empty), an attempt is made to process the construct as an extension method invocation. The method invocation is first rewritten to one of the following, respectively:identifier ( expr )</p>
<p></span></p>
<p class="MsoNormal" style="margin:0;"><span style="font-size:10pt;color:#333333;font-family:Verdana;">identifier ( expr , args )<br />
identifier &lt;&gt; ( expr )<br />
identifier &lt;&gt; ( expr , args )</p>
<p>The rewritten form is then processed as a static method invocation, except for the way in which identifier is resolved: Starting with the closest enclosing namespace declaration, continuing with each enclosing namespace declaration, and ending with the containing compilation unit, successive attempts are made to process the rewritten method invocation with a method group consisting of all accessible extension methods with the name given by identifier imported by the namespace declaration&#8217;s using-namespace-directives. The first method group that yields a non-empty set of candidate methods is the one chosen for the rewritten method invocation. If all attempts yield empty sets of candidate methods, a compile-time error occurs.</p>
<p>The preceding rules mean that instance methods take precedence over extension methods, and extension methods imported in inner namespace declarations take precedence over extension methods imported in outer namespace declarations. </span></p>
<p class="MsoNormal" style="margin:0;"><span style="font-size:10pt;color:#333333;font-family:Verdana;"> </span></p>
<p class="MsoNormal" style="margin:0;"><span style="font-size:10pt;color:#333333;font-family:Verdana;">For example: using N1;</p>
<p>namespace N1<br />
{<br />
public static class E<br />
{<br />
public static void F(this object obj, int i) { }<br />
public static void F(this object obj, string s) { }<br />
}<br />
}<br />
class A { }<br />
class B<br />
{<br />
public void F(int i) { }<br />
}<br />
class C<br />
{<br />
public void F(object obj) { }<br />
}<br />
class X<br />
{<br />
static void Test(A a, B b, C c) {<br />
a.F(1); // E.F(object, int)<br />
a.F(&#8220;hello&#8221;); // E.F(object, string)<br />
b.F(1); // B.F(int)<br />
b.F(&#8220;hello&#8221;); // E.F(object, string)<br />
c.F(1); // C.F(object)<br />
c.F(&#8220;hello&#8221;); // C.F(object)<br />
}<br />
}</p>
<p>In the example, B&#8217;s method takes precedence over the first extension method, and C&#8217;s method takes precedence over both extension methods.</span></p>
<p class="MsoNormal" style="margin:0;"><span style="font-size:10pt;color:#333333;font-family:Verdana;"> </span></p>
<p class="MsoNormal" style="margin:0;"><span style="font-size:10pt;font-family:Verdana;"> </span></p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/umangpatel.wordpress.com/9/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/umangpatel.wordpress.com/9/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/umangpatel.wordpress.com/9/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/umangpatel.wordpress.com/9/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/umangpatel.wordpress.com/9/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/umangpatel.wordpress.com/9/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/umangpatel.wordpress.com/9/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/umangpatel.wordpress.com/9/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/umangpatel.wordpress.com/9/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/umangpatel.wordpress.com/9/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/umangpatel.wordpress.com/9/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/umangpatel.wordpress.com/9/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/umangpatel.wordpress.com/9/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/umangpatel.wordpress.com/9/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=umangpatel.wordpress.com&amp;blog=5823987&amp;post=9&amp;subd=umangpatel&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://umangpatel.wordpress.com/2008/12/12/extension-methods-in-c-30/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/d351aba40c2a5e2f2e1ea6a70799b188?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">Umang</media:title>
		</media:content>
	</item>
		<item>
		<title>Text Qualifier in Column Names</title>
		<link>http://umangpatel.wordpress.com/2008/12/12/text-qualifier-in-column-names/</link>
		<comments>http://umangpatel.wordpress.com/2008/12/12/text-qualifier-in-column-names/#comments</comments>
		<pubDate>Fri, 12 Dec 2008 18:00:13 +0000</pubDate>
		<dc:creator>Umang Patel</dc:creator>
				<category><![CDATA[SQL Server]]></category>
		<category><![CDATA[SQL Server Integration Service]]></category>
		<category><![CDATA[SSIS]]></category>

		<guid isPermaLink="false">http://umangpatel.wordpress.com/?p=3</guid>
		<description><![CDATA[If you have a flat file with quotes around the data as text qualifiers you may have seen the issue where the headers has the quotes even after you put the quote in as the text qualifier. This is a &#8230; <a href="http://umangpatel.wordpress.com/2008/12/12/text-qualifier-in-column-names/">Continue reading <span class="meta-nav">&#8594;</span></a><img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=umangpatel.wordpress.com&amp;blog=5823987&amp;post=3&amp;subd=umangpatel&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p class="MsoNormal" style="margin:0;"><span style="font-size:10pt;color:black;font-family:Verdana;">If you have a flat file with quotes around the data as text qualifiers you may have seen the issue where the headers has the quotes even after you put the quote in as the text qualifier. This is a simple issue to resolve. If you check the box “Columns names in the first data row” SSIS sets the first row as the metadata for the column names.  </span></p>
<p class="MsoNormal" style="margin:0 0 10pt;"><span style="font-size:10pt;color:black;font-family:Verdana;">The problem comes when the data has a text qualifier. The text qualifiers end up in the column names.</span></p>
<p class="MsoNormal" style="margin:0;"><span style="font-size:10pt;color:black;font-family:Verdana;">At this point some people will and check the “Columns names in the first data row” first, and then put in a text qualifier. The problem with that is the text qualifiers end up in the metadata.  </span></p>
<p class="MsoNormal" style="margin:0 0 10pt;"><span style="font-size:10pt;color:black;font-family:Verdana;">To fix this, always enter the text qualifier first then check the box for the column headers.</span></p>
<p class="MsoNormal" style="margin:0 0 10pt;"><span style="font-size:10pt;color:black;font-family:Verdana;">This will tell SSIS that the text qualifiers are in the first row before it sets that row as the metadata.</span></p>
<p class="MsoNormal" style="margin:0;"><span style="font-size:10pt;font-family:Verdana;"> </span></p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/umangpatel.wordpress.com/3/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/umangpatel.wordpress.com/3/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/umangpatel.wordpress.com/3/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/umangpatel.wordpress.com/3/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/umangpatel.wordpress.com/3/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/umangpatel.wordpress.com/3/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/umangpatel.wordpress.com/3/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/umangpatel.wordpress.com/3/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/umangpatel.wordpress.com/3/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/umangpatel.wordpress.com/3/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/umangpatel.wordpress.com/3/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/umangpatel.wordpress.com/3/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/umangpatel.wordpress.com/3/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/umangpatel.wordpress.com/3/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=umangpatel.wordpress.com&amp;blog=5823987&amp;post=3&amp;subd=umangpatel&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://umangpatel.wordpress.com/2008/12/12/text-qualifier-in-column-names/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/d351aba40c2a5e2f2e1ea6a70799b188?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">Umang</media:title>
		</media:content>
	</item>
	</channel>
</rss>
