<?xml version="1.0" encoding="utf-8"?>
<rss xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:pingback="http://madskills.com/public/xml/rss/module/pingback/" xmlns:trackback="http://madskills.com/public/xml/rss/module/trackback/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:dc="http://purl.org/dc/elements/1.1/" version="2.0">
  <channel>
    <title>Man Made Code</title>
    <link>http://manmadecode.com/</link>
    <description>Hi All,

This is a pure Technology Blog. If you are a software developer or a technology dude, read this blog. We discuss here only the coding issues and technical issues faced by a software developer. The blog also focus to share software development tips and tricks with openness to ideation.  </description>
    <language>en-us</language>
    <copyright>ManMadeCode.com</copyright>
    <lastBuildDate>Fri, 13 Nov 2009 18:14:59 GMT</lastBuildDate>
    <generator>newtelligence dasBlog 2.1.8102.813</generator>
    <managingEditor>akash.heranjal@gmail.com</managingEditor>
    <webMaster>akash.heranjal@gmail.com</webMaster>
    <item>
      <trackback:ping>http://manmadecode.com/Trackback.aspx?guid=9b41b9b7-4f5c-4b73-952d-931b45548632</trackback:ping>
      <pingback:server>http://manmadecode.com/pingback.aspx</pingback:server>
      <pingback:target>http://manmadecode.com/PermaLink,guid,9b41b9b7-4f5c-4b73-952d-931b45548632.aspx</pingback:target>
      <dc:creator>Akash Heranjal</dc:creator>
      <wfw:comment>http://manmadecode.com/CommentView,guid,9b41b9b7-4f5c-4b73-952d-931b45548632.aspx</wfw:comment>
      <wfw:commentRss>http://manmadecode.com/SyndicationService.asmx/GetEntryCommentsRss?guid=9b41b9b7-4f5c-4b73-952d-931b45548632</wfw:commentRss>
      <body xmlns="http://www.w3.org/1999/xhtml">
        <p>
This article is specific to MS SQL Server. There can be various need based scenarios
where the data returned by the SELECT statement should be limited to certain length
for the columns of data type VARCHAR(MAX), NVARCHAR(MAX), VARBINARY(MAX), TEXT, NTEXT,
and IMAGE data types. This can be achieved using <i>SUBSTRING</i> or <i>LEFT</i> functions
for specific columns in SELECT statement. But if you have a SELECT statement having
many columns of the data types specified before and you want to apply data returned
length limitation for each column, the better option would be to use <i>TEXTSIZE</i> command. 
<br /><br /><b>TEXTSIZE</b> command in SQL Server can be used to limit the length of data returned
for each column in a SELECT statement. This command is applicable to the columns of
following data types: 
</p>
        <ul>
          <li>
VARCHAR(MAX)</li>
          <li>
NVARCHAR(MAX)</li>
          <li>
VARBINARY(MAX)</li>
          <li>
TEXT</li>
          <li>
NTEXT</li>
          <li>
IMAGE</li>
        </ul>
The syntax to use the command is as given below:<br /><font color="#990000"><i>SET TEXTSIZE &lt; Specify the number of bytes here &gt; </i></font><br /><br /><u>Example:</u><br />
The below statement will set the data returned length to 200 characters and run the
SELECT command with the data returned length to 200 characters for each column<br /><font color="#990000"><i>SET TEXTSIZE 200<br />
SELECT RecID, TxtCol01, TxtCol02, TxtCol03 from MyTableName</i></font><br /><br />
To fetch the default size of TEXTSIZE, use the below command<br /><font color="#990000"><i>SELECT @@TEXTSIZE</i></font><br /><br />
To set the TEXTSIZE value to its default value of <b><i>2147483647</i></b> bytes,
use the below command<br /><font color="#990000"><i>SET TEXTSIZE 2147483647</i></font><br /><br /><p></p><img width="0" height="0" src="http://manmadecode.com/aggbug.ashx?id=9b41b9b7-4f5c-4b73-952d-931b45548632" /></body>
      <title>How to limit the data returned by each columns in a SELECT statement?</title>
      <guid isPermaLink="false">http://manmadecode.com/PermaLink,guid,9b41b9b7-4f5c-4b73-952d-931b45548632.aspx</guid>
      <link>http://manmadecode.com/2009/11/13/HowToLimitTheDataReturnedByEachColumnsInASELECTStatement.aspx</link>
      <pubDate>Fri, 13 Nov 2009 18:14:59 GMT</pubDate>
      <description>&lt;p&gt;
This article is specific to MS SQL Server. There can be various need based scenarios
where the data returned by the SELECT statement should be limited to certain length
for the columns of data type VARCHAR(MAX), NVARCHAR(MAX), VARBINARY(MAX), TEXT, NTEXT,
and IMAGE data types. This can be achieved using &lt;i&gt;SUBSTRING&lt;/i&gt; or &lt;i&gt;LEFT&lt;/i&gt; functions
for specific columns in SELECT statement. But if you have a SELECT statement having
many columns of the data types specified before and you want to apply data returned
length limitation for each column, the better option would be to use &lt;i&gt;TEXTSIZE&lt;/i&gt; command. 
&lt;br&gt;
&lt;br&gt;
&lt;b&gt;TEXTSIZE&lt;/b&gt; command in SQL Server can be used to limit the length of data returned
for each column in a SELECT statement. This command is applicable to the columns of
following data types: 
&lt;ul&gt;
&lt;li&gt;
VARCHAR(MAX)&lt;/li&gt;
&lt;li&gt;
NVARCHAR(MAX)&lt;/li&gt;
&lt;li&gt;
VARBINARY(MAX)&lt;/li&gt;
&lt;li&gt;
TEXT&lt;/li&gt;
&lt;li&gt;
NTEXT&lt;/li&gt;
&lt;li&gt;
IMAGE&lt;/li&gt;
&lt;/ul&gt;
The syntax to use the command is as given below:&lt;br&gt;
&lt;font color=#990000&gt;&lt;i&gt;SET TEXTSIZE &amp;lt; Specify the number of bytes here &amp;gt; &lt;/i&gt;&lt;/font&gt;
&lt;br&gt;
&lt;br&gt;
&lt;u&gt;Example:&lt;/u&gt; 
&lt;br&gt;
The below statement will set the data returned length to 200 characters and run the
SELECT command with the data returned length to 200 characters for each column&lt;br&gt;
&lt;font color=#990000&gt;&lt;i&gt;SET TEXTSIZE 200&lt;br&gt;
SELECT RecID, TxtCol01, TxtCol02, TxtCol03 from MyTableName&lt;/i&gt;&lt;/font&gt;
&lt;br&gt;
&lt;br&gt;
To fetch the default size of TEXTSIZE, use the below command&lt;br&gt;
&lt;font color=#990000&gt;&lt;i&gt;SELECT @@TEXTSIZE&lt;/i&gt;&lt;/font&gt;
&lt;br&gt;
&lt;br&gt;
To set the TEXTSIZE value to its default value of &lt;b&gt;&lt;i&gt;2147483647&lt;/i&gt;&lt;/b&gt; bytes,
use the below command&lt;br&gt;
&lt;font color=#990000&gt;&lt;i&gt;SET TEXTSIZE 2147483647&lt;/i&gt;&lt;/font&gt;
&lt;br&gt;
&lt;br&gt;
&lt;p&gt;
&lt;/p&gt;
&lt;img width="0" height="0" src="http://manmadecode.com/aggbug.ashx?id=9b41b9b7-4f5c-4b73-952d-931b45548632" /&gt;</description>
      <comments>http://manmadecode.com/CommentView,guid,9b41b9b7-4f5c-4b73-952d-931b45548632.aspx</comments>
      <category>Databases</category>
      <category>SQL Server</category>
    </item>
    <item>
      <trackback:ping>http://manmadecode.com/Trackback.aspx?guid=615d9eb0-214c-4384-9e30-541c545b1c1a</trackback:ping>
      <pingback:server>http://manmadecode.com/pingback.aspx</pingback:server>
      <pingback:target>http://manmadecode.com/PermaLink,guid,615d9eb0-214c-4384-9e30-541c545b1c1a.aspx</pingback:target>
      <dc:creator>Akash Heranjal</dc:creator>
      <wfw:comment>http://manmadecode.com/CommentView,guid,615d9eb0-214c-4384-9e30-541c545b1c1a.aspx</wfw:comment>
      <wfw:commentRss>http://manmadecode.com/SyndicationService.asmx/GetEntryCommentsRss?guid=615d9eb0-214c-4384-9e30-541c545b1c1a</wfw:commentRss>
      <body xmlns="http://www.w3.org/1999/xhtml">
        <p>
When we talk about swapping of data between two columns of a table in SQL Server,
most of us think of writing SQL scripts in Stored Procedure to achieve it. Well, is
it really required? Can a one line statement be written to swap data between two columns
in a table? The answer is yes. In this article I cover a simple technique to swap
data between two columns of a table. 
<br /><br />
Consider a table by name "MyTable" having 3 fields RecID as Integer, ColValue01 as
VarChar of 50 and ColValue02 as VarChar of 50; as written in the below SQL statement<br /><i><font color="#990000">CREATE TABLE [MyTable] (RecID INT, ColValue01 VARCHAR(50),
ColValue02 VARCHAR(50))</font></i><br /><br />
Now due to some program error, the data which was suppose to go to ColValue02 has
gone to ColValue01 and Vise-a-Versa. We need to swap the data between the two columns,
run the below script to achieve the same. 
<br /><br />
#Option 01: The process is simple, first declare a temp variable, move column 2 value
to temp variable, then move column 1 value to column 2 and finally move temp variable
value to column 2. 
<br /><br /><i><font color="#990000">DECLARE @MyTemp AS VARCHAR(50)<br />
UPDATE [MyTable] SET @MyTemp = ColValue02, ColValue02 = ColValue01, ColValue01 = @MyTemp))</font></i><br /><br />
#Option 02: The same result can be achieved without using a temp variable by simply
cross assigning the column names as shown the scrip below.<br /><i><font color="#990000">UPDATE [MyTable] SET ColValue01 = ColValue02, ColValue02
= ColValue01))</font></i><br /><br />
Note: The column data can be exchanged between two or more columns of same data type
only. 
<br /></p>
        <img width="0" height="0" src="http://manmadecode.com/aggbug.ashx?id=615d9eb0-214c-4384-9e30-541c545b1c1a" />
      </body>
      <title>How to swap data between two columns of a table in SQL Server?</title>
      <guid isPermaLink="false">http://manmadecode.com/PermaLink,guid,615d9eb0-214c-4384-9e30-541c545b1c1a.aspx</guid>
      <link>http://manmadecode.com/2009/08/16/HowToSwapDataBetweenTwoColumnsOfATableInSQLServer.aspx</link>
      <pubDate>Sun, 16 Aug 2009 17:45:17 GMT</pubDate>
      <description>&lt;p&gt;
When we talk about swapping of data between two columns of a table in SQL Server,
most of us think of writing SQL scripts in Stored Procedure to achieve it. Well, is
it really required? Can a one line statement be written to swap data between two columns
in a table? The answer is yes. In this article I cover a simple technique to swap
data between two columns of a table. 
&lt;br&gt;
&lt;br&gt;
Consider a table by name "MyTable" having 3 fields RecID as Integer, ColValue01 as
VarChar of 50 and ColValue02 as VarChar of 50; as written in the below SQL statement&lt;br&gt;
&lt;i&gt;&lt;font color=#990000&gt;CREATE TABLE [MyTable] (RecID INT, ColValue01 VARCHAR(50),
ColValue02 VARCHAR(50))&lt;/font&gt;&lt;/i&gt; 
&lt;br&gt;
&lt;br&gt;
Now due to some program error, the data which was suppose to go to ColValue02 has
gone to ColValue01 and Vise-a-Versa. We need to swap the data between the two columns,
run the below script to achieve the same. 
&lt;br&gt;
&lt;br&gt;
#Option 01: The process is simple, first declare a temp variable, move column 2 value
to temp variable, then move column 1 value to column 2 and finally move temp variable
value to column 2. 
&lt;br&gt;
&lt;br&gt;
&lt;i&gt;&lt;font color=#990000&gt;DECLARE @MyTemp AS VARCHAR(50)&lt;br&gt;
UPDATE [MyTable] SET @MyTemp = ColValue02, ColValue02 = ColValue01, ColValue01 = @MyTemp))&lt;/font&gt;&lt;/i&gt; 
&lt;br&gt;
&lt;br&gt;
#Option 02: The same result can be achieved without using a temp variable by simply
cross assigning the column names as shown the scrip below.&lt;br&gt;
&lt;i&gt;&lt;font color=#990000&gt;UPDATE [MyTable] SET ColValue01 = ColValue02, ColValue02 =
ColValue01))&lt;/font&gt;&lt;/i&gt; 
&lt;br&gt;
&lt;br&gt;
Note: The column data can be exchanged between two or more columns of same data type
only. 
&lt;br&gt;
&lt;/p&gt;
&lt;img width="0" height="0" src="http://manmadecode.com/aggbug.ashx?id=615d9eb0-214c-4384-9e30-541c545b1c1a" /&gt;</description>
      <comments>http://manmadecode.com/CommentView,guid,615d9eb0-214c-4384-9e30-541c545b1c1a.aspx</comments>
      <category>Databases</category>
      <category>SQL Server</category>
    </item>
    <item>
      <trackback:ping>http://manmadecode.com/Trackback.aspx?guid=ba64230e-b07d-4d6e-9b78-a085ce5b8aa5</trackback:ping>
      <pingback:server>http://manmadecode.com/pingback.aspx</pingback:server>
      <pingback:target>http://manmadecode.com/PermaLink,guid,ba64230e-b07d-4d6e-9b78-a085ce5b8aa5.aspx</pingback:target>
      <dc:creator>Akash Heranjal</dc:creator>
      <wfw:comment>http://manmadecode.com/CommentView,guid,ba64230e-b07d-4d6e-9b78-a085ce5b8aa5.aspx</wfw:comment>
      <wfw:commentRss>http://manmadecode.com/SyndicationService.asmx/GetEntryCommentsRss?guid=ba64230e-b07d-4d6e-9b78-a085ce5b8aa5</wfw:commentRss>
      <body xmlns="http://www.w3.org/1999/xhtml">A Favicon is the little image displayed
in your favorites and in the left corner of the Address Bar of Internet Explorer when
you bookmark a page. The Favicon was first popularized by its appearance in the "Address
Bar" and "Favorites Folder" using Internet Explorer. Currently, Internet Explorer
5.x (IE 5.x), Linux's Konqueror and Mozilla/Netscape 6.x (NS 6.x) Web browsers support
the Favicon function. 
<br /><br />
A Favicon is a 16x16 pixel, 16 color icon graphics image with an .ico extension. It
can be made in most graphic programs. To make it work you create the 16 x 16 pixel
graphic, save it as Favicon.ico and upload it to the root directory of your web site
(Upload using Binary Transfer Mode). Then add the following html code in between the
heading tags of the web pages where you want the Favicon to appear. 
<br /><br /><font color="#990000">&lt;HTML&gt; 
<br />
&lt;HEAD&gt; 
<br /><b><i>&lt;LINK REL="Shortcut Icon" href="http://www.yourdomain.com/Favicon.ico"&gt; 
<br /></i></b>&lt;/HEAD&gt; 
<br />
&lt;BODY&gt; 
<br />
……………….. 
<br />
……………….. 
<br />
……………….. 
<br />
……………….. 
<br />
&lt;/BODY&gt; 
<br />
&lt;/HTML&gt; 
<br /><br /></font>There are some common problems with Favicon. They are not permanent and are
stored in your temporary Internet files folder. If your Temporary Internet Files folder
is cleared, your Favicons will be lost. In some cases, although you have changed the
Favicon it is not reflected in the browser, this could be because of the cache problem.
The browser may not be refreshing the Favicon. Just click on the browser default icon
(In IE it is the blue color "e" symbol in the address bar) or your old Favicon and
drag it to the body (Web page document area). This will refresh the Favicon of the
browser and show the new Favicon of your web site. 
<br /><br /><img width="0" height="0" src="http://manmadecode.com/aggbug.ashx?id=ba64230e-b07d-4d6e-9b78-a085ce5b8aa5" /></body>
      <title>Favicon – The little icon on the address bar</title>
      <guid isPermaLink="false">http://manmadecode.com/PermaLink,guid,ba64230e-b07d-4d6e-9b78-a085ce5b8aa5.aspx</guid>
      <link>http://manmadecode.com/2009/07/14/FaviconTheLittleIconOnTheAddressBar.aspx</link>
      <pubDate>Tue, 14 Jul 2009 12:52:24 GMT</pubDate>
      <description>A Favicon is the little image displayed in your favorites and in the left corner of the Address Bar of Internet Explorer when you bookmark a page. The Favicon was first popularized by its appearance in the "Address Bar" and "Favorites Folder" using Internet Explorer. Currently, Internet Explorer 5.x (IE 5.x), Linux's Konqueror and Mozilla/Netscape 6.x (NS 6.x) Web browsers support the Favicon function. &lt;br&gt;
&lt;br&gt;
A Favicon is a 16x16 pixel, 16 color icon graphics image with an .ico extension. It
can be made in most graphic programs. To make it work you create the 16 x 16 pixel
graphic, save it as Favicon.ico and upload it to the root directory of your web site
(Upload using Binary Transfer Mode). Then add the following html code in between the
heading tags of the web pages where you want the Favicon to appear. 
&lt;br&gt;
&lt;br&gt;
&lt;font color=#990000&gt;&amp;lt;HTML&amp;gt; 
&lt;br&gt;
&amp;lt;HEAD&amp;gt; 
&lt;br&gt;
&lt;b&gt;&lt;i&gt;&amp;lt;LINK REL="Shortcut Icon" href="http://www.yourdomain.com/Favicon.ico"&amp;gt; 
&lt;br&gt;
&lt;/i&gt;&lt;/b&gt;&amp;lt;/HEAD&amp;gt; 
&lt;br&gt;
&amp;lt;BODY&amp;gt; 
&lt;br&gt;
……………….. 
&lt;br&gt;
……………….. 
&lt;br&gt;
……………….. 
&lt;br&gt;
……………….. 
&lt;br&gt;
&amp;lt;/BODY&amp;gt; 
&lt;br&gt;
&amp;lt;/HTML&amp;gt; 
&lt;br&gt;
&lt;br&gt;
&lt;/font&gt;There are some common problems with Favicon. They are not permanent and are
stored in your temporary Internet files folder. If your Temporary Internet Files folder
is cleared, your Favicons will be lost. In some cases, although you have changed the
Favicon it is not reflected in the browser, this could be because of the cache problem.
The browser may not be refreshing the Favicon. Just click on the browser default icon
(In IE it is the blue color "e" symbol in the address bar) or your old Favicon and
drag it to the body (Web page document area). This will refresh the Favicon of the
browser and show the new Favicon of your web site. 
&lt;br&gt;
&lt;br&gt;
&lt;img width="0" height="0" src="http://manmadecode.com/aggbug.ashx?id=ba64230e-b07d-4d6e-9b78-a085ce5b8aa5" /&gt;</description>
      <comments>http://manmadecode.com/CommentView,guid,ba64230e-b07d-4d6e-9b78-a085ce5b8aa5.aspx</comments>
      <category>Classic ASP</category>
      <category>HTML</category>
      <category>Internet Explorer</category>
      <category>MS.Net</category>
    </item>
    <item>
      <trackback:ping>http://manmadecode.com/Trackback.aspx?guid=206bed05-97bf-4da9-af0c-6e9886ad4652</trackback:ping>
      <pingback:server>http://manmadecode.com/pingback.aspx</pingback:server>
      <pingback:target>http://manmadecode.com/PermaLink,guid,206bed05-97bf-4da9-af0c-6e9886ad4652.aspx</pingback:target>
      <dc:creator>Akash Heranjal</dc:creator>
      <wfw:comment>http://manmadecode.com/CommentView,guid,206bed05-97bf-4da9-af0c-6e9886ad4652.aspx</wfw:comment>
      <wfw:commentRss>http://manmadecode.com/SyndicationService.asmx/GetEntryCommentsRss?guid=206bed05-97bf-4da9-af0c-6e9886ad4652</wfw:commentRss>
      <title>Smarter the better – SQL Server tips – part 03</title>
      <guid isPermaLink="false">http://manmadecode.com/PermaLink,guid,206bed05-97bf-4da9-af0c-6e9886ad4652.aspx</guid>
      <link>http://manmadecode.com/2009/06/13/SmarterTheBetterSQLServerTipsPart03.aspx</link>
      <pubDate>Sat, 13 Jun 2009 17:42:33 GMT</pubDate>
      <description>&lt;p class=MsoListParagraph style="MARGIN: 0in 0in 0pt 0.5in; TEXT-INDENT: -0.25in; mso-list: l0 level1 lfo1"&gt;
&lt;font color=#000000&gt;&lt;span style="mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin"&gt;&lt;span style="mso-list: Ignore"&gt;This
is in continuation to my previous post on SQL Server Tips. &lt;/span&gt;&lt;/span&gt;&lt;/font&gt;
&lt;/p&gt;
&lt;p class=MsoListParagraph style="MARGIN: 0in 0in 0pt 0.5in; TEXT-INDENT: -0.25in; mso-list: l0 level1 lfo1"&gt;
&lt;font color=#000000&gt;&lt;span style="mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin"&gt;&lt;span style="mso-list: Ignore"&gt;&lt;/span&gt;&lt;/span&gt;&lt;/font&gt;&amp;nbsp;
&lt;/p&gt;
&lt;p class=MsoListParagraph style="MARGIN: 0in 0in 0pt 0.5in; TEXT-INDENT: -0.25in; mso-list: l0 level1 lfo1"&gt;
&lt;font color=#000000&gt;&lt;span style="mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin"&gt;&lt;span style="mso-list: Ignore"&gt;1.&lt;span style="FONT: 7pt 'Times New Roman'"&gt;&lt;font face=Verdana size=2&gt;&amp;nbsp;&amp;nbsp;&lt;/font&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" /&gt;SQL
function RAND() is used to generate random numbers. It can have an input parameter
as SEED&lt;o:p&gt;&lt;/o:p&gt;
&lt;/font&gt;
&lt;/p&gt;
&lt;p class=MsoListParagraph style="MARGIN: 0in 0in 0pt 0.5in"&gt;
&lt;font color=#000000&gt;Syntax: RAND([SEED])&lt;o:p&gt;&lt;/o:p&gt;
&lt;/font&gt;
&lt;/p&gt;
&lt;p class=MsoListParagraph style="MARGIN: 0in 0in 0pt 0.5in"&gt;
&lt;o:p&gt;
&lt;font color=#000000&gt;&amp;nbsp;&lt;/font&gt;
&lt;/o:p&gt;
&lt;/p&gt;
&lt;p class=MsoListParagraph style="MARGIN: 0in 0in 0pt 0.5in"&gt;
&lt;font color=#000000&gt;Use the below query to get new random number always (The chance
of duplicate random number is possible if the query is executed more than 1 time with-in
the same milli-second)&lt;o:p&gt;&lt;/o:p&gt;
&lt;/font&gt;
&lt;/p&gt;
&lt;p class=MsoListParagraph style="MARGIN: 0in 0in 0pt 0.5in"&gt;
&lt;font color=#000000&gt;SELECT RAND( 
&lt;o:p&gt;&lt;/o:p&gt;
&lt;/font&gt;
&lt;/p&gt;
&lt;p class=MsoListParagraph style="MARGIN: 0in 0in 0pt 0.5in"&gt;
&lt;font color=#000000&gt;(&lt;/font&gt;
&lt;/p&gt;
&lt;p class=MsoListParagraph style="MARGIN: 0in 0in 0pt 0.5in"&gt;
&lt;font color=#000000&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; DATEPART(MM, GETDATE()) * 100000 ) + (DATEPART(SS,
GETDATE()) * 1000 ) + DATEPART(MS, GETDATE()) 
&lt;o:p&gt;&lt;/o:p&gt;
&lt;/font&gt;
&lt;/p&gt;
&lt;p class=MsoListParagraph style="MARGIN: 0in 0in 0pt 0.5in"&gt;
&lt;font color=#000000&gt;)&lt;o:p&gt;&lt;/o:p&gt;
&lt;/font&gt;
&lt;/p&gt;
&lt;p class=MsoListParagraph style="MARGIN: 0in 0in 0pt 0.5in"&gt;
&lt;o:p&gt;
&lt;font color=#000000&gt;&amp;nbsp;&lt;/font&gt;
&lt;/o:p&gt;
&lt;/p&gt;
&lt;p class=MsoListParagraph style="MARGIN: 0in 0in 0pt 0.5in; TEXT-INDENT: -0.25in; mso-list: l0 level1 lfo1"&gt;
&lt;font color=#000000&gt;&lt;span style="mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin"&gt;&lt;span style="mso-list: Ignore"&gt;2.&lt;span style="FONT: 7pt 'Times New Roman'"&gt;&lt;font face=Verdana size=2&gt;&amp;nbsp;&amp;nbsp;&lt;/font&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;NULLIF(EXP1,
EXP2) is used to compare two expressions are equal and return a NULL value if so.
This can be used as a handy tool to compare two column data having same values&lt;o:p&gt;&lt;/o:p&gt;
&lt;/font&gt;
&lt;/p&gt;
&lt;p class=MsoListParagraph style="MARGIN: 0in 0in 0pt 0.5in"&gt;
&lt;font color=#000000&gt;The below SQL statement will return the value True&lt;o:p&gt;&lt;/o:p&gt;
&lt;/font&gt;
&lt;/p&gt;
&lt;p class=MsoListParagraph style="MARGIN: 0in 0in 0pt 0.5in"&gt;
&lt;font color=#000000&gt;Select ISNULL( NULLIF(‘ABC’, ‘ABD’), ‘True’ )&lt;o:p&gt;&lt;/o:p&gt;
&lt;/font&gt;
&lt;/p&gt;
&lt;p class=MsoListParagraph style="MARGIN: 0in 0in 0pt 0.5in"&gt;
&lt;o:p&gt;
&lt;font color=#000000&gt;&amp;nbsp;&lt;/font&gt;
&lt;/o:p&gt;
&lt;/p&gt;
&lt;p class=MsoListParagraph style="MARGIN: 0in 0in 0pt 0.5in"&gt;
&lt;font color=#000000&gt;Suppose there are two columns FirstName and LastName in a table
TblNames and you want to cross check and compare the two columns having same values,
use the below query against each record in the table&lt;o:p&gt;&lt;/o:p&gt;
&lt;/font&gt;
&lt;/p&gt;
&lt;p class=MsoListParagraph style="MARGIN: 0in 0in 0pt 0.5in"&gt;
&lt;font color=#000000&gt;Select RecID, ISNULL( NULLIF(FirstName, LastNam), ‘True’ ) from
TblNames&lt;o:p&gt;&lt;/o:p&gt;
&lt;/font&gt;
&lt;/p&gt;
&lt;p class=MsoListParagraph style="MARGIN: 0in 0in 0pt 0.5in"&gt;
&lt;o:p&gt;
&lt;font color=#000000&gt;&amp;nbsp;&lt;/font&gt;
&lt;/o:p&gt;
&lt;/p&gt;
&lt;p class=MsoListParagraph style="MARGIN: 0in 0in 0pt 0.5in; TEXT-INDENT: -0.25in; mso-list: l0 level1 lfo1"&gt;
&lt;font color=#000000&gt;&lt;span style="mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin"&gt;&lt;span style="mso-list: Ignore"&gt;3.&lt;span style="FONT: 7pt 'Times New Roman'"&gt;&lt;font face=Verdana size=2&gt;&amp;nbsp;&amp;nbsp;&lt;/font&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;Changing
Object Owners: If you want to change the Object Owner for an the objects in the database,
you can use this stored procedure&lt;o:p&gt;&lt;/o:p&gt;
&lt;/font&gt;
&lt;/p&gt;
&lt;p class=MsoListParagraph style="MARGIN: 0in 0in 0pt 0.5in"&gt;
&lt;font color=#000000&gt;sp_changeobjectowner @objname =&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/span&gt;'objectName'
, @newowner = 'ownerName'&lt;o:p&gt;&lt;/o:p&gt;
&lt;/font&gt;
&lt;/p&gt;
&lt;p&gt;
&lt;/p&gt;
&lt;img width="0" height="0" src="http://manmadecode.com/aggbug.ashx?id=206bed05-97bf-4da9-af0c-6e9886ad4652" /&gt;</description>
      <comments>http://manmadecode.com/CommentView,guid,206bed05-97bf-4da9-af0c-6e9886ad4652.aspx</comments>
      <category>Databases</category>
      <category>SQL Server</category>
    </item>
    <item>
      <trackback:ping>http://manmadecode.com/Trackback.aspx?guid=44aa2879-9732-46ec-b3fc-c7ac2a325b13</trackback:ping>
      <pingback:server>http://manmadecode.com/pingback.aspx</pingback:server>
      <pingback:target>http://manmadecode.com/PermaLink,guid,44aa2879-9732-46ec-b3fc-c7ac2a325b13.aspx</pingback:target>
      <dc:creator>Akash Heranjal</dc:creator>
      <wfw:comment>http://manmadecode.com/CommentView,guid,44aa2879-9732-46ec-b3fc-c7ac2a325b13.aspx</wfw:comment>
      <wfw:commentRss>http://manmadecode.com/SyndicationService.asmx/GetEntryCommentsRss?guid=44aa2879-9732-46ec-b3fc-c7ac2a325b13</wfw:commentRss>
      <title>Smarter the Better – SQL Server Tips – Part 02</title>
      <guid isPermaLink="false">http://manmadecode.com/PermaLink,guid,44aa2879-9732-46ec-b3fc-c7ac2a325b13.aspx</guid>
      <link>http://manmadecode.com/2009/05/16/SmarterTheBetterSQLServerTipsPart02.aspx</link>
      <pubDate>Sat, 16 May 2009 18:52:01 GMT</pubDate>
      <description>&lt;p&gt;
This is in continuation to my previous post.
&lt;/p&gt;
&lt;p class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;
&lt;b&gt;&lt;span style="FONT-SIZE: 10pt; COLOR: black; FONT-FAMILY: 'Verdana','sans-serif'"&gt;Use
table variables instead of temporary tables.&lt;/span&gt;&lt;/b&gt;&lt;span style="FONT-SIZE: 10pt; COLOR: black; FONT-FAMILY: 'Verdana','sans-serif'"&gt;
&lt;br&gt;&lt;?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" /&gt;
Table variables require less locking and logging resources than temporary tables,
so table variables should be used whenever possible. The table variables are available
in SQL Server 2000 only.&lt;o:p&gt;&lt;/o:p&gt;
&lt;/span&gt;
&lt;/p&gt;
&lt;p class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;
&lt;span style="FONT-SIZE: 10pt; COLOR: black; FONT-FAMILY: 'Verdana','sans-serif'"&gt;
&lt;o:p&gt;&amp;nbsp;&lt;/o:p&gt;
&lt;/span&gt;
&lt;/p&gt;
&lt;p class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;
&lt;b&gt;&lt;span style="FONT-SIZE: 10pt; COLOR: black; FONT-FAMILY: 'Verdana','sans-serif'"&gt;Include
SET NOCOUNT ON statement into your stored procedures to stop the message indicating
the number of rows affected by a T-SQL statement.&lt;/span&gt;&lt;/b&gt;&lt;span style="FONT-SIZE: 10pt; COLOR: black; FONT-FAMILY: 'Verdana','sans-serif'"&gt;
&lt;br&gt;
This can reduce network traffic, because your client will not receive the message
indicating the number of rows affected by a T-SQL statement.&lt;o:p&gt;&lt;/o:p&gt;
&lt;/span&gt;
&lt;/p&gt;
&lt;p&gt;
I will add more as I find more...
&lt;/p&gt;
&lt;img width="0" height="0" src="http://manmadecode.com/aggbug.ashx?id=44aa2879-9732-46ec-b3fc-c7ac2a325b13" /&gt;</description>
      <comments>http://manmadecode.com/CommentView,guid,44aa2879-9732-46ec-b3fc-c7ac2a325b13.aspx</comments>
      <category>Databases</category>
      <category>SQA</category>
      <category>SQL Server</category>
    </item>
    <item>
      <trackback:ping>http://manmadecode.com/Trackback.aspx?guid=e35031c4-0449-4e50-bca6-8a8501f500ea</trackback:ping>
      <pingback:server>http://manmadecode.com/pingback.aspx</pingback:server>
      <pingback:target>http://manmadecode.com/PermaLink,guid,e35031c4-0449-4e50-bca6-8a8501f500ea.aspx</pingback:target>
      <dc:creator>Akash Heranjal</dc:creator>
      <wfw:comment>http://manmadecode.com/CommentView,guid,e35031c4-0449-4e50-bca6-8a8501f500ea.aspx</wfw:comment>
      <wfw:commentRss>http://manmadecode.com/SyndicationService.asmx/GetEntryCommentsRss?guid=e35031c4-0449-4e50-bca6-8a8501f500ea</wfw:commentRss>
      <body xmlns="http://www.w3.org/1999/xhtml">Recently I did hosting of a website on
IIS 6 on Windows XP Professional SP2. The website is applied with Basic Authentication
and Windows Integrated Authentication. Strangely the Integrated Authentication does
not work, but the same website on Windows 2003 Server SP2 works fine. When attempted
to browse the website, it does ask for username and password; but does not login and
shows the error <strong><em>HTTP 401.1 – Unauthorized: Logon Failed</em></strong>. 
<br /><br />
I did some research on the Internet and found help at Microsoft Support (ref. link
below). <em>This issue is with Windows XP SP2 and Windows 2003 Server SP1, which include
a <strong>loopback check security feature</strong> that is designed to help prevent
reflection attacks on the computer. When you use the fully qualified domain name (<strong>FQDN</strong>)
or a custom host header to browse a local website that is hosted on a computer using
IIS 6 shows the error “<strong>HTTP 401.1 – Unauthorized: Logon Failed</strong>”.
This happens when the website uses Integrated Authentication and has the name which
is mapped to the local loopback address.</em><br /><br />
The workaround for the issues needs changes in the registry, which should be done
correctly else it would lead to serious problems. It’s advisable to keep the backup
of the registry before making the changes. 
<br /><br /><strong><em>Method 1: Specify Host Names</em></strong><br /><ul><li>
Open Registry Editor</li><li>
Navigate to <strong>HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Lsa\MSV1_0</strong></li><li>
Right-click <strong>MSV1_0</strong>, point to New, and then click <strong>Multi-String
Value</strong></li><li>
Type <strong>BackConnectionHostNames</strong>, and then press <em>ENTER</em></li><li>
Right-click BackConnectionHostNames, and then click <em>Modify</em></li><li>
In the Value data box, type the host name or the host names for the sites that are
on the local computer, and then click OK</li><li>
Quit Registry Editor, and then <strong>restart the IIS Admin service</strong></li></ul><br /><strong><em>Method 2: Disable the Loopback Check</em></strong><br /><ul><li>
Open Registry Editor</li><li>
Navigate to <strong>HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Lsa</strong></li><li>
Right-click <strong>Lsa</strong>, point to New, and then click <strong>DWORD</strong> Value</li><li>
Type <strong>DisableLoopbackCheck</strong>, and then press <em>ENTER</em></li><li>
Right-click DisableLoopbackCheck, and then click <em>Modify</em></li><li>
In the Value data box, <strong>type 1</strong>, and then click OK</li><li>
Quit Registry Editor, and then <strong>restart your computer</strong></li></ul><br /><br />
Ref. Link: <a href="http://support.microsoft.com/default.aspx?scid=kb;EN-US;896861">http://support.microsoft.com/default.aspx?scid=kb;EN-US;896861</a><img width="0" height="0" src="http://manmadecode.com/aggbug.ashx?id=e35031c4-0449-4e50-bca6-8a8501f500ea" /></body>
      <title>Applying Windows Integrated Authentication in IIS 6 gives error HTTP 401.1 – Unauthorized: Logon Failed</title>
      <guid isPermaLink="false">http://manmadecode.com/PermaLink,guid,e35031c4-0449-4e50-bca6-8a8501f500ea.aspx</guid>
      <link>http://manmadecode.com/2009/04/11/ApplyingWindowsIntegratedAuthenticationInIIS6GivesErrorHTTP4011UnauthorizedLogonFailed.aspx</link>
      <pubDate>Sat, 11 Apr 2009 08:18:38 GMT</pubDate>
      <description>Recently I did hosting of a website on IIS 6 on Windows XP Professional SP2. The website is applied with Basic Authentication and Windows Integrated Authentication. Strangely the Integrated Authentication does not work, but the same website on Windows 2003 Server SP2 works fine. When attempted to browse the website, it does ask for username and password; but does not login and shows the error &lt;strong&gt;&lt;em&gt;HTTP
401.1 – Unauthorized: Logon Failed&lt;/em&gt;&lt;/strong&gt;. 
&lt;br&gt;
&lt;br&gt;
I did some research on the Internet and found help at Microsoft Support (ref. link
below). &lt;em&gt;This issue is with Windows XP SP2 and Windows 2003 Server SP1, which include
a &lt;strong&gt;loopback check security feature&lt;/strong&gt; that is designed to help prevent
reflection attacks on the computer. When you use the fully qualified domain name (&lt;strong&gt;FQDN&lt;/strong&gt;)
or a custom host header to browse a local website that is hosted on a computer using
IIS 6 shows the error “&lt;strong&gt;HTTP 401.1 – Unauthorized: Logon Failed&lt;/strong&gt;”.
This happens when the website uses Integrated Authentication and has the name which
is mapped to the local loopback address.&lt;/em&gt; 
&lt;br&gt;
&lt;br&gt;
The workaround for the issues needs changes in the registry, which should be done
correctly else it would lead to serious problems. It’s advisable to keep the backup
of the registry before making the changes. 
&lt;br&gt;
&lt;br&gt;
&lt;strong&gt;&lt;em&gt;Method 1: Specify Host Names&lt;/em&gt;&lt;/strong&gt;
&lt;br&gt;
&lt;ul&gt;
&lt;li&gt;
Open Registry Editor&lt;/li&gt;
&lt;li&gt;
Navigate to &lt;strong&gt;HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Lsa\MSV1_0&lt;/strong&gt;
&lt;/li&gt;
&lt;li&gt;
Right-click &lt;strong&gt;MSV1_0&lt;/strong&gt;, point to New, and then click &lt;strong&gt;Multi-String
Value&lt;/strong&gt;
&lt;/li&gt;
&lt;li&gt;
Type &lt;strong&gt;BackConnectionHostNames&lt;/strong&gt;, and then press &lt;em&gt;ENTER&lt;/em&gt;
&lt;/li&gt;
&lt;li&gt;
Right-click BackConnectionHostNames, and then click &lt;em&gt;Modify&lt;/em&gt;
&lt;/li&gt;
&lt;li&gt;
In the Value data box, type the host name or the host names for the sites that are
on the local computer, and then click OK&lt;/li&gt;
&lt;li&gt;
Quit Registry Editor, and then &lt;strong&gt;restart the IIS Admin service&lt;/strong&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;br&gt;
&lt;strong&gt;&lt;em&gt;Method 2: Disable the Loopback Check&lt;/em&gt;&lt;/strong&gt;
&lt;br&gt;
&lt;ul&gt;
&lt;li&gt;
Open Registry Editor&lt;/li&gt;
&lt;li&gt;
Navigate to &lt;strong&gt;HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Lsa&lt;/strong&gt;
&lt;/li&gt;
&lt;li&gt;
Right-click &lt;strong&gt;Lsa&lt;/strong&gt;, point to New, and then click &lt;strong&gt;DWORD&lt;/strong&gt; Value&lt;/li&gt;
&lt;li&gt;
Type &lt;strong&gt;DisableLoopbackCheck&lt;/strong&gt;, and then press &lt;em&gt;ENTER&lt;/em&gt;
&lt;/li&gt;
&lt;li&gt;
Right-click DisableLoopbackCheck, and then click &lt;em&gt;Modify&lt;/em&gt;
&lt;/li&gt;
&lt;li&gt;
In the Value data box, &lt;strong&gt;type 1&lt;/strong&gt;, and then click OK&lt;/li&gt;
&lt;li&gt;
Quit Registry Editor, and then &lt;strong&gt;restart your computer&lt;/strong&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;br&gt;
&lt;br&gt;
Ref. Link: &lt;a href="http://support.microsoft.com/default.aspx?scid=kb;EN-US;896861"&gt;http://support.microsoft.com/default.aspx?scid=kb;EN-US;896861&lt;/a&gt; &lt;img width="0" height="0" src="http://manmadecode.com/aggbug.ashx?id=e35031c4-0449-4e50-bca6-8a8501f500ea" /&gt;</description>
      <comments>http://manmadecode.com/CommentView,guid,e35031c4-0449-4e50-bca6-8a8501f500ea.aspx</comments>
      <category>IIS</category>
      <category>Internet Explorer</category>
      <category>Windows OS</category>
    </item>
    <item>
      <trackback:ping>http://manmadecode.com/Trackback.aspx?guid=85fc469b-f94e-4ac1-9c22-f94fab71f192</trackback:ping>
      <pingback:server>http://manmadecode.com/pingback.aspx</pingback:server>
      <pingback:target>http://manmadecode.com/PermaLink,guid,85fc469b-f94e-4ac1-9c22-f94fab71f192.aspx</pingback:target>
      <dc:creator>Akash Heranjal</dc:creator>
      <wfw:comment>http://manmadecode.com/CommentView,guid,85fc469b-f94e-4ac1-9c22-f94fab71f192.aspx</wfw:comment>
      <wfw:commentRss>http://manmadecode.com/SyndicationService.asmx/GetEntryCommentsRss?guid=85fc469b-f94e-4ac1-9c22-f94fab71f192</wfw:commentRss>
      <slash:comments>1</slash:comments>
      <body xmlns="http://www.w3.org/1999/xhtml">
        <p>
There are many occasions where a SQL Server Developer uses scripts which take longer
to execute. I would rather say a wrong choice or approach in writing scripts caused
the execution of the script longer. There are smarter ways to achieve results. In
this post I will try to consolidate few tips on smarter SQL Server programming.<br /><br /><strong><em>Do you want to delete all rows from a table?</em></strong><br />
Use <em>Truncate</em> instead of <em>Delete</em> statement. Truncate is faster and
does a reseed of identity column.
</p>
        <p>
          <strong>
            <em>Use Owner Name prefix while writing Select statement:</em>
          </strong>
          <br />
          <font color="#990000">Select thColumnName from dbo.theTableName</font>
          <br />
If the <em>Owner Name</em> is specified, the <em>SQL Query Optimizer</em> does not
have to decide whether to retrieve from <em>dbo.theTableName</em> or some other owner’s
table and avoids recompilation.
</p>
        <p>
          <strong>
            <em>Do not use “Select Count(*)…”</em>
          </strong>
          <br />
The better way to fetch the count of rows:<br /><font color="#990000">Select rows from sysindexes where id = Object_ID(‘theTableName’)
and IndID &lt; 2</font></p>
        <p>
          <strong>
            <em>Do not use “sp_” prefix in your Stored Procedures:</em>
          </strong>
          <br />
The prefix “<em>sp_</em>” for Stored Procedures is a reserved prefix in MS SQL Server.
When a stored procedure is given a call, the SQL Server first looks for the procedure
in System Procedure List and then in User Defined Procedure List; hence delaying the
execution of the procedure.
</p>
        <p>
I will try to add more tips like these in future.
</p>
        <img width="0" height="0" src="http://manmadecode.com/aggbug.ashx?id=85fc469b-f94e-4ac1-9c22-f94fab71f192" />
      </body>
      <title>Smarter the Better – SQL Server Tips – Part 01</title>
      <guid isPermaLink="false">http://manmadecode.com/PermaLink,guid,85fc469b-f94e-4ac1-9c22-f94fab71f192.aspx</guid>
      <link>http://manmadecode.com/2009/03/08/SmarterTheBetterSQLServerTipsPart01.aspx</link>
      <pubDate>Sun, 08 Mar 2009 14:04:17 GMT</pubDate>
      <description>&lt;p&gt;
There are many occasions where a SQL Server Developer uses scripts which take longer
to execute. I would rather say a wrong choice or approach in writing scripts caused
the execution of the script longer. There are smarter ways to achieve results. In
this post I will try to consolidate few tips on smarter SQL Server programming.&lt;br&gt;
&lt;br&gt;
&lt;strong&gt;&lt;em&gt;Do you want to delete all rows from a table?&lt;/em&gt;&lt;/strong&gt;
&lt;br&gt;
Use &lt;em&gt;Truncate&lt;/em&gt; instead of &lt;em&gt;Delete&lt;/em&gt; statement. Truncate is faster and
does a reseed of identity column.
&lt;/p&gt;
&lt;p&gt;
&lt;strong&gt;&lt;em&gt;Use Owner Name prefix while writing Select statement:&lt;/em&gt;&lt;/strong&gt;
&lt;br&gt;
&lt;font color=#990000&gt;Select thColumnName from dbo.theTableName&lt;/font&gt;
&lt;br&gt;
If the &lt;em&gt;Owner Name&lt;/em&gt; is specified, the &lt;em&gt;SQL Query Optimizer&lt;/em&gt; does not
have to decide whether to retrieve from &lt;em&gt;dbo.theTableName&lt;/em&gt; or some other owner’s
table and avoids recompilation.
&lt;/p&gt;
&lt;p&gt;
&lt;strong&gt;&lt;em&gt;Do not use “Select Count(*)…”&lt;/em&gt;&lt;/strong&gt;
&lt;br&gt;
The better way to fetch the count of rows:&lt;br&gt;
&lt;font color=#990000&gt;Select rows from sysindexes where id = Object_ID(‘theTableName’)
and IndID &amp;lt; 2&lt;/font&gt;
&lt;/p&gt;
&lt;p&gt;
&lt;strong&gt;&lt;em&gt;Do not use “sp_” prefix in your Stored Procedures:&lt;/em&gt;&lt;/strong&gt;
&lt;br&gt;
The prefix “&lt;em&gt;sp_&lt;/em&gt;” for Stored Procedures is a reserved prefix in MS SQL Server.
When a stored procedure is given a call, the SQL Server first looks for the procedure
in System Procedure List and then in User Defined Procedure List; hence delaying the
execution of the procedure.
&lt;/p&gt;
&lt;p&gt;
I will try to add more tips like these in future.
&lt;/p&gt;
&lt;img width="0" height="0" src="http://manmadecode.com/aggbug.ashx?id=85fc469b-f94e-4ac1-9c22-f94fab71f192" /&gt;</description>
      <comments>http://manmadecode.com/CommentView,guid,85fc469b-f94e-4ac1-9c22-f94fab71f192.aspx</comments>
      <category>Databases</category>
      <category>SQA</category>
      <category>SQL Server</category>
    </item>
    <item>
      <trackback:ping>http://manmadecode.com/Trackback.aspx?guid=befb52df-e3ea-46f4-89fa-2e132fd7ebf0</trackback:ping>
      <pingback:server>http://manmadecode.com/pingback.aspx</pingback:server>
      <pingback:target>http://manmadecode.com/PermaLink,guid,befb52df-e3ea-46f4-89fa-2e132fd7ebf0.aspx</pingback:target>
      <dc:creator>Akash Heranjal</dc:creator>
      <wfw:comment>http://manmadecode.com/CommentView,guid,befb52df-e3ea-46f4-89fa-2e132fd7ebf0.aspx</wfw:comment>
      <wfw:commentRss>http://manmadecode.com/SyndicationService.asmx/GetEntryCommentsRss?guid=befb52df-e3ea-46f4-89fa-2e132fd7ebf0</wfw:commentRss>
      <body xmlns="http://www.w3.org/1999/xhtml">
        <p>
We all have created Stored Procedures in SQL Server. We keep doing regular updates
on the applications using SQL Server database. The real problem comes when the application
need to be made live and the database stored procedure is required to be synced with
the live server. Unless there is no track of change monitored, it would be difficult
while deploying the updates and upgrades in SQL SPs on to the live server. Now the
question is more clear... Can I find the last modified date for a stored procedure
in SQL Server?
</p>
        <p>
Well, if you are using <strong><em>SQL Server 2000</em></strong>. You can get only
the last modified date. The syntax for the same is 
</p>
        <font color="#990000">
          <p>
            <em>SELECT [Name], crDate 
<br />
FROM sysobjects 
<br />
WHERE [type] = 'p' and [Name] = '&lt;Your_SP_Name&gt;'</em>
          </p>
        </font>
        <p>
In case of <strong><em>SQL Server 2005</em></strong>, it is possible to find the last
modified date for a stored procedure. The syntax for the same is
</p>
        <font color="#990000">
          <p>
            <em>SELECT [Name], Create_Date, Modify_Date<br />
FROM sys.objects<br />
WHERE [type] = 'P' and [Name] = '&lt;Your_SP_Name&gt;'</em>
          </p>
        </font>
        <p>
 
</p>
        <img width="0" height="0" src="http://manmadecode.com/aggbug.ashx?id=befb52df-e3ea-46f4-89fa-2e132fd7ebf0" />
      </body>
      <title>Finding Stored Procedure Create and Modified Date in SQL Server</title>
      <guid isPermaLink="false">http://manmadecode.com/PermaLink,guid,befb52df-e3ea-46f4-89fa-2e132fd7ebf0.aspx</guid>
      <link>http://manmadecode.com/2009/03/02/FindingStoredProcedureCreateAndModifiedDateInSQLServer.aspx</link>
      <pubDate>Mon, 02 Mar 2009 13:05:32 GMT</pubDate>
      <description>&lt;p&gt;
We all have created Stored Procedures in SQL Server. We keep doing regular updates
on the applications using SQL Server database. The real problem comes when the application
need to be made live and the database stored procedure is required to be synced with
the live server. Unless there is no track of change monitored, it would be difficult
while deploying the updates and upgrades in SQL SPs on to the live server. Now the
question is more clear... Can I find the last modified date for a stored procedure
in SQL Server?
&lt;/p&gt;
&lt;p&gt;
Well, if you are using &lt;strong&gt;&lt;em&gt;SQL Server 2000&lt;/em&gt;&lt;/strong&gt;. You can get only
the last modified date. The syntax for the same is 
&lt;/p&gt;
&lt;font color=#990000&gt; 
&lt;p&gt;
&lt;em&gt;SELECT [Name], crDate 
&lt;br&gt;
FROM sysobjects 
&lt;br&gt;
WHERE [type] = 'p' and [Name] = '&amp;lt;Your_SP_Name&amp;gt;'&lt;/em&gt;
&lt;/p&gt;
&lt;/font&gt; 
&lt;p&gt;
In case of &lt;strong&gt;&lt;em&gt;SQL Server 2005&lt;/em&gt;&lt;/strong&gt;, it is possible to find the last
modified date for a stored procedure. The syntax for the same is
&lt;/p&gt;
&lt;font color=#990000&gt; 
&lt;p&gt;
&lt;em&gt;SELECT [Name], Create_Date, Modify_Date&lt;br&gt;
FROM sys.objects&lt;br&gt;
WHERE [type] = 'P' and [Name] = '&amp;lt;Your_SP_Name&amp;gt;'&lt;/em&gt;
&lt;/p&gt;
&lt;/font&gt; 
&lt;p&gt;
&amp;nbsp;
&lt;/p&gt;
&lt;img width="0" height="0" src="http://manmadecode.com/aggbug.ashx?id=befb52df-e3ea-46f4-89fa-2e132fd7ebf0" /&gt;</description>
      <comments>http://manmadecode.com/CommentView,guid,befb52df-e3ea-46f4-89fa-2e132fd7ebf0.aspx</comments>
      <category>Databases</category>
      <category>SQL Server</category>
    </item>
    <item>
      <trackback:ping>http://manmadecode.com/Trackback.aspx?guid=0632eef1-91a3-49eb-bc36-ad8614215e1c</trackback:ping>
      <pingback:server>http://manmadecode.com/pingback.aspx</pingback:server>
      <pingback:target>http://manmadecode.com/PermaLink,guid,0632eef1-91a3-49eb-bc36-ad8614215e1c.aspx</pingback:target>
      <dc:creator>Akash Heranjal</dc:creator>
      <wfw:comment>http://manmadecode.com/CommentView,guid,0632eef1-91a3-49eb-bc36-ad8614215e1c.aspx</wfw:comment>
      <wfw:commentRss>http://manmadecode.com/SyndicationService.asmx/GetEntryCommentsRss?guid=0632eef1-91a3-49eb-bc36-ad8614215e1c</wfw:commentRss>
      <body xmlns="http://www.w3.org/1999/xhtml">
        <p>
Most of you have been using Windows OS. Have you ever tried finding, what is the length
of a file name or a folder name could be? Except those who have specifically worked
on <em>File system Object (FSO)</em> would have not bothered to know as how a file
and folder name is defined in Windows OS.
</p>
        <p>
Well the answer to this question is that it’s not the length of the file name or folder
name; but the number of characters in the full path of the file or folder defines
the max size of a file name or folder name in Windows OS. <em><u>The max length of
a file or folder path including itself is 255 characters (in Vista this is 260 characters).</u></em></p>
        <p>
For example, a folder name in the root of a drive (c:\ or d:\ or etc…) would be 244
characters long and a file name in the root of a drive would be 251 characters. If
you have a folder name of length 244 characters long in the root drive of your hard
disk, you will not be able to save a file or create a sub-folder under it. You would
receive an error message “<em>Destination path too long</em>”.
</p>
        <p>
I will end this article with few questions, which I will try to cover in my next article.
Most of us have developed Document Repository System or written programs for uploading
and storing files on the disk. Have you really taken care to check the file name or
folder name length before uploading it to the server? How do we store files with long
names? Is there any alternative apart from physical file storage on the disk?<br /></p>
        <img width="0" height="0" src="http://manmadecode.com/aggbug.ashx?id=0632eef1-91a3-49eb-bc36-ad8614215e1c" />
      </body>
      <title>What is the max length of a file name or folder name in Windows OS?</title>
      <guid isPermaLink="false">http://manmadecode.com/PermaLink,guid,0632eef1-91a3-49eb-bc36-ad8614215e1c.aspx</guid>
      <link>http://manmadecode.com/2009/02/20/WhatIsTheMaxLengthOfAFileNameOrFolderNameInWindowsOS.aspx</link>
      <pubDate>Fri, 20 Feb 2009 15:28:29 GMT</pubDate>
      <description>&lt;p&gt;
Most of you have been using Windows OS. Have you ever tried finding, what is the length
of a file name or a folder name could be? Except those who have specifically worked
on &lt;em&gt;File system Object (FSO)&lt;/em&gt; would have not bothered to know as how a file
and folder name is defined in Windows OS.
&lt;/p&gt;
&lt;p&gt;
Well the answer to this question is that it’s not the length of the file name or folder
name; but the number of characters in the full path of the file or folder defines
the max size of a file name or folder name in Windows OS. &lt;em&gt;&lt;u&gt;The max length of
a file or folder path including itself is 255 characters (in Vista this is 260 characters).&lt;/u&gt;&lt;/em&gt; 
&lt;/p&gt;
&lt;p&gt;
For example, a folder name in the root of a drive (c:\ or d:\ or etc…) would be 244
characters long and a file name in the root of a drive would be 251 characters. If
you have a folder name of length 244 characters long in the root drive of your hard
disk, you will not be able to save a file or create a sub-folder under it. You would
receive an error message “&lt;em&gt;Destination path too long&lt;/em&gt;”.
&lt;/p&gt;
&lt;p&gt;
I will end this article with few questions, which I will try to cover in my next article.
Most of us have developed Document Repository System or written programs for uploading
and storing files on the disk. Have you really taken care to check the file name or
folder name length before uploading it to the server? How do we store files with long
names? Is there any alternative apart from physical file storage on the disk?&lt;br&gt;
&lt;/p&gt;
&lt;img width="0" height="0" src="http://manmadecode.com/aggbug.ashx?id=0632eef1-91a3-49eb-bc36-ad8614215e1c" /&gt;</description>
      <comments>http://manmadecode.com/CommentView,guid,0632eef1-91a3-49eb-bc36-ad8614215e1c.aspx</comments>
      <category>Classic ASP</category>
      <category>SQA</category>
      <category>Windows OS</category>
    </item>
  </channel>
</rss>