September 18, 2006 at 7:59 am
Im creating a proc that selects parameters based on whether their values are null or not. if the parameter is null it should not be used in the select statement. The number of non null parameters will be based on info from a .net app.
My current solution to this problem would be to have a number of different procs with varying numbers of parameters and allow the app to pick which procedure to use, is there a more efficient solution to this using just 1 proc .
Thanks for the help
c.m
September 18, 2006 at 8:38 am
Depends what you plan to do with 'em in the proc.
Can you show us what you need with those parameters?
September 18, 2006 at 10:15 am
You can use the following(instead of creating "n" number of sps)
1. Procedures can accept default values.
2.If a default value comes in then you can set the appropriate boundary conditions. For example if a parameter called dateofBusiness is passed with No value then you can it to pull any data since 1/1/1900.
Hope this points u in right direction.
Thanks
Sreejith
September 18, 2006 at 12:19 pm
thanks guys actually solved the problem in the app. Was tryng to write a query that wouldnt have worked
Viewing 4 posts - 1 through 3 (of 3 total)
You must be logged in to reply to this topic. Login to reply