I have a ‘Users’ table in which I have a set of fields that I want the user decides if show them or not in the web application. How can I manage this in the db?
Perhaps create another table, for example:
Table name: data_visibility
Data_v_id = 250, 251, 252, 253
User_num = 47, 47, 47, 47
Data_name = State, City, Address, Zip_code
ShowHide = 1, 1, 0, 0
So, this means user 47 want to show State and City, and want to hide Address and Zip_code.
But then, how can I write the SP so that only returns to the app State and City?
Select @State_cont = State_cont, @City_cont = City_cont, @Address_cont = Address_cont, @Zip_code_cont = Zip_code_cont
From Users As us
JOIN data_visibility As d_vis
On us.User_id = d_vis.User_num