<?xml version="1.0" encoding="utf-8"?>
<feed xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xml:lang="en-us" xmlns="http://www.w3.org/2005/Atom">
  <title>Man Made Code</title>
  <link rel="alternate" type="text/html" href="http://manmadecode.com/" />
  <link rel="self" href="http://manmadecode.com/SyndicationService.asmx/GetAtom" />
  <icon>favicon.ico</icon>
  <updated>2009-11-13T11:21:55.9860423-07:00</updated>
  <author>
    <name>ManMadeCode.com</name>
  </author>
  <subtitle>Technology Blog</subtitle>
  <id>http://manmadecode.com/</id>
  <generator uri="http://dasblog.info/" version="2.1.8102.813">DasBlog</generator>
  <entry>
    <title>How to limit the data returned by each columns in a SELECT statement?</title>
    <link rel="alternate" type="text/html" href="http://manmadecode.com/2009/11/13/HowToLimitTheDataReturnedByEachColumnsInASELECTStatement.aspx" />
    <id>http://manmadecode.com/PermaLink,guid,9b41b9b7-4f5c-4b73-952d-931b45548632.aspx</id>
    <published>2009-11-13T11:14:59.72-07:00</published>
    <updated>2009-11-13T11:21:55.9860423-07:00</updated>
    <category term="Databases" label="Databases" scheme="http://manmadecode.com/CategoryView,category,Databases.aspx" />
    <category term="SQL Server" label="SQL Server" scheme="http://manmadecode.com/CategoryView,category,SQLServer.aspx" />
    <content type="xhtml">
      <div 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" /></div>
    </content>
  </entry>
  <entry>
    <title>How to swap data between two columns of a table in SQL Server?</title>
    <link rel="alternate" type="text/html" href="http://manmadecode.com/2009/08/16/HowToSwapDataBetweenTwoColumnsOfATableInSQLServer.aspx" />
    <id>http://manmadecode.com/PermaLink,guid,615d9eb0-214c-4384-9e30-541c545b1c1a.aspx</id>
    <published>2009-08-16T10:45:17.977-07:00</published>
    <updated>2009-11-12T11:16:06.4614123-07:00</updated>
    <category term="Databases" label="Databases" scheme="http://manmadecode.com/CategoryView,category,Databases.aspx" />
    <category term="SQL Server" label="SQL Server" scheme="http://manmadecode.com/CategoryView,category,SQLServer.aspx" />
    <content type="xhtml">
      <div 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" />
      </div>
    </content>
  </entry>
  <entry>
    <title>Favicon – The little icon on the address bar</title>
    <link rel="alternate" type="text/html" href="http://manmadecode.com/2009/07/14/FaviconTheLittleIconOnTheAddressBar.aspx" />
    <id>http://manmadecode.com/PermaLink,guid,ba64230e-b07d-4d6e-9b78-a085ce5b8aa5.aspx</id>
    <published>2009-07-14T05:52:24.881-07:00</published>
    <updated>2009-09-03T06:14:46.7585447-07:00</updated>
    <category term="Classic ASP" label="Classic ASP" scheme="http://manmadecode.com/CategoryView,category,ClassicASP.aspx" />
    <category term="HTML" label="HTML" scheme="http://manmadecode.com/CategoryView,category,HTML.aspx" />
    <category term="Internet Explorer" label="Internet Explorer" scheme="http://manmadecode.com/CategoryView,category,InternetExplorer.aspx" />
    <category term="MS.Net" label="MS.Net" scheme="http://manmadecode.com/CategoryView,category,MSNet.aspx" />
    <content type="xhtml">
      <div 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" /></div>
    </content>
  </entry>
  <entry>
    <title>Smarter the better – SQL Server tips – part 03</title>
    <link rel="alternate" type="text/html" href="http://manmadecode.com/2009/06/13/SmarterTheBetterSQLServerTipsPart03.aspx" />
    <id>http://manmadecode.com/PermaLink,guid,206bed05-97bf-4da9-af0c-6e9886ad4652.aspx</id>
    <published>2009-06-13T10:42:33.747-07:00</published>
    <updated>2009-07-28T10:46:59.1744166-07:00</updated>
    <category term="Databases" label="Databases" scheme="http://manmadecode.com/CategoryView,category,Databases.aspx" />
    <category term="SQL Server" label="SQL Server" scheme="http://manmadecode.com/CategoryView,category,SQLServer.aspx" />
    <content type="html">&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;</content>
  </entry>
  <entry>
    <title>Smarter the Better – SQL Server Tips – Part 02</title>
    <link rel="alternate" type="text/html" href="http://manmadecode.com/2009/05/16/SmarterTheBetterSQLServerTipsPart02.aspx" />
    <id>http://manmadecode.com/PermaLink,guid,44aa2879-9732-46ec-b3fc-c7ac2a325b13.aspx</id>
    <published>2009-05-16T11:52:01.019-07:00</published>
    <updated>2009-05-15T11:54:17.1595236-07:00</updated>
    <category term="Databases" label="Databases" scheme="http://manmadecode.com/CategoryView,category,Databases.aspx" />
    <category term="SQA" label="SQA" scheme="http://manmadecode.com/CategoryView,category,SQA.aspx" />
    <category term="SQL Server" label="SQL Server" scheme="http://manmadecode.com/CategoryView,category,SQLServer.aspx" />
    <content type="html">&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;</content>
  </entry>
  <entry>
    <title>Applying Windows Integrated Authentication in IIS 6 gives error HTTP 401.1 – Unauthorized: Logon Failed</title>
    <link rel="alternate" type="text/html" href="http://manmadecode.com/2009/04/11/ApplyingWindowsIntegratedAuthenticationInIIS6GivesErrorHTTP4011UnauthorizedLogonFailed.aspx" />
    <id>http://manmadecode.com/PermaLink,guid,e35031c4-0449-4e50-bca6-8a8501f500ea.aspx</id>
    <published>2009-04-11T01:18:38.86-07:00</published>
    <updated>2009-04-11T01:27:53.9197328-07:00</updated>
    <category term="IIS" label="IIS" scheme="http://manmadecode.com/CategoryView,category,IIS.aspx" />
    <category term="Internet Explorer" label="Internet Explorer" scheme="http://manmadecode.com/CategoryView,category,InternetExplorer.aspx" />
    <category term="Windows OS" label="Windows OS" scheme="http://manmadecode.com/CategoryView,category,WindowsOS.aspx" />
    <content type="xhtml">
      <div 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" /></div>
    </content>
  </entry>
  <entry>
    <title>Smarter the Better – SQL Server Tips – Part 01</title>
    <link rel="alternate" type="text/html" href="http://manmadecode.com/2009/03/08/SmarterTheBetterSQLServerTipsPart01.aspx" />
    <id>http://manmadecode.com/PermaLink,guid,85fc469b-f94e-4ac1-9c22-f94fab71f192.aspx</id>
    <published>2009-03-08T07:04:17.866-07:00</published>
    <updated>2009-03-08T07:09:59.5878048-07:00</updated>
    <category term="Databases" label="Databases" scheme="http://manmadecode.com/CategoryView,category,Databases.aspx" />
    <category term="SQA" label="SQA" scheme="http://manmadecode.com/CategoryView,category,SQA.aspx" />
    <category term="SQL Server" label="SQL Server" scheme="http://manmadecode.com/CategoryView,category,SQLServer.aspx" />
    <content type="xhtml">
      <div 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" />
      </div>
    </content>
  </entry>
  <entry>
    <title>Finding Stored Procedure Create and Modified Date in SQL Server</title>
    <link rel="alternate" type="text/html" href="http://manmadecode.com/2009/03/02/FindingStoredProcedureCreateAndModifiedDateInSQLServer.aspx" />
    <id>http://manmadecode.com/PermaLink,guid,befb52df-e3ea-46f4-89fa-2e132fd7ebf0.aspx</id>
    <published>2009-03-02T06:05:32.567-07:00</published>
    <updated>2009-03-03T06:24:31.2155472-07:00</updated>
    <category term="Databases" label="Databases" scheme="http://manmadecode.com/CategoryView,category,Databases.aspx" />
    <category term="SQL Server" label="SQL Server" scheme="http://manmadecode.com/CategoryView,category,SQLServer.aspx" />
    <content type="xhtml">
      <div 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" />
      </div>
    </content>
  </entry>
  <entry>
    <title>What is the max length of a file name or folder name in Windows OS?</title>
    <link rel="alternate" type="text/html" href="http://manmadecode.com/2009/02/20/WhatIsTheMaxLengthOfAFileNameOrFolderNameInWindowsOS.aspx" />
    <id>http://manmadecode.com/PermaLink,guid,0632eef1-91a3-49eb-bc36-ad8614215e1c.aspx</id>
    <published>2009-02-20T08:28:29.343-07:00</published>
    <updated>2009-02-21T08:31:32.5458422-07:00</updated>
    <category term="Classic ASP" label="Classic ASP" scheme="http://manmadecode.com/CategoryView,category,ClassicASP.aspx" />
    <category term="SQA" label="SQA" scheme="http://manmadecode.com/CategoryView,category,SQA.aspx" />
    <category term="Windows OS" label="Windows OS" scheme="http://manmadecode.com/CategoryView,category,WindowsOS.aspx" />
    <content type="xhtml">
      <div 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" />
      </div>
    </content>
  </entry>
</feed>