<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>FailBoy &#187; SQL</title>
	<atom:link href="http://www.failboy.net/tag/sql/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.failboy.net</link>
	<description>We reserve the right FAIL</description>
	<lastBuildDate>Thu, 26 Nov 2009 06:29:01 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0</generator>
		<item>
		<title>Procedure expects parameter &#8216;@statement&#8217;</title>
		<link>http://www.failboy.net/2009/05/procedure-expects-parameter-statement/</link>
		<comments>http://www.failboy.net/2009/05/procedure-expects-parameter-statement/#comments</comments>
		<pubDate>Mon, 11 May 2009 18:00:55 +0000</pubDate>
		<dc:creator>FailBoy</dc:creator>
				<category><![CDATA[Development]]></category>
		<category><![CDATA[SQL]]></category>
		<category><![CDATA[error]]></category>
		<category><![CDATA[procedure '@statement']]></category>
		<category><![CDATA[tsql]]></category>

		<guid isPermaLink="false">http://www.failboy.net/?p=13</guid>
		<description><![CDATA[Recently I was working on a script to upgrade a database and was using some dynamic T-SQL to execute a command. I kept getting the error &#8220;Procedure expects parameter &#8216;@statement&#8217; of type &#8216;ntext/nchar/nvarchar&#8217;&#8221;. Being true to my name (&#8220;FailBoy&#8221;) I knew I was doing something stupid. In my SQL Script I had declared something like [...]]]></description>
			<content:encoded><![CDATA[<p>Recently I was working on a script to upgrade a database and was using some dynamic T-SQL to execute a command. I kept getting the error &#8220;Procedure expects parameter &#8216;@statement&#8217; of type &#8216;ntext/nchar/nvarchar&#8217;&#8221;. Being true to my name (&#8220;FailBoy&#8221;) I knew I was doing something stupid. In my SQL Script I had declared something like this:</p>
<blockquote><p>DECLARE @tSql VARCHAR(max)<br />
SET @tSql = &#8216;&lt;insert Dynamic query here&gt;&#8217;<br />
execute sp_executesql @tSql</p></blockquote>
<p>Can you spot the problem? The problem is the declaration of the variable as VARCHAR. The <em>execute sp_executesql</em> procedure expects a NVARCHAR value. I simply replaced the VARCHAR with NVARCHAR and all worked perfectly.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.failboy.net/2009/05/procedure-expects-parameter-statement/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
