Hi,
OK so I have a SQL Statement I'm currently passing as a string in a command object from VB 2008 to SQL Server, in which I have a standard query that's in boilerblate text, and I concatenate in a WHERE clause before sending it when I need to filter the returned data set.
I'm thinking of taking this and creating a stored procedure out of it, but I'm not sure how to handle the variable WHERE clause this way. Since the conditions can be changed by the user to filter the data by several different fields and values, I don't want to create an SP for every eventuality (It would be impossible anyway). So I got to thinking, would it be possible to send the WHERE clause as a Parameter when calling the procedure and concatenate it inside the SP similar to the way I do it now?
Or would it just be better to return the whole set and filter it in the DataGridView I'm using to show the results?
Just curious if this can (or should) be done...
Craig
Amesville
OK so I have a SQL Statement I'm currently passing as a string in a command object from VB 2008 to SQL Server, in which I have a standard query that's in boilerblate text, and I concatenate in a WHERE clause before sending it when I need to filter the returned data set.
I'm thinking of taking this and creating a stored procedure out of it, but I'm not sure how to handle the variable WHERE clause this way. Since the conditions can be changed by the user to filter the data by several different fields and values, I don't want to create an SP for every eventuality (It would be impossible anyway). So I got to thinking, would it be possible to send the WHERE clause as a Parameter when calling the procedure and concatenate it inside the SP similar to the way I do it now?
Or would it just be better to return the whole set and filter it in the DataGridView I'm using to show the results?
Just curious if this can (or should) be done...
Craig
Amesville