Groups | Blog | Home
all groups > sql server programming > july 2004 >

sql server programming : Help!!!


Bazuka
7/27/2004 10:55:02 PM
I called for befor, but i only got one erelevant answer. pls try to solve and help
Hey all, i want to build a product (a watch) code dynamicly, ill explain:

a watch has a few characteristics:
1. WatchType (wrist watch,wall clock, alarm clock etc.)
2. manufacturer (casio, seiko, timex)
3. Brand (casio- babyG, Gshock. Seiko-kinetik, etc.)
4. Model (BabyG -bg18278v, kiinetik- 11ki9, etc.)
5. Color

I want to build a unique code out of these featurs.
What i mean is, that this procedure begins with selecting a WatchType out of a WatchType table. (id, name)

the next step is selecting a manufactuere that is relevant ONLY for this watchtype out of the manufacturer table.(id, name)

That way its keeping on selecting the relevant charecters for the specific watch.

the thing is, that i cant make a key field that apears more than once.
Any suggestion for this problem?

And another Q, in case ill keep the above method: what is the SQL sentence that can count a charecter ( or a number) in a culomn (lets say: the WatchTypeID column in the Manufacturer table)
and will show me the following number in the next field.
This refers to the Manufacturer table which consists of WatchTypeID,ManufacturerID (for every watchtype it begins from #1), ManufcturerName.

Tanks a lot for those who try.
Tea C
7/27/2004 11:51:04 PM
It’s not really clear from your email what you are trying to do or what type of answer you are looking for. From what I can gather, it sounds like you need more tables or at least 1 more table, but it certainly would help, if you could articulate better what you are looking for.

1) For example, if Casio and Seiko both make wrist watches and wall clocks (a.k.a. “many-to-many relationship”), you should have a table which "sits in between" these 2 tables, for example manufacturerWatchType table. The same principle applies for your other product properties (Brand/Color/etc)

manufacturer tbl
----------------------------
manufacturerID Name
1 Casio
2 Seiko
etc

watchtype tbl
-------------------
watchtypeID Name
1 wrist watches
2 wall clocks
etc

manufacturerWatchType
---------------------------------
manufacturerID watchtypeID
1 1
1 2
2 1
2 2
etc.


2) Or, you might be able to accomplish what you need by creating a "central" Product table, with the following columns:
ProductID, BrandID, ColorID, ManufacturerID, watchtypeID.

3) What do you mean by "count characters in a column"? You might want to check out the SQL Help (e.g., check the following "terms": Identity, Len, DataLength, Count).

--
Tea C.


[quoted text, click to view]
Uri Dimant
7/28/2004 10:10:56 AM
bazuka
It is hard to understand without DDL+ sample data + expected result



[quoted text, click to view]
that can count a charecter ( or a number) in a culomn (lets say: the
WatchTypeID column in the Manufacturer table)
[quoted text, click to view]
WatchTypeID,ManufacturerID (for every watchtype it begins from #1),
ManufcturerName.
[quoted text, click to view]

AddThis Social Bookmark Button