<?xml version="1.0" encoding="UTF-8"?><rss
version="2.0"
xmlns:content="http://purl.org/rss/1.0/modules/content/"
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:series="http://unfoldingneurons.com/"
> <channel><title>Comments on: Optional parameters in Stored Procedure</title> <atom:link href="http://www.linglom.com/2008/09/12/optional-parameters-in-stored-procedure/feed/" rel="self" type="application/rss+xml" /><link>http://www.linglom.com/2008/09/12/optional-parameters-in-stored-procedure/</link> <description>Source of IT knowledge</description> <lastBuildDate>Thu, 09 Feb 2012 17:22:01 +0000</lastBuildDate> <sy:updatePeriod>hourly</sy:updatePeriod> <sy:updateFrequency>1</sy:updateFrequency> <generator>http://wordpress.org/?v=3.3.1</generator> <item><title>By: Mehboob Ali Yousafzai</title><link>http://www.linglom.com/2008/09/12/optional-parameters-in-stored-procedure/comment-page-1/#comment-7168</link> <dc:creator>Mehboob Ali Yousafzai</dc:creator> <pubDate>Thu, 14 Oct 2010 14:46:48 +0000</pubDate> <guid
isPermaLink="false">http://www.linglom.com/?p=194#comment-7168</guid> <description>Sir,if suppose i had a store procedure to insert two fields in a table,
Create procedure test
@a int =null,
@b nvarchar(50) =null
as
insert into tblName(col1,col2)
values(@a,@b)
go
Now when i execute the following line it successfull
exec test
&amp; also
exec test 1,&#039;Swabi&#039;
But if i only want to insert nvarchar(50) data i.e in @b(col2),then what should i do?
exec test &#039;Swabi&#039; --error,as first argument is integer missing...
Can any one help me plz !!!</description> <content:encoded><![CDATA[<p>Sir,if suppose i had a store procedure to insert two fields in a table,<br
/> Create procedure test<br
/> @a int =null,<br
/> @b nvarchar(50) =null<br
/> as<br
/> insert into tblName(col1,col2)<br
/> values(@a,@b)<br
/> go</p><p>Now when i execute the following line it successfull<br
/> exec test<br
/> &amp; also<br
/> exec test 1,&#8217;Swabi&#8217;<br
/> But if i only want to insert nvarchar(50) data i.e in @b(col2),then what should i do?<br
/> exec test &#8216;Swabi&#8217; &#8211;error,as first argument is integer missing&#8230;</p><p>Can any one help me plz !!!</p> ]]></content:encoded> </item> <item><title>By: linglom</title><link>http://www.linglom.com/2008/09/12/optional-parameters-in-stored-procedure/comment-page-1/#comment-4302</link> <dc:creator>linglom</dc:creator> <pubDate>Wed, 20 May 2009 09:51:16 +0000</pubDate> <guid
isPermaLink="false">http://www.linglom.com/?p=194#comment-4302</guid> <description>Hi, Jonathan
Specify parameter name can solve your problem.
For example,
EXEC [dbo].[sp_getproduct] @UnitsInStock = 20
exec usp_StoredProcA param1 = 10, param3 = 20</description> <content:encoded><![CDATA[<p>Hi, Jonathan<br
/> Specify parameter name can solve your problem.</p><p>For example,<br
/> EXEC [dbo].[sp_getproduct] @UnitsInStock = 20<br
/> exec usp_StoredProcA param1 = 10, param3 = 20</p> ]]></content:encoded> </item> <item><title>By: Jonathan</title><link>http://www.linglom.com/2008/09/12/optional-parameters-in-stored-procedure/comment-page-1/#comment-4301</link> <dc:creator>Jonathan</dc:creator> <pubDate>Wed, 20 May 2009 08:48:46 +0000</pubDate> <guid
isPermaLink="false">http://www.linglom.com/?p=194#comment-4301</guid> <description>Hi,
I&#039;m having problms using optionals. I&#039;m using 3 params in my stored proc.  Param 1 is required but params 2 and 3 are optionals.  I can run my stored proc fine if I omit both params 2 and 3.  But if I omit param 2 and pass a value to param 3, SQL Server complains:
Msg 102, Level 15, State 1, Line 1
Incorrect syntax near &#039;,&#039;.
The syntax I used is:
exec usp_StoredProcA param1,, param3
If I do the following:
exec usp_StoredProcA param1, &#039;&#039;, param3
param 2 is interpreted as empty string and not the default value that I specified.
Sorry for the long email.  Hope I explained myself clearly.</description> <content:encoded><![CDATA[<p>Hi,<br
/> I&#8217;m having problms using optionals. I&#8217;m using 3 params in my stored proc.  Param 1 is required but params 2 and 3 are optionals.  I can run my stored proc fine if I omit both params 2 and 3.  But if I omit param 2 and pass a value to param 3, SQL Server complains:<br
/> Msg 102, Level 15, State 1, Line 1<br
/> Incorrect syntax near &#8216;,&#8217;.</p><p>The syntax I used is:<br
/> exec usp_StoredProcA param1,, param3</p><p>If I do the following:<br
/> exec usp_StoredProcA param1, &#8221;, param3</p><p>param 2 is interpreted as empty string and not the default value that I specified.</p><p>Sorry for the long email.  Hope I explained myself clearly.</p> ]]></content:encoded> </item> <item><title>By: linglom</title><link>http://www.linglom.com/2008/09/12/optional-parameters-in-stored-procedure/comment-page-1/#comment-4275</link> <dc:creator>linglom</dc:creator> <pubDate>Tue, 12 May 2009 02:34:47 +0000</pubDate> <guid
isPermaLink="false">http://www.linglom.com/?p=194#comment-4275</guid> <description>Hi, Priya
The example above is to execute the store procedure without specify parameters by set default values (NULL) to the parameters.</description> <content:encoded><![CDATA[<p>Hi, Priya<br
/> The example above is to execute the store procedure without specify parameters by set default values (NULL) to the parameters.</p> ]]></content:encoded> </item> <item><title>By: Priya</title><link>http://www.linglom.com/2008/09/12/optional-parameters-in-stored-procedure/comment-page-1/#comment-4258</link> <dc:creator>Priya</dc:creator> <pubDate>Thu, 07 May 2009 09:52:57 +0000</pubDate> <guid
isPermaLink="false">http://www.linglom.com/?p=194#comment-4258</guid> <description>I cant understand with this example</description> <content:encoded><![CDATA[<p>I cant understand with this example</p> ]]></content:encoded> </item> </channel> </rss>
<!-- Performance optimized by W3 Total Cache. Learn more: http://www.w3-edge.com/wordpress-plugins/

Page Caching using disk: basic
Database Caching 1/15 queries in 0.026 seconds using disk: basic
Content Delivery Network via cdn.linglom.com/linglom

Served from: www.linglom.com @ 2012-02-10 10:12:13 -->
