![]() | |
![]() |
| | Thread Tools | Search this Thread | Display Modes |
#1
| |||
| |||
|
#2
| |||
| |||
|
|
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. |
#3
| |||
| |||
|
|
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. |
#4
| |||
| |||
|
|
"William (Bill) Vaughn" 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 No, that's why I asked. I saw several exclusions from this rule when I was not able to change the order of the parameters. And my original question was - who knows when exactly this rule doesn't work. |
|
if you asked for that feature explicitly. In other providers like ODBC and OLE DB, the name is irrelevant but the position is fixed. Anyway thanks for answering. Just D. |
#5
| |||
| |||
|
|
What provider were you using when you saw the exclusions? Because Bill is right (of course) -- the order does not matter when using SQLServer. |
![]() |
| Thread Tools | Search this Thread |
| Display Modes | |
| |