<rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" 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:copyright="http://blogs.law.harvard.edu/tech/rss" xmlns:image="http://purl.org/rss/1.0/modules/image/">
    <channel>
        <title>SQL Server</title>
        <link>http://geekswithblogs.net/scarpenter/category/3027.aspx</link>
        <description>SQL Server</description>
        <language>en-US</language>
        <copyright>Sean Carpenter</copyright>
        <managingEditor>sean@seancarpenter.net</managingEditor>
        <generator>Subtext Version 0.0.0.0</generator>
        <item>
            <title>SQL Server 2005 SP1 Released</title>
            <link>http://geekswithblogs.net/scarpenter/archive/2006/04/19/75584.aspx</link>
            <description>&lt;P&gt;Well, after a relatively short CTP, &lt;A href="http://www.microsoft.com/downloads/details.aspx?FamilyID=cb6c71ea-d649-47ff-9176-e7cac58fd4bc&amp;amp;DisplayLang=en"&gt;SQL Server 2005 SP1&lt;/A&gt;&amp;nbsp;has been released.&amp;nbsp; This should be pretty cool, since the CTP &lt;A href="http://geekswithblogs.net/scarpenter/archive/2006/03/17/72600.aspx"&gt;solved&lt;/A&gt; the &lt;A href="http://geekswithblogs.net/scarpenter/archive/2005/11/22/60878.aspx"&gt;problems&lt;/A&gt; I was having with Import/Export.&lt;/P&gt;
&lt;P&gt;[Found via &lt;A href="http://davidhayden.com/blog/dave/archive/2006/04/19/2919.aspx"&gt;David Hayden&lt;/A&gt;]&lt;/P&gt;&lt;p&gt;&lt;a href="http://www.pheedo.com/click.phdo?x=6cda6ad746d942b9a1110d0715a4fa12&amp;u=75584"&gt;&lt;img src="http://www.pheedo.com/img.phdo?x=6cda6ad746d942b9a1110d0715a4fa12&amp;u=75584" border="0"/&gt;&lt;/a&gt;&lt;/p&gt;&lt;iframe src="http://ads.geekswithblogs.net/a.aspx?ZoneID=5&amp;amp;Task=Get&amp;amp;PageID=31016&amp;amp;SiteID=1" width=1 height=1 Marginwidth=0 Marginheight=0 Hspace=0 Vspace=0 Frameborder=0 Scrolling=No&gt;
&lt;script language='javascript1.1' src="http://ads.geekswithblogs.net/a.aspx?ZoneID=5&amp;amp;Task=Get&amp;amp;Browser=NETSCAPE4&amp;amp;NoCache=True&amp;PageID=31016&amp;amp;SiteID=1"&gt;&lt;/script&gt;
&lt;noscript&gt;&lt;a href="http://ads.geekswithblogs.net/a.aspx?ZoneID=5&amp;amp;Task=Click&amp;amp;Mode=HTML&amp;amp;SiteID=1&amp;amp;PageID=31016" target="_blank"&gt;
&lt;img src="http://ads.geekswithblogs.net/a.aspx?ZoneID=5&amp;amp;Task=Get&amp;amp;Mode=HTML&amp;amp;SiteID=1&amp;amp;PageID=31016" width="1" height="1" border="0"  alt=""&gt;&lt;/a&gt;
&lt;/noscript&gt;
&lt;/iframe&gt;
&lt;img src="http://geekswithblogs.net/scarpenter/aggbug/75584.aspx" width="1" height="1" /&gt;</description>
            <dc:creator>Sean Carpenter</dc:creator>
            <guid>http://geekswithblogs.net/scarpenter/archive/2006/04/19/75584.aspx</guid>
            <pubDate>Wed, 19 Apr 2006 14:34:00 GMT</pubDate>
            <comments>http://geekswithblogs.net/scarpenter/archive/2006/04/19/75584.aspx#feedback</comments>
            <wfw:commentRss>http://geekswithblogs.net/scarpenter/comments/commentRss/75584.aspx</wfw:commentRss>
            <trackback:ping>http://geekswithblogs.net/scarpenter/services/trackbacks/75584.aspx</trackback:ping>
        </item>
        <item>
            <title>Changing the Receive Handler for a BizTalk 2004 Receive Location</title>
            <link>http://geekswithblogs.net/scarpenter/archive/2006/03/28/73591.aspx</link>
            <description>&lt;P&gt;This is actually pretty basic, but I had a hard time with it this morning, so I thought I'd share how to do this.&lt;/P&gt;
&lt;P&gt;I created a host and host instance on our &lt;A href="http://www.microsoft.com/biztalk"&gt;BizTalk&lt;/A&gt; server specifically to host the receive locations we are running.&amp;nbsp; Creating the host and instance was no problem, but I had a hard time changing the receive locations to use the new host.&amp;nbsp; In the BizTalk Administration Console as well as in BizTalk Explorer, there is a place to choose the Receive Handler - the problem was that this dropdown contained only the original host, not the new one.&lt;/P&gt;
&lt;P&gt;It turns out that the host is associated with the receive adapter, not each instance.&amp;nbsp; So the solution is to go to the Adapters node in the BizTalk Administration Console, choose the Adapter, choose Receive Locations, and then specify the host.&amp;nbsp; This changes it for all receive locations using that host.&amp;nbsp; It's actually documented &lt;A href="http://msdn.microsoft.com/library/default.asp?url=/library/en-us/operations/htm/ebiz_ops_adapt_file_jzbl.asp"&gt;here&lt;/A&gt;, so I'm not sure why I had so much trouble finding the answer.&lt;/P&gt;&lt;p&gt;&lt;a href="http://www.pheedo.com/click.phdo?x=6cda6ad746d942b9a1110d0715a4fa12&amp;u=73591"&gt;&lt;img src="http://www.pheedo.com/img.phdo?x=6cda6ad746d942b9a1110d0715a4fa12&amp;u=73591" border="0"/&gt;&lt;/a&gt;&lt;/p&gt;&lt;iframe src="http://ads.geekswithblogs.net/a.aspx?ZoneID=5&amp;amp;Task=Get&amp;amp;PageID=31016&amp;amp;SiteID=1" width=1 height=1 Marginwidth=0 Marginheight=0 Hspace=0 Vspace=0 Frameborder=0 Scrolling=No&gt;
&lt;script language='javascript1.1' src="http://ads.geekswithblogs.net/a.aspx?ZoneID=5&amp;amp;Task=Get&amp;amp;Browser=NETSCAPE4&amp;amp;NoCache=True&amp;PageID=31016&amp;amp;SiteID=1"&gt;&lt;/script&gt;
&lt;noscript&gt;&lt;a href="http://ads.geekswithblogs.net/a.aspx?ZoneID=5&amp;amp;Task=Click&amp;amp;Mode=HTML&amp;amp;SiteID=1&amp;amp;PageID=31016" target="_blank"&gt;
&lt;img src="http://ads.geekswithblogs.net/a.aspx?ZoneID=5&amp;amp;Task=Get&amp;amp;Mode=HTML&amp;amp;SiteID=1&amp;amp;PageID=31016" width="1" height="1" border="0"  alt=""&gt;&lt;/a&gt;
&lt;/noscript&gt;
&lt;/iframe&gt;
&lt;img src="http://geekswithblogs.net/scarpenter/aggbug/73591.aspx" width="1" height="1" /&gt;</description>
            <dc:creator>Sean Carpenter</dc:creator>
            <guid>http://geekswithblogs.net/scarpenter/archive/2006/03/28/73591.aspx</guid>
            <pubDate>Tue, 28 Mar 2006 10:55:00 GMT</pubDate>
            <comments>http://geekswithblogs.net/scarpenter/archive/2006/03/28/73591.aspx#feedback</comments>
            <wfw:commentRss>http://geekswithblogs.net/scarpenter/comments/commentRss/73591.aspx</wfw:commentRss>
            <trackback:ping>http://geekswithblogs.net/scarpenter/services/trackbacks/73591.aspx</trackback:ping>
        </item>
        <item>
            <title>SQL Server 2005 SP1 CTP</title>
            <link>http://geekswithblogs.net/scarpenter/archive/2006/03/17/72600.aspx</link>
            <description>The SQL Server 2005 SP1 CTP is &lt;A href="http://www.microsoft.com/sql/ctp_sp1.mspx"&gt;available for download&lt;/A&gt;.&amp;nbsp; I'm going to be trying it out immediately since one of the included fixes is for the &lt;A href="http://geekswithblogs.net/scarpenter/archive/2005/11/22/60878.aspx"&gt;problem I was having&lt;/A&gt; with the Import/Export wizard.&lt;p&gt;&lt;a href="http://www.pheedo.com/click.phdo?x=6cda6ad746d942b9a1110d0715a4fa12&amp;u=72600"&gt;&lt;img src="http://www.pheedo.com/img.phdo?x=6cda6ad746d942b9a1110d0715a4fa12&amp;u=72600" border="0"/&gt;&lt;/a&gt;&lt;/p&gt;&lt;iframe src="http://ads.geekswithblogs.net/a.aspx?ZoneID=5&amp;amp;Task=Get&amp;amp;PageID=31016&amp;amp;SiteID=1" width=1 height=1 Marginwidth=0 Marginheight=0 Hspace=0 Vspace=0 Frameborder=0 Scrolling=No&gt;
&lt;script language='javascript1.1' src="http://ads.geekswithblogs.net/a.aspx?ZoneID=5&amp;amp;Task=Get&amp;amp;Browser=NETSCAPE4&amp;amp;NoCache=True&amp;PageID=31016&amp;amp;SiteID=1"&gt;&lt;/script&gt;
&lt;noscript&gt;&lt;a href="http://ads.geekswithblogs.net/a.aspx?ZoneID=5&amp;amp;Task=Click&amp;amp;Mode=HTML&amp;amp;SiteID=1&amp;amp;PageID=31016" target="_blank"&gt;
&lt;img src="http://ads.geekswithblogs.net/a.aspx?ZoneID=5&amp;amp;Task=Get&amp;amp;Mode=HTML&amp;amp;SiteID=1&amp;amp;PageID=31016" width="1" height="1" border="0"  alt=""&gt;&lt;/a&gt;
&lt;/noscript&gt;
&lt;/iframe&gt;
&lt;img src="http://geekswithblogs.net/scarpenter/aggbug/72600.aspx" width="1" height="1" /&gt;</description>
            <dc:creator>Sean Carpenter</dc:creator>
            <guid>http://geekswithblogs.net/scarpenter/archive/2006/03/17/72600.aspx</guid>
            <pubDate>Fri, 17 Mar 2006 09:07:00 GMT</pubDate>
            <comments>http://geekswithblogs.net/scarpenter/archive/2006/03/17/72600.aspx#feedback</comments>
            <slash:comments>2</slash:comments>
            <wfw:commentRss>http://geekswithblogs.net/scarpenter/comments/commentRss/72600.aspx</wfw:commentRss>
            <trackback:ping>http://geekswithblogs.net/scarpenter/services/trackbacks/72600.aspx</trackback:ping>
        </item>
        <item>
            <title>SQL Server Backup to UNC Path Failing</title>
            <link>http://geekswithblogs.net/scarpenter/archive/2006/02/15/69570.aspx</link>
            <description>We back up our SQL Server databases&amp;nbsp;to a central storage machine using UNC paths in the &lt;A href="http://msdn.microsoft.com/library/default.asp?url=/library/en-us/tsqlref/ts_ba-bz_35ww.asp"&gt;BACKUP&lt;/A&gt; statement (BACKUP DATABASE db1 TO DISK='\\storage\Backups\db1\db1.bak...). For a while, backups were failing with the message: &lt;PRE&gt;BackupDiskFile::RequestDurableMedia:  failure on backup device '\\storage\Backups\db1\db1.bak'. Operating system error 64(The specified network name is no longer available.).
&lt;/PRE&gt;
&lt;P&gt;I struggled for a&amp;nbsp;while&amp;nbsp;to find a solution and finally found &lt;A href="http://www.mcse.ms/archive81-2003-12-160965.html"&gt;this thread&lt;/A&gt; on www.msce.ms.&amp;nbsp; Unfortunately that seems to have disappeared, so this is a summary of what that thread recommended (and what worked for me):&lt;/P&gt;
&lt;UL&gt;
&lt;LI&gt;Open the registry of the SQL Server machine and navigate to HKLM\System\CurrentControlSet\Services\lanmanworkstation\parameters 
&lt;LI&gt;Create a new DWORD value named SessTimeout (if it's already there&amp;nbsp;I guess you can change the value but it wasn't there on any server I was having the problem with). 
&lt;LI&gt;Set the value to decimal 600 (hex 0x258) - I believe this is seconds.&lt;/LI&gt;&lt;/UL&gt;
&lt;P&gt;This corrected the problem for me (on two machines I had to bump the value to 900) and seems to have no ill effects on the rest of the server.&lt;/P&gt;&lt;p&gt;&lt;a href="http://www.pheedo.com/click.phdo?x=6cda6ad746d942b9a1110d0715a4fa12&amp;u=69570"&gt;&lt;img src="http://www.pheedo.com/img.phdo?x=6cda6ad746d942b9a1110d0715a4fa12&amp;u=69570" border="0"/&gt;&lt;/a&gt;&lt;/p&gt;&lt;iframe src="http://ads.geekswithblogs.net/a.aspx?ZoneID=5&amp;amp;Task=Get&amp;amp;PageID=31016&amp;amp;SiteID=1" width=1 height=1 Marginwidth=0 Marginheight=0 Hspace=0 Vspace=0 Frameborder=0 Scrolling=No&gt;
&lt;script language='javascript1.1' src="http://ads.geekswithblogs.net/a.aspx?ZoneID=5&amp;amp;Task=Get&amp;amp;Browser=NETSCAPE4&amp;amp;NoCache=True&amp;PageID=31016&amp;amp;SiteID=1"&gt;&lt;/script&gt;
&lt;noscript&gt;&lt;a href="http://ads.geekswithblogs.net/a.aspx?ZoneID=5&amp;amp;Task=Click&amp;amp;Mode=HTML&amp;amp;SiteID=1&amp;amp;PageID=31016" target="_blank"&gt;
&lt;img src="http://ads.geekswithblogs.net/a.aspx?ZoneID=5&amp;amp;Task=Get&amp;amp;Mode=HTML&amp;amp;SiteID=1&amp;amp;PageID=31016" width="1" height="1" border="0"  alt=""&gt;&lt;/a&gt;
&lt;/noscript&gt;
&lt;/iframe&gt;
&lt;img src="http://geekswithblogs.net/scarpenter/aggbug/69570.aspx" width="1" height="1" /&gt;</description>
            <dc:creator>Sean Carpenter</dc:creator>
            <guid>http://geekswithblogs.net/scarpenter/archive/2006/02/15/69570.aspx</guid>
            <pubDate>Wed, 15 Feb 2006 11:54:00 GMT</pubDate>
            <comments>http://geekswithblogs.net/scarpenter/archive/2006/02/15/69570.aspx#feedback</comments>
            <slash:comments>4</slash:comments>
            <wfw:commentRss>http://geekswithblogs.net/scarpenter/comments/commentRss/69570.aspx</wfw:commentRss>
            <trackback:ping>http://geekswithblogs.net/scarpenter/services/trackbacks/69570.aspx</trackback:ping>
        </item>
        <item>
            <title>Text Report of SQL Dependencies</title>
            <link>http://geekswithblogs.net/scarpenter/archive/2005/10/20/57559.aspx</link>
            <description>&lt;P&gt;This is a bookmark for myself as much as anything else, but here is Raymond Lewallen's script for generating a text based dependency report for a SQL Server database.&lt;/P&gt;
&lt;P&gt;&lt;A href="http://codebetter.com/blogs/raymond.lewallen/archive/2005/02/16/51035.aspx"&gt;Sql dependency report from query analyzer&lt;/A&gt;&lt;/P&gt;&lt;p&gt;&lt;a href="http://www.pheedo.com/click.phdo?x=6cda6ad746d942b9a1110d0715a4fa12&amp;u=57559"&gt;&lt;img src="http://www.pheedo.com/img.phdo?x=6cda6ad746d942b9a1110d0715a4fa12&amp;u=57559" border="0"/&gt;&lt;/a&gt;&lt;/p&gt;&lt;iframe src="http://ads.geekswithblogs.net/a.aspx?ZoneID=5&amp;amp;Task=Get&amp;amp;PageID=31016&amp;amp;SiteID=1" width=1 height=1 Marginwidth=0 Marginheight=0 Hspace=0 Vspace=0 Frameborder=0 Scrolling=No&gt;
&lt;script language='javascript1.1' src="http://ads.geekswithblogs.net/a.aspx?ZoneID=5&amp;amp;Task=Get&amp;amp;Browser=NETSCAPE4&amp;amp;NoCache=True&amp;PageID=31016&amp;amp;SiteID=1"&gt;&lt;/script&gt;
&lt;noscript&gt;&lt;a href="http://ads.geekswithblogs.net/a.aspx?ZoneID=5&amp;amp;Task=Click&amp;amp;Mode=HTML&amp;amp;SiteID=1&amp;amp;PageID=31016" target="_blank"&gt;
&lt;img src="http://ads.geekswithblogs.net/a.aspx?ZoneID=5&amp;amp;Task=Get&amp;amp;Mode=HTML&amp;amp;SiteID=1&amp;amp;PageID=31016" width="1" height="1" border="0"  alt=""&gt;&lt;/a&gt;
&lt;/noscript&gt;
&lt;/iframe&gt;
&lt;img src="http://geekswithblogs.net/scarpenter/aggbug/57559.aspx" width="1" height="1" /&gt;</description>
            <dc:creator>Sean Carpenter</dc:creator>
            <guid>http://geekswithblogs.net/scarpenter/archive/2005/10/20/57559.aspx</guid>
            <pubDate>Thu, 20 Oct 2005 16:45:00 GMT</pubDate>
            <comments>http://geekswithblogs.net/scarpenter/archive/2005/10/20/57559.aspx#feedback</comments>
            <wfw:commentRss>http://geekswithblogs.net/scarpenter/comments/commentRss/57559.aspx</wfw:commentRss>
            <trackback:ping>http://geekswithblogs.net/scarpenter/services/trackbacks/57559.aspx</trackback:ping>
        </item>
        <item>
            <title>Inserting Base64 Data, Part 2</title>
            <link>http://geekswithblogs.net/scarpenter/archive/2005/10/20/57522.aspx</link>
            <description>&lt;P&gt;One thing I forgot to mention in &lt;A href="http://www.geekswithblogs.net/scarpenter/archive/2005/10/19/57442.aspx"&gt;yesterday's post&lt;/A&gt;: it is possible to have SQLXML do the conversion from Base64 to binary&amp;nbsp;using an &lt;A href="http://msdn.microsoft.com/library/default.asp?url=/library/en-us/sqlxml3/htm/updategram_5kkh.asp"&gt;updategram&lt;/A&gt;.&amp;nbsp; When using an updategram, it is possible to specify a &lt;A href="http://msdn.microsoft.com/library/default.asp?url=/library/en-us/sqlxml3/htm/updategram_8srx.asp"&gt;mapping schema&lt;/A&gt;, which lets you use&amp;nbsp;attribute names in the updategram that are different than the column names in the table.&amp;nbsp; A mapping schema also lets you specify data type conversion, one of which is Base64 to binary.&amp;nbsp; Here's a brief example:&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;Mapping Schema&lt;/STRONG&gt;&lt;/P&gt;&lt;PRE&gt;&amp;lt;xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"
            xmlns:sqlms="urn:schemas-microsoft-com:mapping-schema"&amp;gt;
  &amp;lt;xsd:element name="binaryTest"&amp;gt;
   &amp;lt;xsd:complexType&amp;gt;
        &amp;lt;xsd:attribute name="someParameter" sqlms:field="someValue" type="xsd:integer" /&amp;gt; 
        &amp;lt;xsd:attribute name="attachmentData" sqlms:field="attachmentData" type="xsd:base64Binary" sqlms:datatype="image" /&amp;gt;
    &amp;lt;/xsd:complexType&amp;gt;
  &amp;lt;/xsd:element&amp;gt;
&amp;lt;/xsd:schema&amp;gt;
&lt;/PRE&gt;
&lt;P&gt;&lt;STRONG&gt;Updategram&lt;/STRONG&gt;&lt;/P&gt;&lt;PRE&gt;&amp;lt;ROOT xmlns:updg="urn:schemas-microsoft-com:xml-updategram"&amp;gt;
   &amp;lt;updg:sync mapping-schema="testMap.xml"&amp;gt;
      &amp;lt;updg:before /&amp;gt;
      &amp;lt;updg:after&amp;gt;
         &amp;lt;binaryTest someParameter="1" attachmentData="dGhpcyBpcyBhIHRleHQgZmlsZQ==" /&amp;gt;
      &amp;lt;/updg:after&amp;gt;
   &amp;lt;/updg:sync&amp;gt;
&amp;lt;/ROOT&amp;gt;
&lt;/PRE&gt;
&lt;P&gt;If this updategram is executed as a template query in a virtual directory configured for SQLXML access, a record will be inserted in the &amp;#8220;binaryTest&amp;#8221; table with the Base64 encoded data converted to binary.&lt;/P&gt;
&lt;P&gt;I wasn't able to use this solution for my problem because I couldn't figure out how to get the updategram generated by BizTalk to use a mapping schema.&lt;/P&gt;&lt;p&gt;&lt;a href="http://www.pheedo.com/click.phdo?x=6cda6ad746d942b9a1110d0715a4fa12&amp;u=57522"&gt;&lt;img src="http://www.pheedo.com/img.phdo?x=6cda6ad746d942b9a1110d0715a4fa12&amp;u=57522" border="0"/&gt;&lt;/a&gt;&lt;/p&gt;&lt;iframe src="http://ads.geekswithblogs.net/a.aspx?ZoneID=5&amp;amp;Task=Get&amp;amp;PageID=31016&amp;amp;SiteID=1" width=1 height=1 Marginwidth=0 Marginheight=0 Hspace=0 Vspace=0 Frameborder=0 Scrolling=No&gt;
&lt;script language='javascript1.1' src="http://ads.geekswithblogs.net/a.aspx?ZoneID=5&amp;amp;Task=Get&amp;amp;Browser=NETSCAPE4&amp;amp;NoCache=True&amp;PageID=31016&amp;amp;SiteID=1"&gt;&lt;/script&gt;
&lt;noscript&gt;&lt;a href="http://ads.geekswithblogs.net/a.aspx?ZoneID=5&amp;amp;Task=Click&amp;amp;Mode=HTML&amp;amp;SiteID=1&amp;amp;PageID=31016" target="_blank"&gt;
&lt;img src="http://ads.geekswithblogs.net/a.aspx?ZoneID=5&amp;amp;Task=Get&amp;amp;Mode=HTML&amp;amp;SiteID=1&amp;amp;PageID=31016" width="1" height="1" border="0"  alt=""&gt;&lt;/a&gt;
&lt;/noscript&gt;
&lt;/iframe&gt;
&lt;img src="http://geekswithblogs.net/scarpenter/aggbug/57522.aspx" width="1" height="1" /&gt;</description>
            <dc:creator>Sean Carpenter</dc:creator>
            <guid>http://geekswithblogs.net/scarpenter/archive/2005/10/20/57522.aspx</guid>
            <pubDate>Thu, 20 Oct 2005 11:04:00 GMT</pubDate>
            <comments>http://geekswithblogs.net/scarpenter/archive/2005/10/20/57522.aspx#feedback</comments>
            <wfw:commentRss>http://geekswithblogs.net/scarpenter/comments/commentRss/57522.aspx</wfw:commentRss>
            <trackback:ping>http://geekswithblogs.net/scarpenter/services/trackbacks/57522.aspx</trackback:ping>
        </item>
        <item>
            <title>Inserting Base64 Data into an image Column</title>
            <link>http://geekswithblogs.net/scarpenter/archive/2005/10/19/57442.aspx</link>
            <description>&lt;P&gt;I recently had the need to insert some binary data that was encoded as &lt;A href="http://en.wikipedia.org/wiki/Base64"&gt;Base64&lt;/A&gt; into a SQL Server image column.&amp;nbsp; Since I was using BizTalk, I was hoping it would be relatively straight forward - I was wrong.&amp;nbsp; There's a bit of information here on how I came to this problem and some BizTalk stuff, so if you just want the solution, &lt;A href="#Solution"&gt;jump to here&lt;/A&gt;.&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;The Background&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;I was using &lt;A href="http://www.microsoft.com/biztalk/default.mspx"&gt;BizTalk&lt;/A&gt; to pull a record from one SQL Server, do some processing on the data, and then insert the processed record into another SQL Server.&amp;nbsp; The catch was that I needed to pull along some binary data and insert it into the second SQL Server.&amp;nbsp; The data was stored in an image column in each SQL Server DB.&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;The Problem&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;Things started out easily enough.&amp;nbsp; I was using a SQL Receive adapter to get the data from the source database.&amp;nbsp; I added the BINARY BASE64 option to the FOR XML clause I was using and got the binary data as Base64.&amp;nbsp; I then used the Add Generated Items wizard to generate the schema for the SQL insert (I was using a stored procedure that had a parameter typed as image).&amp;nbsp; I was happy to see that the generated schema listed the data type of the attribute corresponding to the stored procedure parameter as &amp;#8220;xs:base64binary&amp;#8221;.&amp;nbsp; This led me to believe that BizTalk (or the SQL Send Adapter, or SQLXML, or &lt;EM&gt;something&lt;/EM&gt;) would convert the data back to binary as part of the insert.&amp;nbsp; Not so.&amp;nbsp; When the orchestration ran, I just got an error back from SQL Server: 
&lt;P&gt;&lt;PRE&gt;The adapter "SQL" raised an error message.
Details "HRESULT="0x80040e07" Description="Operand type clash: ntext is incompatible with image"&lt;/PRE&gt;
&lt;P&gt;So obviously nothing was converting the Base64 data back to binary.&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;&lt;A name=Solution&gt;The Solution&lt;/A&gt;&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;I &lt;A href="http://groups.google.com/group/microsoft.public.biztalk.general/browse_thread/thread/8e203efb0453c0c3/cc579936a0a5673d?lnk=st&amp;amp;q=base64+data+group:microsoft.public.biztalk.*&amp;amp;rnum=1#cc579936a0a5673d"&gt;posted a question&lt;/A&gt; to the newsgroups, but didn't really receive a good answer.&amp;nbsp; The solution I ended up with was to&amp;nbsp;slightly modify a SQL Server UDF &lt;A href="http://groups.google.com/group/microsoft.public.sqlserver.xml/browse_thread/thread/37de4734df976668/a5e9dcf887de5378?tvc=2&amp;amp;q=base64+binary+group:microsoft.public.sqlserver.*&amp;amp;hl=en#a5e9dcf887de5378"&gt;I found on the newsgroups&lt;/A&gt;.&amp;nbsp; The content of the modified UDF is below:&lt;/P&gt;&lt;PRE&gt;CREATE FUNCTION base64toBin (@bin64raw varchar(8000)) 
RETURNS varbinary(8000) 
AS 
BEGIN 
 declare @out varbinary(6000) 
 declare @i int 
 declare @length int 
 declare @bin64char char(1) 
 declare @bin64rawval tinyint 
 declare @bin64phase tinyint 
 declare @bin64nibble1 tinyint 
 declare @bin64nibble2 tinyint 
 declare @bin64nibble3 tinyint 
 SELECT @bin64phase = 0 
 SELECT @i = 1 
 SELECT @length = len(@bin64raw) 
 if right(@bin64raw, 1) &amp;lt;&amp;gt; '='
  set @length = @length + 1
 WHILE @i &amp;lt; @length 
 BEGIN 
  SELECT @bin64char = substring(@bin64raw,@i,1) 
  BEGIN           
   IF ASCII(@bin64char) BETWEEN 65 AND 90 
    SELECT @bin64rawval = ASCII(@bin64char)-65 
   ELSE 
    IF @bin64char LIKE '[a-z]' 
     SELECT @bin64rawval = ASCII(@bin64char)-71 
    ELSE 
     IF @bin64char LIKE '[0-9]' 
      SELECT @bin64rawval = ASCII(@bin64char)+4 
     ELSE             
      IF @bin64char = '+' 
       SELECT @bin64rawval = ASCII(@bin64char)+19 
      ELSE                     
       IF @bin64char = '/' 
        SELECT @bin64rawval = ASCII(@bin64char)+16 
       ELSE 
       BEGIN 
        SELECT @bin64rawval = 0 
        SELECT @i = @length-1 
       END 
  END
  IF @bin64phase = 0 
  BEGIN 
   SELECT @bin64nibble1 = (@bin64rawval - @bin64rawval%4)/4 
   SELECT @bin64nibble2 = @bin64rawval%4 
   SELECT @bin64nibble3 = 0 
  END 
  ELSE 
   IF @bin64phase =1   
   BEGIN 
    SELECT @bin64nibble2 = (@bin64nibble2*4) + (@bin64rawval - @bin64rawval%16)/16 
    SELECT @bin64nibble3 = @bin64rawval%16 
    IF @i&amp;lt;5 
     SELECT @out= convert (binary(1),((16*@bin64nibble1) + @bin64nibble2)) 
    ELSE                                             
     SELECT @out= @out + convert (binary(1),((16*@bin64nibble1) + @bin64nibble2)) 
   END
   ELSE 
    IF @bin64phase =2   
    BEGIN 
     SELECT @bin64nibble1 = @bin64nibble3 
     SELECT @bin64nibble2 = (@bin64rawval - @bin64rawval%4)/4 
     SELECT @bin64nibble3 = @bin64rawval%4 
     SELECT @out=@out+ convert (binary(1),((16*@bin64nibble1) + @bin64nibble2)) 
    END 
    ELSE 
     IF @bin64phase =3 
     BEGIN 
      SELECT @bin64nibble1 = (@bin64nibble3*4) + (@bin64rawval - @bin64rawval%16)/16 
      SELECT @bin64nibble2 = @bin64rawval%16 
      SELECT @out=@out+ convert (binary(1),((16*@bin64nibble1) + @bin64nibble2)) 
    END
  SELECT @bin64phase = (@bin64phase + 1)%4 
  SELECT @i = @i + 1 
 END 
 RETURN(@out) 
END
&lt;/PRE&gt;
&lt;P&gt;The one change I made was to add the section that begins &amp;#8220;if right(@bin64raw...&amp;#8221;.&amp;nbsp; I added this because my Base64 data was more than 8000 characters long and I needed to be able to call this UDF more than once with &amp;#8220;chunks&amp;#8221; of the Base64 data.&amp;nbsp; Without the change, the UDF will drop the last character of the Base64 data on &amp;#8220;chunks&amp;#8221; in the middle.&amp;nbsp; Below is a sample that calls this UDF with chunks of 2400 characters (because of the way Base64 encoding works, the &amp;#8220;chunk&amp;#8221; size has to be divisible by 4).&lt;/P&gt;&lt;PRE&gt;CREATE PROCEDURE testConvert
    @someParameter int,
    @attachmentData text
AS

/*** Table schema used for test
CREATE TABLE testData(someValue int, attachmentData image, CONSTRAINT PK_testData primary key nonclustered (someValue))
***/

-- insert NULL (0x0) into the image field so that the TEXTPTR function will work
insert testData(someValue, attachmentData)
values(@someParameter, 0x0)

declare @pointer varbinary(16)
select @pointer = TEXTPTR(attachmentData) from testData where someValue = @someParameter

declare @buff varchar(2400)
declare @offset int, @imgOffset int
set @offset = 1
set @imgOffset = 0
while @offset &amp;lt;= datalength(@attachmentData)
begin
 select @buff = substring(@attachmentData, @offset, 2400)
 declare @img varbinary(8000)
 select @img = dbo.base64toBin(@buff)
 UPDATETEXT testData.attachmentData @pointer @imgOffset NULL @img
 set @imgOffset = @imgOffset + datalength(@img)
 set @offset = @offset + 2400
end
&lt;/PRE&gt;
&lt;P&gt;So that's it.&amp;nbsp; This has been working in production now for over a month, so I'm pretty happy.&amp;nbsp; Hopefully this can help someone else.&lt;/P&gt;&lt;p&gt;&lt;a href="http://www.pheedo.com/click.phdo?x=6cda6ad746d942b9a1110d0715a4fa12&amp;u=57442"&gt;&lt;img src="http://www.pheedo.com/img.phdo?x=6cda6ad746d942b9a1110d0715a4fa12&amp;u=57442" border="0"/&gt;&lt;/a&gt;&lt;/p&gt;&lt;iframe src="http://ads.geekswithblogs.net/a.aspx?ZoneID=5&amp;amp;Task=Get&amp;amp;PageID=31016&amp;amp;SiteID=1" width=1 height=1 Marginwidth=0 Marginheight=0 Hspace=0 Vspace=0 Frameborder=0 Scrolling=No&gt;
&lt;script language='javascript1.1' src="http://ads.geekswithblogs.net/a.aspx?ZoneID=5&amp;amp;Task=Get&amp;amp;Browser=NETSCAPE4&amp;amp;NoCache=True&amp;PageID=31016&amp;amp;SiteID=1"&gt;&lt;/script&gt;
&lt;noscript&gt;&lt;a href="http://ads.geekswithblogs.net/a.aspx?ZoneID=5&amp;amp;Task=Click&amp;amp;Mode=HTML&amp;amp;SiteID=1&amp;amp;PageID=31016" target="_blank"&gt;
&lt;img src="http://ads.geekswithblogs.net/a.aspx?ZoneID=5&amp;amp;Task=Get&amp;amp;Mode=HTML&amp;amp;SiteID=1&amp;amp;PageID=31016" width="1" height="1" border="0"  alt=""&gt;&lt;/a&gt;
&lt;/noscript&gt;
&lt;/iframe&gt;
&lt;img src="http://geekswithblogs.net/scarpenter/aggbug/57442.aspx" width="1" height="1" /&gt;</description>
            <dc:creator>Sean Carpenter</dc:creator>
            <guid>http://geekswithblogs.net/scarpenter/archive/2005/10/19/57442.aspx</guid>
            <pubDate>Wed, 19 Oct 2005 17:09:00 GMT</pubDate>
            <comments>http://geekswithblogs.net/scarpenter/archive/2005/10/19/57442.aspx#feedback</comments>
            <wfw:commentRss>http://geekswithblogs.net/scarpenter/comments/commentRss/57442.aspx</wfw:commentRss>
            <trackback:ping>http://geekswithblogs.net/scarpenter/services/trackbacks/57442.aspx</trackback:ping>
        </item>
    </channel>
</rss>