P
Pieter
Hi,
I have a View which contains (of course) several columns. Now I want to make
a Stored Procedure that does a Select based on the parameters.
For exemple: One time I want to select all the reocrds with ColumnA = 'Value
A', an other time all the reords with ColumnB = 'An other value', a third
time all records with "ColumnA = 'Value C' AND ColumnB = 'this value'" etc
etc.
So my paramters must be kind of flexible.
What is the best solution for this?
- Adding a paramter to my stored procedure for every column, evaluate them
and when not empty build a SQL-query dynamically and EXEC it?
- Building the WHERE-clause in my application (VB.NET 2005), and giving this
as 1 paramter to my stored procedure, and build the sql query and EXEC it?
- Some nice SQL Server/VB.NET solution that handles this kind of cases in a
smooth way?
Are there different kinds of performances with the different possible
solutions?
Thanks a lot in advance,
Pieter
I have a View which contains (of course) several columns. Now I want to make
a Stored Procedure that does a Select based on the parameters.
For exemple: One time I want to select all the reocrds with ColumnA = 'Value
A', an other time all the reords with ColumnB = 'An other value', a third
time all records with "ColumnA = 'Value C' AND ColumnB = 'this value'" etc
etc.
So my paramters must be kind of flexible.
What is the best solution for this?
- Adding a paramter to my stored procedure for every column, evaluate them
and when not empty build a SQL-query dynamically and EXEC it?
- Building the WHERE-clause in my application (VB.NET 2005), and giving this
as 1 paramter to my stored procedure, and build the sql query and EXEC it?
- Some nice SQL Server/VB.NET solution that handles this kind of cases in a
smooth way?

Are there different kinds of performances with the different possible
solutions?
Thanks a lot in advance,
Pieter