SQL Clone
SQLServerCentral is supported by Redgate
 
Log in  ::  Register  ::  Not logged in
 
 
 


Database design issue


Database design issue

Author
Message
virpan_17
virpan_17
Forum Newbie
Forum Newbie (7 reputation)Forum Newbie (7 reputation)Forum Newbie (7 reputation)Forum Newbie (7 reputation)Forum Newbie (7 reputation)Forum Newbie (7 reputation)Forum Newbie (7 reputation)Forum Newbie (7 reputation)

Group: General Forum Members
Points: 7 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.
Evil Kraig F
Evil Kraig F
SSC-Insane
SSC-Insane (20K reputation)SSC-Insane (20K reputation)SSC-Insane (20K reputation)SSC-Insane (20K reputation)SSC-Insane (20K reputation)SSC-Insane (20K reputation)SSC-Insane (20K reputation)SSC-Insane (20K reputation)

Group: General Forum Members
Points: 20507 Visits: 7660
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
PaulB-TheOneAndOnly
PaulB-TheOneAndOnly
SSChampion
SSChampion (14K reputation)SSChampion (14K reputation)SSChampion (14K reputation)SSChampion (14K reputation)SSChampion (14K reputation)SSChampion (14K reputation)SSChampion (14K reputation)SSChampion (14K reputation)

Group: General Forum Members
Points: 14097 Visits: 4639
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.
John Rowan
John Rowan
SSChampion
SSChampion (13K reputation)SSChampion (13K reputation)SSChampion (13K reputation)SSChampion (13K reputation)SSChampion (13K reputation)SSChampion (13K reputation)SSChampion (13K reputation)SSChampion (13K reputation)

Group: General Forum Members
Points: 13606 Visits: 4588
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
Go


Permissions

You can't post new topics.
You can't post topic replies.
You can't post new polls.
You can't post replies to polls.
You can't edit your own topics.
You can't delete your own topics.
You can't edit other topics.
You can't delete other topics.
You can't edit your own posts.
You can't edit other posts.
You can't delete your own posts.
You can't delete other posts.
You can't post events.
You can't edit your own events.
You can't edit other events.
You can't delete your own events.
You can't delete other events.
You can't send private messages.
You can't send emails.
You can read topics.
You can't vote in polls.
You can't upload attachments.
You can download attachments.
You can't post HTML code.
You can't edit HTML code.
You can't post IFCode.
You can't post JavaScript.
You can post emoticons.
You can't post or upload images.

Select a forum

































































































































































SQLServerCentral


Search