Click here to monitor SSC
SQLServerCentral is supported by Red Gate Software Ltd.
 
Log in  ::  Register  ::  Not logged in
 
 
 
        
Home       Members    Calendar    Who's On


Add to briefcase

Database design issue Expand / Collapse
Author
Message
Posted Tuesday, October 26, 2010 2:09 PM
Forum Newbie

Forum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum Newbie

Group: General Forum Members
Last Login: Tuesday, October 26, 2010 1:51 PM
Points: 1, Visits: 0
I am using sql server 2008. I am building a website in ASP.net and querying my db. I have a table called "groups" and it contains 2 columns among several others. However only these 2 columns are of primary importance to me right now.

col1 is a string and the length of which denotes a level. Example, "GRD" denotes that this node is at level 3 because length(GRD) = 3 and so on.

col2 is also a string which is just a description , like "Grid is Open". nothing more to it.

Now this is a live site which mean that I cannot change any records in the table. However I can insert a new column in this table. I want to achieve the following:

display NEW level 2 nodes on my webpage. NEW means that I do not have them in the table yet but will need to somehow incorporate them. I cant insert a record but I can create a new column and use it. I now have a design/implementation issue as follows:

If a insert col3 with new strings in it (for the the description as in col2) how do I relate it to the col1 levels? Also I am not able to explain here but if needed please tell me if you guys need more info on the table. The col1 also has string like U" and "TH" in it to denote the code and levels 1 and 2 of the node under which my level 3 nodes would be displayed. I hope that my question is clear.
Post #1011125
Posted Tuesday, October 26, 2010 2:18 PM


SSCertifiable

SSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiable

Group: General Forum Members
Last Login: 2 days ago @ 9:51 AM
Points: 5,446, Visits: 7,616
virpan_17 (10/26/2010)
I hope that my question is clear.


As mud.

Alright, you have a table. Col1 is varchar with an assumed column indicating level that's calculated by LEN(Col1). Easy enough. Col2 means... nothing, other then a descriptor. So we don't care.

display NEW level 2 nodes on my webpage. NEW means that I do not have them in the table yet but will need to somehow incorporate them.


You find these level 2 nodes from where? We've described one table... well, kinda described... and this record isn't in there. So, where are you getting it from to compare?

After that, you're simply going to check the current table's Col1 (say, with an 'exists' or 'left join') and see if the Level 2's you've got are in the table. Considering you're comparing Varchar to varchar... you don't even care that they're level 2's, except for how you're going to extract them from the source.

I think that will answer your question for what information we actually have. Otherwise, schema and sample data, as seen below in the links in my signature, please. You're trying to be careful and cagey about your actual data and schema in public. I understand. Also understand that vague descriptions get vague answers.



- Craig Farrell

Never stop learning, even if it hurts. Ego bruises are practically mandatory as you learn unless you've never risked enough to make a mistake.

For better assistance in answering your questions | Forum Netiquette
For index/tuning help, follow these directions. |Tally Tables

Twitter: @AnyWayDBA
Post #1011133
Posted Tuesday, October 26, 2010 2:27 PM


Hall of Fame

Hall of FameHall of FameHall of FameHall of FameHall of FameHall of FameHall of FameHall of FameHall of Fame

Group: General Forum Members
Last Login: Tuesday, January 28, 2014 8:15 AM
Points: 3,065, Visits: 4,639
virpan_17 (10/26/2010)
I am using sql server 2008. I am building a website in ASP.net and querying my db. I have a table called "groups" and it contains 2 columns among several others. However only these 2 columns are of primary importance to me right now.

col1 is a string and the length of which denotes a level. Example, "GRD" denotes that this node is at level 3 because length(GRD) = 3 and so on.

col2 is also a string which is just a description , like "Grid is Open". nothing more to it.

Now this is a live site which mean that I cannot change any records in the table. However I can insert a new column in this table. I want to achieve the following:

display NEW level 2 nodes on my webpage. NEW means that I do not have them in the table yet but will need to somehow incorporate them. I cant insert a record but I can create a new column and use it. I now have a design/implementation issue as follows:

If a insert col3 with new strings in it (for the the description as in col2) how do I relate it to the col1 levels? Also I am not able to explain here but if needed please tell me if you guys need more info on the table. The col1 also has string like U" and "TH" in it to denote the code and levels 1 and 2 of the node under which my level 3 nodes would be displayed. I hope that my question is clear.


Ok... let me rephrase it.

Shall I understand you have a table where you cannot "update" but you need to somehow let the system know that a particular row has a NEW value, is that correct?

If this is correct this pretty much defines what we call SCD (Slowly Changing Dimensions) of the Type 2

The general idea is that a particular col1 row changes the value of col2 over time. SCD Type 2 solves the issue by tracking the changes and exposing the newest one by default.

Plenty of documentation in the net, just bing "slowly changing dimension type 2"

Hope this helps.


_____________________________________
Pablo (Paul) Berzukov

Author of Understanding Database Administration available at Amazon and other bookstores.

Disclaimer: Advice is provided to the best of my knowledge but no implicit or explicit warranties are provided. Since the advisor explicitly encourages testing any and all suggestions on a test non-production environment advisor should not held liable or responsible for any actions taken based on the given advice.
Post #1011136
Posted Tuesday, October 26, 2010 3:48 PM
Hall of Fame

Hall of FameHall of FameHall of FameHall of FameHall of FameHall of FameHall of FameHall of FameHall of Fame

Group: General Forum Members
Last Login: Yesterday @ 2:13 PM
Points: 3,840, Visits: 3,853
Also I am not able to explain here but if needed please tell me if you guys need more info on the table.


Yes, more info would help a ton. Please post your table DDL along with some sample data (in a readily consumable form) that demonstrates your dilemma. See the article in my signature line for etiquette on posting sample data.




John Rowan

======================================================
======================================================
Forum Etiquette: How to post data/code on a forum to get the best help - by Jeff Moden
Post #1011179
« Prev Topic | Next Topic »

Add to briefcase

Permissions Expand / Collapse