April 30, 2011 at 10:39 pm
We have a application which deals with Sales
Below is sample structure of a table with data
Table Options
OptionID OptionDesc
1 abc
2 def
3 ghi
Right now we are displaying all the values which are in table Options
on the Option Drop down from the application side..
But in the next release we have to display only values with Option ID 1 and 2
should not display 3...
so i was planning of adding a flag in the table which sets to active/Inactive in
all the look up tables
Is the above idea a better one or there any other alternate solutions...please someone help me....
May 1, 2011 at 3:03 am
How many values are in the table?
How often does the Status of these values change?
You could use a SELECT Statement with the IN Operator.
For better, quicker answers on T-SQL questions, click on the following...
http://www.sqlservercentral.com/articles/Best+Practices/61537/
For better answers on performance questions, click on the following...
http://www.sqlservercentral.com/articles/SQLServerCentral/66909/
May 2, 2011 at 2:00 am
In the past with stuff like this I've used two tables to model all the dropdown lists so:-
DropdownGroups(id,title,isDeprecated)
and
Dropdownvalues(id,parentGroupdID,value, isDeprecated)
This saves on lots of little tables that can end up with slightly different schemas and makes it easier to write up backend admin to edit them all.
isDeprecated on the groups table lets you switch off the dropdown entirely if the ui can handle it.
May 2, 2011 at 7:24 am
I do not know the requirements but if the user was likely to add or change the status codes then I would create a maintenance form.
That way you do not have to manually add/update values from the back end.
That is my preference but it may not fit with your business model.
For better, quicker answers on T-SQL questions, click on the following...
http://www.sqlservercentral.com/articles/Best+Practices/61537/
For better answers on performance questions, click on the following...
http://www.sqlservercentral.com/articles/SQLServerCentral/66909/
May 2, 2011 at 8:56 am
Your idea about another column in the table is a good one, and the most flexible. If more selections are added and/or deleted in the future you only need to to a table update to handle it.
The probability of survival is inversely proportional to the angle of arrival.
May 2, 2011 at 9:02 am
Thanks everyone with your suggestions. really helps me...
May 2, 2011 at 9:18 am
I'm happy to you have found a solution that satisfies your needs.
If you create a Sound Database Structure it makes it easier for developers and users to manage.
Regards,
Welsh
For better, quicker answers on T-SQL questions, click on the following...
http://www.sqlservercentral.com/articles/Best+Practices/61537/
For better answers on performance questions, click on the following...
http://www.sqlservercentral.com/articles/SQLServerCentral/66909/
May 2, 2011 at 9:23 am
Thanks for your reply Welsh.
Yes i was trying to create a good database structure.
that is the reason i posted the question on forum..As there are so many good professionals/developers on the forums.
All my friends helped in a good way to solve my problem.
Really thank you each and everyone who helped me solving my problem.
Viewing 8 posts - 1 through 7 (of 7 total)
You must be logged in to reply to this topic. Login to reply