I have a problem where the user has set his preferences in a table.
The table has more than 5 columns. Now I want to search the other view with condition values that are in the preference
table.
Example:
The Preference
table has price range
, colour
etc
So I need to search the products with price and colours.
Now I want to do it in SQL Server itself i.e. passing the preference id, it will always return a single row and then from the columns get the values like min price
, max price
and then create a search query.
The Issue is I dont know that how I can store the preference row column values in variables so that I can use it.
I am using Entity Framework so that I cannot using Dynamic SQL too.
I only want to know the way by which I can store the column values of preference table.
I only know that i can do it something like:
@colour = Select Top 1 Colour from preferences;
But like this I need to write this query for every variable. Is there is some better way with something called as CTE etc.