Re: SP Parameters - default values and parameter order

Tech-Archive recommends: Speed Up your PC by fixing your registry



The order of Parameters is determined by the provider. Each has its own
requirements. With SQL Server (and ADO.NET) one can provide the parameters
in any order as long as the name matches the name specified in the SP
definition on the server. In ADO classic one could only use named parameters
if you asked for that feature explicitly. In other providers like ODBC and
OLE DB, the name is irrelevant but the position is fixed.

hth

--
____________________________________
William (Bill) Vaughn
Author, Mentor, Consultant
Microsoft MVP
INETA Speaker
www.betav.com/blog/billva
www.betav.com
Please reply only to the newsgroup so that others can benefit.
This posting is provided "AS IS" with no warranties, and confers no rights.
__________________________________
Visit www.hitchhikerguides.net to get more information on my latest book:
Hitchhiker's Guide to Visual Studio and SQL Server (7th Edition)
and Hitchhiker's Guide to SQL Server 2005 Compact Edition (EBook)
-----------------------------------------------------------------------------------------------------------------------

"Just D" <no@xxxxxxxxxxx> wrote in message
news:OlDZh.203735$g24.127718@xxxxxxxxxxxxxxx
I know that when we write a Stored Procedure we can add a default value to
the parameter so that if it's not set when we call this SP the default
value should be used. It gives me some additional flexibility and a simple
way to manipulate the same SP in different ways.

I also know that in most cases it's not critical to change the order of
the SP parameters. For example if we're having the SP with these
parameters (don't take it close, it's just an example :)):

@PatientName varchar(255),
@Complaint varchar(255),
@ProviderName varchar(255)

we can add these parameters to the SqlParameter[] sp = ... object in a
different order comparing to the order implemented in the SP. It's
convenient for our implementation. But what I notices is that I can't
change the order of the parameters whenever I want to. Sometimes the order
is critical and I guess depends on the parameter type, but I can't
understand what's the real reason and limitations for that.

Is anybody having this kind of experience?

Thanks,
Just D.




.



Relevant Pages

  • Re: What are OleDbParameter names with Original_ prefix?
    ... Hitchhiker's Guide to Visual Studio and SQL Server ... and Hitchhiker's Guide to SQL Server 2005 Compact Edition (EBook) ... Since the table has a primary key column, ...
    (microsoft.public.dotnet.framework.adonet)
  • Re: ADO.NET Transaction
    ... Hitchhiker's Guide to Visual Studio and SQL Server ... and Hitchhiker's Guide to SQL Server 2005 Compact Edition (EBook) ... Client transactions put too much schema-dependent, ...
    (microsoft.public.dotnet.framework.adonet)
  • Re: Performance problems with OracleDataReader
    ... Hitchhiker's Guide to Visual Studio and SQL Server ... and Hitchhiker's Guide to SQL Server 2005 Compact Edition (EBook) ... referencing the columns by ordinal is far faster than using strings. ...
    (microsoft.public.dotnet.framework.adonet)
  • Re: Very slow
    ... Hitchhiker's Guide to Visual Studio and SQL Server ... and Hitchhiker's Guide to SQL Server 2005 Compact Edition (EBook) ...
    (microsoft.public.sqlserver.ce)
  • Re: ADO.NET Transaction
    ... The SqlBulkCopy class can take anything you can expose with a DataReader and send it to SQL Server in a single high-speed operation. ... Hitchhiker's Guide to Visual Studio and SQL Server ... and Hitchhiker's Guide to SQL Server 2005 Compact Edition (EBook) ... Client transactions put too much schema-dependent, ...
    (microsoft.public.dotnet.framework.adonet)