Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
| Author |
Topic |
|
Chopsmum
Starting Member
38 Posts |
Posted - 2006-04-09 : 09:45:55
|
| Dear Friends,I am designing a web app using sql server 2005 as a the backend. I have spent an enormous amount of time designing the db tables and ensured that they are normalised. Many, as you would expect have reference to what I would call indexes which are linked via foreign keys. This may be a really dumb question but.....How do I make a lookup referential table where the integers become categories not an exact reference value (just like we do when we use vlookup in excel)?Sorry but I am a little confused.....Thanks for your help guys.Chopsmum |
|
|
nr
SQLTeam MVY
12543 Posts |
Posted - 2006-04-09 : 09:49:37
|
| The lookup table will becreate table myrefdata(myrefdata_id int ,Description varchar(100))in the referencing table you will havecreate table main(....myrefdata_id int ,...)and you retrive the data byselect ...myrefdata = mrd.Description ,...from main mjoin myrefdata mrdon m.myrefdata_id = mrd.myrefdata_id.....==========================================Cursors are useful if you don't know sql.DTS can be used in a similar way.Beer is not cold and it isn't fizzy. |
 |
|
|
khtan
In (Som, Ni, Yak)
17689 Posts |
Posted - 2006-04-09 : 09:51:55
|
you can use a JOIN to "linked" it to reference table.You can refer to the SQL Server Books OnLine for details. KH |
 |
|
|
Chopsmum
Starting Member
38 Posts |
Posted - 2006-04-09 : 09:57:27
|
| Are you telling me that if the user input value is 15 and the table shows data such as0 green10 red20 blueit will look for the category and not have a hissy fit because there was no 15?Chopsmum |
 |
|
|
nr
SQLTeam MVY
12543 Posts |
Posted - 2006-04-09 : 10:08:47
|
| You should not allow the user to input the value 15.If the stored procedure should give back an error if it happens but the app should only allow the user to select entries that exist.==========================================Cursors are useful if you don't know sql.DTS can be used in a similar way.Beer is not cold and it isn't fizzy. |
 |
|
|
X002548
Not Just a Number
15586 Posts |
|
|
Chopsmum
Starting Member
38 Posts |
Posted - 2006-04-09 : 20:42:59
|
| Thankyou Guys, you have been very helpful. I am starting to get the picture.....its hard when one application lends itself to one way of thinking and another is completely different.I am just so excited to be learning.....Thankyou |
 |
|
|
|
|
|