﻿<?xml version='1.0' encoding='UTF-8'?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/"><channel><title>SQLServerCentral / Discuss Content Posted by Andy Warren / Article Discussions / Article Discussions by Author  / Default Values and Named Parameters for Stored Procs / Latest Posts</title><generator>InstantForum.NET v2.9.0</generator><description>SQLServerCentral</description><link>http://www.sqlservercentral.com/Forums/</link><webMaster>notifications@sqlservercentral.com</webMaster><lastBuildDate>Thu, 20 Jun 2013 05:21:51 GMT</lastBuildDate><ttl>20</ttl><item><title>RE: Default Values and Named Parameters for Stored Procs</title><link>http://www.sqlservercentral.com/Forums/Topic8948-29-1.aspx</link><description>Actually last week i coded my application with a parameter refresh. but i think this is more handy... ok now im going to go back and check whether my asp application can pass the parameters as u have mentioned. if its works... Thank you  Maan...</description><pubDate>Wed, 02 Jul 2008 07:30:46 GMT</pubDate><dc:creator>Tharaka-713569</dc:creator></item><item><title>RE: Default Values and Named Parameters for Stored Procs</title><link>http://www.sqlservercentral.com/Forums/Topic8948-29-1.aspx</link><description>&lt;P&gt;Tinkering with stored procedure parameters&lt;/P&gt;&lt;P&gt;Theoretically what i did is to make the procedures behave as if they do not have parameters when no parameter is passed to the procedure when it is called. This equivalent of passing a null to the procedure parameter...&lt;/P&gt;&lt;P&gt;Therefore if you call the procedure with no parameters the procedure will return all values...you will then only need to specify values for the parameters you need.&lt;/P&gt;&lt;P&gt;To achieve this instead of specifying your parameter as say:-&lt;/P&gt;&lt;P&gt;...WHERE &lt;A href="mailto:CustomerID=@CustomerID"&gt;CustomerID=@CustomerID&lt;/A&gt; specifiy &lt;/P&gt;&lt;P&gt;....WHERE CustomerID=COALESCE(@CustomerID,CustomerID)&lt;/P&gt;&lt;P&gt;With fine tuning you will find great potential of using stored procedure...&lt;/P&gt;&lt;P&gt;Contact me at &lt;A href="mailto:clarence_assey@hotmail.com"&gt;clarence_assey@hotmail.com&lt;/A&gt; for more help&lt;/P&gt;</description><pubDate>Fri, 09 Jul 2004 04:15:00 GMT</pubDate><dc:creator>Clarence R. Assey</dc:creator></item><item><title>RE: Default Values and Named Parameters for Stored Procs</title><link>http://www.sqlservercentral.com/Forums/Topic8948-29-1.aspx</link><description>I find default parameters to be very useful when a single stored proc is being used by multiple versions of client software (ie-web, client/server).  If one of the applications supports additional functionality and parameters, then it can be implmented with no code changes to the legacy applications.-Dan</description><pubDate>Wed, 08 Jan 2003 12:02:00 GMT</pubDate><dc:creator>dj_meier</dc:creator></item><item><title>RE: Default Values and Named Parameters for Stored Procs</title><link>http://www.sqlservercentral.com/Forums/Topic8948-29-1.aspx</link><description>Just one little drawback of using default values for SP parameters...Think of default values as you think of  late binding in programming languages. If you forgot to specify a parameter for your SP, it won't give you a compile-time error. Instead it will run as if everything is fine. Even if you put an appropriate parameter validation in the beginning of SP, you will see it only at execution time, not at compile time. </description><pubDate>Wed, 08 Jan 2003 11:43:00 GMT</pubDate><dc:creator>mromm</dc:creator></item><item><title>RE: Default Values and Named Parameters for Stored Procs</title><link>http://www.sqlservercentral.com/Forums/Topic8948-29-1.aspx</link><description>Thanks for your comments so far!Andyhttp://www.sqlservercentral.com/columnists/awarren/</description><pubDate>Wed, 08 Jan 2003 11:20:00 GMT</pubDate><dc:creator>Andy Warren</dc:creator></item><item><title>RE: Default Values and Named Parameters for Stored Procs</title><link>http://www.sqlservercentral.com/Forums/Topic8948-29-1.aspx</link><description>I find default parameters very useful as I work in an environment where I often have an Access application sharing an SPROC with a web page where a parameter might be needed for the web page but is always the same coming from the application.Patrick EdgertonDBA Resource Concepts </description><pubDate>Wed, 08 Jan 2003 10:05:00 GMT</pubDate><dc:creator>Pat6295</dc:creator></item><item><title>RE: Default Values and Named Parameters for Stored Procs</title><link>http://www.sqlservercentral.com/Forums/Topic8948-29-1.aspx</link><description>I like them primarily when I may have a value that can be NULL just so that all the parameters do not need to be expressed. But to make usefull to most folks you need to put defaulted values toward the end otherwise they in some cases end up doing more work than needed.Ex.CREATE PROC ip_test@val1 as varchar(4) = NULL,@val2 as varchar(4) = NULLnw I want to set @val2 to TEST and leave @val1 outip_test @val2 = 'TEST'ip_test NULL, 'TEST'So there you see the value list was shorter to code than having to specify @val2. This sometimes can be a drawback if you use highly desciptive variable names one small data values. It is just a nicity that you have the option.However in the example if I wanted to set @val1 to TEST then I would doip_test 'TEST'which is short than the other two. My opinion is supply all values up to the last item you need and anything that can be defaulted put at the end of you list of inputs. Thus making it of the most possible use. </description><pubDate>Wed, 08 Jan 2003 06:08:00 GMT</pubDate><dc:creator>Antares686</dc:creator></item><item><title>RE: Default Values and Named Parameters for Stored Procs</title><link>http://www.sqlservercentral.com/Forums/Topic8948-29-1.aspx</link><description>I like default parameters to specify default behaviour. If a default value needs to change (customer requirement etc..) this change only has to be made in one place, whereas if you hadn't used a default this change would have to be made in every calling piece of code, maybe in multiple applications.Regards,Andy Jones</description><pubDate>Wed, 08 Jan 2003 04:51:00 GMT</pubDate><dc:creator>andyj93</dc:creator></item><item><title>RE: Default Values and Named Parameters for Stored Procs</title><link>http://www.sqlservercentral.com/Forums/Topic8948-29-1.aspx</link><description>I would say it is always nice to have a default behaviour for a stored proc. If you dont give it any parameters it will perform the default behaviour.But when you need a different behaviour you could call the sproc with a parameter.I don't see anything wrong with this......If anybody could tell me why this is wrong I could learn from them. </description><pubDate>Wed, 08 Jan 2003 04:17:00 GMT</pubDate><dc:creator>well0549</dc:creator></item><item><title>Default Values and Named Parameters for Stored Procs</title><link>http://www.sqlservercentral.com/Forums/Topic8948-29-1.aspx</link><description>Comments posted to this topic are about the content posted at &lt;A HREF=&lt;A HREF=http://www.sqlservercentral.com/columnists/awarren/defaultvaluesandnamedparametersforstoredprocs.asp&gt;http://www.sqlservercentral.com/columnists/awarren/defaultvaluesandnamedparametersforstoredprocs.asp&lt;/A&gt;&gt;&lt;A HREF=http://www.sqlservercentral.com/columnists/awarren/defaultvaluesandnamedparametersforstoredprocs.asp&gt;http://www.sqlservercentral.com/columnists/awarren/defaultvaluesandnamedparametersforstoredprocs.asp&lt;/A&gt;&lt;/A&gt;</description><pubDate>Fri, 20 Dec 2002 00:00:00 GMT</pubDate><dc:creator>Andy Warren</dc:creator></item></channel></rss>