Please Help With Small Table Design

Mar 10, 2004

Hello, could someone pls help me with this table design.





I have a project table and a code table. The code table has things like priorities (High, Medium, Low).





Now, I want all projects to be able to use these 'global' codes as well as define their own. So, they could define their own priority code 'Critical', that only their project can see.





Any help would be great.

View 1 Replies


ADVERTISEMENT

DB Design :: Is File Stream Or Blob Best For Small Database With Word And Other Docs

Aug 15, 2015

I was putting a database together (its a C# application MSSQL)  the application will handle a few hundred customers records and save  maybe a couple of thousand  word docs/images/other doc files wondered if the way to go was blob or filestream, I see the medium and larger databases seem to go for filestream but just wondered as not much mentioned about smaller dbs.I do not think  security/disk space/super fast access  will be a big issue.

View 4 Replies View Related

How To I Enter A Small Square Or A Small Circle In A NVARCHAR Field?

Dec 25, 2006

I want to store a small cirle in a text field. Can anyone tell me how I can enter it in ascii code.

Thanks

View 4 Replies View Related

Join Small Table To Big Table Or Vice Versa, Does It Matter?

Jul 23, 2005

If I join Table1 to Table2 with a WHERE condition, isit the same if I would join Table2 to Table1 consideringthat the size of the tables are different.Let's assume Table2 is much bigger than Table1.I've never used MERGE, HASH JOINs etc, do any ofthese help in this scenario?Thank you

View 3 Replies View Related

Row Retrieval Problem In Small Table

Jan 18, 2005

Dear Participant,

I face following problem by last few day, please help me for the same

My Mssql server 2000 with service pack 3 use for my lan bas users, normally they can work fine without any problem, but some time user not able to retrieve information from server. I had debugged this problem and found one small table with 50/60 records not retrieving for so long at clients machine. I open enterprise manage and trough that try to open table, but server in try mode only not show a single row after long time and give message client time out.

I open query analyzer and try to select * from table_name, it is also not retrieve a single row after long time and nothing got as a message.

Shutdown the server and restart , I am able to retrieve that table from EM, Query analyzer and from application also.

I don’t understand what is the problem.

Thanks

R.Mall

View 6 Replies View Related

Very Small Table Incredibly Slow

Jul 23, 2005

Hello.I am administering a SQL Server (Enterprise Edition on Windows 2003)from some month and can't understand what is going on in the latestweek (when the db grow a lot).The DB is around 250G, and has one table with 1 billion rows. It isperforming in a decent way, but can't understand why a particolar tablehas strong performance problem.I have a stored procedure that read table from table A and insert them,after processing in table B, and then move them in other table (similarto a Star Schema) for reporting.Table B is, for how the SP is written, not more than 3000 lines. TableB is very simple, has 3 rows, and no index.What is very strange is that performance of table B is really slow. IfI do a select count (*) from table_b it takes between 30s & 2minutes toreturn it has 0 lines. When the stored procedure insert 1000 lines, ittakes 20/30 seconds and it takes 20/30 seconds to delete them.To me it doesn't look like a lock problem, because it is slow also whenthe only procedure that access that table are stopped. I did an updatestatistics with fullscan on this table with no improvement.The DB is on a Storage Area Network that should perform decently. TheLUN I use is configured to use a piece of 32 disk that are used also byother application. I don't have performance data of the SAN. Themachine is an HP DL580 with 4 CPU (hiperthreading disabled), 8G of RAM,AWE and PAE and 5G reserved for SQL Server.I don't know what to do to solve this situation. Could it be a"corruption problem" that slow this table so much? is it possible thefact the db grow a lot in the last week created problem also to thissmall and simple table?Do you have any idea or hint on how to manage this situation, orpointer to documentation that can help in analizing this situation?For the ones that arrived till here, thank you for your time andpatience reading my bad english...Best Regards,MamoPSI can't rewrite the stored procedure, because it is part of a closedsource product.

View 16 Replies View Related

Insert Small Time Into SQL Server 2000 Table

Nov 14, 2003

Im having a lot of trouble inserting a small time value into a table cell. I gave the cell column the data type 'DateTime', i found i couldnt manually insert a time only value such as '12:30 PM' into a column with 'SmallDateTime'. Something about a "SmallDateTime Overflow Error". However if i enter a similar time value into a table column with the data type 'DateTime' it will happily accept it and leave it as entered.

The real problem seems to be when i try to send a time value to that column with my ASP.NET application. Because it inserts the time value and todays date. So that if i send:

12:30 PM

It will be stored as:

15/11/2003 12:30:00 PM

I only want to store the short time, not the date especially not the date that row was created on because thats useless for the purposes of what my application is trying to achieve and just creates problems down the track when selecting rows.


How can i correct this?

View 2 Replies View Related

Slow Performance With A Simple Query In A Small Table?

Jul 9, 2001

In my database/MY SERVER (SQL7/Win2K), I run a simple query with a Table/10000 rows (without cluster index):
SELECT * FROM TABLE
it take over 30s. Why it's slow? How can I check for reason? How to configure my server to improve performance?
Thanks in advance.
TH
----------------------------------
SP_CONFIGURE's RESULT in MY SERVER
----------------------------------

Table 'spt_values'. Scan count 1, logical reads 2, physical reads 0, read-ahead reads 0.
name minimum maximum config_value run_value
----------------------------------- ----------- ----------- ------------ -----------
affinity mask 0 2147483647 0 0
allow updates 0 1 1 1
cost threshold for parallelism 0 32767 5 5
cursor threshold -1 2147483647 -1 -1
default language 0 9999 0 0
default sortorder id 0 255 52 52
extended memory size (MB) 0 2147483647 0 0
fill factor (%) 0 100 0 0
index create memory (KB) 704 1600000 0 0
language in cache 3 100 3 3
language neutral full-text 0 1 0 0
lightweight pooling 0 1 0 0
locks 5000 2147483647 0 0
max async IO 1 255 32 32
max degree of parallelism 0 32 0 0
max server memory (MB) 4 2147483647 2147483647 2147483647
max text repl size (B) 0 2147483647 65536 65536
max worker threads 10 1024 255 255
media retention 0 365 0 0
min memory per query (KB) 512 2147483647 1024 1024
min server memory (MB) 0 2147483647 0 0
nested triggers 0 1 1 1
network packet size (B) 512 65535 4096 4096
open objects 0 2147483647 0 0
priority boost 0 1 1 1
query governor cost limit 0 2147483647 0 0
query wait (s) -1 2147483647 -1 -1
recovery interval (min) 0 32767 0 0
remote access 0 1 1 1
remote login timeout (s) 0 2147483647 5 5
remote proc trans 0 1 0 0
remote query timeout (s) 0 2147483647 0 0
resource timeout (s) 5 2147483647 10 10
scan for startup procs 0 1 0 0
set working set size 0 1 0 0
show advanced options 0 1 1 1
spin counter 1 2147483647 10000 10000
time slice (ms) 50 1000 100 100
two digit year cutoff 1753 9999 2049 2049
Unicode comparison style 0 2147483647 196609 196609
Unicode locale id 0 2147483647 1033 1033
user connections 0 32767 0 0
user options 0 4095 0 0

Table 'spt_values'. Scan count 43, logical reads 108, physical reads 0, read-ahead reads 0.
Table 'sysconfigures'. Scan count 1, logical reads 2, physical reads 0, read-ahead reads 2.

View 4 Replies View Related

Not Able To Retrieve Rows From Small Table-So Many Time For So Long

Mar 8, 2005

Dear Participants,

We are using merge replication for multi locational database but we are facing one problem in only one table which is not included in replication-

Table name is xxxxmast has only 39 row static information, but it used by every users for all task as select only information from this table like-

Select fin_year into mem_variable from xxxxmast where co_name = :global_variable
go

Code validation from here only.

Right validation from here only.

Report retrival validation from here only.

It means its usage for select from every user frequentely for so many times but we have to only fetch information from this table.

It was working prior fine but rightnow get problem for while-

Today Dated 08-March this table not accessible fro three times in eight hours-

1st time for 10 minute.

2nd time 10 minutes

3rd time 52 minutes.

Users want to login but at the login time years and other validation from this table, so users awaited for above mention time.

We had have do following by yesterday-

Drop table xxxxmast.

Create table xxxxmast.

Insert required data.


This is realy trouble for our application.

Any help realy great for us.

Thanks

R.Mall

View 3 Replies View Related

SQL Server 2008 :: Small Recursive Numbers Table

Sep 20, 2015

I am trying to do a very small numbers table to compare A1c's against. However I am running into a issue when recursion hits the number 2.27 it starts to go out of my scope that I want with the next number being 2.27999999999999. Here is the code I'm using below. I need a Decimal(2,2) or Numeric (2,2) format with a range of 01.00 to 20.00. However every time I use Numeric or Decimal as the data type I get a error "Msg 240, Level 16, State 1, Line 5.Types don't match between the anchor and the recursive part in column "Number" of recursive query "NumberSequence"."

DECLARE @Start FLOAT , @End FLOAT ---DECIMAL(2,2) Numeric (2,2)
SELECT @Start=01.00, @End=20.00
;WITH NumberSequence( Number ) AS
(
SELECT @start as Number
UNION ALL
SELECT Number + 00.01
FROM NumberSequence
WHERE Number < @end

View 5 Replies View Related

Table Size Definition - Small/medium/large

Jul 18, 2006

Hi,

Please could you tell me how big sql tables are when people refer to them as small, medium and large? Preferably in terms of disk space or rows (each row in my table will contain a standard length job advert and 20 additional columns with an average of 8 characters)

Thanks for your help! :-)

Stu

View 3 Replies View Related

DB Design :: Table Design For Packages

Aug 18, 2015

I would like to create a table called product. My objective is to get list of packages available for each product in data grid view column while selecting each product. Each product may have different packages type (eg:- Nos, CTN, OTR etc). Some product may have two packages and some for 3 packages etc. Quantity in each packages also may be differ ( for eg:- for some CTN may contain 12 nos or in other case 8 nos etc). Prices for each packages also will be different that also need to show.  How to design the table.. 

Product name   :  
Nestle milk |
Rainbow milk
packages  :
CTN,OTR, NOs |

CTN, NOs
Price:
50,20,5 |
40,6

(Remarks for your reference):CTN=10nos, OTR=4 nos  
| CTN=8 Nos

View 3 Replies View Related

Analysis :: SSAS Tabular Small Database Fails In Excel Pivot Table Because Of Memory Shortage?

May 7, 2015

I have a very small SSAS database with around 35 Mb. I opened it on Excel 32 bits and started dragging fields to a pivot table and it started failing with memory errors. The behavior on the SSAS server was that memory started growing very fast until 8 GB (vm memory total) and then the error is reported in excel.

What might be the issue in such a small database? I would understand in a big database, but not on this one.

View 13 Replies View Related

DB Design :: Insert / Update FACT Table From Staging Table

May 6, 2015

We need to Insert/Update a Fact Table from staging Table. currently we are using a SP which update Fact Table for Each region.  this process is schedule,  every 5 min job is run and Update fact table.but time of Insert and Update too long from  staging  to Fact, currently we are using merge statement for Insert and update.in my sp we are looping number  how many region we need to update and at a time single Region we are updating using while loop in current SP.

View 7 Replies View Related

DB Design :: Table Partitioning Using Reference Table Data Column

Oct 7, 2015

I have a requirement of table partitioning. we have 10 years of data on a table which is 30 billion up rows on 2005 server we are upgrading it to 2014. we have to keep 7 years of data. there is no keys on table or date column. since its a huge amount of data and many users its slow down the process speed. we are thinking to do partition on 7 years for Quarterly based. but as i said there is no date column on table we have to use reference table to get date. is there a way i can do the partitioning with out adding date column on table? also does partition will make query faster? 

I have think three ways to do it.
1. leave as it is.
2. 7 years partition on one server
3. 3 years partition on server1 and 4 years partition on server2 (for 4 years is snapshot better?)

View 3 Replies View Related

DB Design :: Insert Data From One Table To Another Table

Jul 30, 2015

I have to tables like given below Landing table "A" (Data load will happen over here, No primary keys mentioned over here) table "B" .Now I want to move the data from A to B.I have made use of below query insert into B select * from A...Landing table "A" has huge no of records, MS SQL server is taking huge amount of time.any alternative way to make this insertion process faster?

View 6 Replies View Related

Table Design

Apr 30, 2008

Hi, I am developing an application to a garment factory. I have a doubt in designing a table.Basic tables:Jobs, JobColors, Material, Units, Currencies ...These tables are designed with normalization rules.I got a problem at PurchaseOrderDetailsMain
table is JobMaterial. It has materialid, jobid, supplierid, description
and TypeFactor(which represents the type of order) means that the
material is ordered based on size or colors or total qty.1 for ByColor, 2 for BySize, 3 for ByQty, 4 for By Contrast colorsThe main problem at the details of the sub table.JobMaterialDetailsIf typefactor is by size, i need to store the details based on sizeex: S - 2000pcs, M - 4000pcs, L - 4000pcs, XL - 2000pcsSo I will have 4 records per each sizeIf it is by color, White - 3000pcs, Portabella - 5000pcs, Black - 2000pcs.If it is by general, Total qty 10000pcsHow
can I design this table. If I take, ColorOrSize column, it will refer
different values for diffrent typefactor. When by size, it will have
Size and when by color, it will refer colorcode.But colors are having referential integrity. So it is violated other than by color as typefactor.What is the best way to design this table?Can anybody suggest?Thanks in advance

View 2 Replies View Related

Table Design

Jul 24, 2000

I am desingning a table and i have a column OrderID and another column call Order, is neccessary to use a primary key, because One OrderID may have many Orders?
Thanks.

View 5 Replies View Related

Table Design

Aug 21, 2000

Coming from a support background and having to design my first database I have a couple of questions re- table design. Firstly I have set up several tables and included one field (of the same name) in each. This is a primary key in one table with an incremental seed. I would like this info to appear in the other tables although these can be duplicates in the other tables. How is it best to achieve this relationship. From reading it suggest FK in the relationship application but looking at other databases this seems to have been achieved by some other means. Is it more common to use stored procedures to enforce this? If so please add pointers. Secondly, I have set up a couple of master tables to act as looks ups for fields in other tables. Again how do I get this to look up the table - is it done through stored procedures or at the time of writing the front end application?? Sorry if this is all basic stuff but it is new to me.

Thanks for any help

View 1 Replies View Related

Table Design

Oct 26, 2004

CREATE TABLE [dbo].[table1] (
[aaa] [bigint] IDENTITY (10000, 1) NOT NULL ,
[bbb] [int] NOT NULL ,
[ccc] [int] NOT NULL ,
[ddd] [bigint] NOT NULL ,
[eee] [int] NOT NULL ,
[ffff] [varchar] (50) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL ,
[gggg] [varchar] (500) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,
[hhh] [varchar] (500) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,
[iii] [varchar] (50) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,
[jjj] [varchar] (50) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,
[kkk] [varchar] (500) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,
[lll] [varchar] (500) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,
[mmm] [varchar] (500) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,
[nnnn] [varchar] (500) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,
[ooo] [varchar] (500) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,
[ppp] [varchar] (500) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,
[qqqq] [varchar] (500) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,
[rrrr] [varchar] (500) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,
[ssss] [varchar] (500) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,
[tttt] [varchar] (500) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,
[uuuuu] [varchar] (2000) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,
[vvvvv] [varchar] (500) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,
[wwwww] [varchar] (150) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,
[xxxxx] [varchar] (500) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,
[yyyyy] [varchar] (500) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,
[zzzzz] [int] NULL ,
[abc] [varchar] (500) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,
[def] [datetime] NULL ,
[ghi] [datetime] NOT NULL ,
[jkl] [varchar] (1000) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,
[mno] [bigint] NULL
) ON [PRIMARY]


I have created a table with above column width. The rowsize is more than 8kb.And the table holds millions of rows of data. So is it a correct way of designing the table?
Or how can I redesign this table.

Thanks.

View 1 Replies View Related

Table Design Help

Mar 16, 2004

I'm currently developing a real estate system to manage order processing and work flow. I'm a little uncertain as to how to design the tables because an order can have N number of applicants, owners, buyers, and properties. There are cases where there are 9 different buyers and some where the number of properties exceeds 20. It seems that normalization might make the situation crazy, but I'm a touch rusty. Thanks.

View 2 Replies View Related

Table Design ? What To Do?

Apr 16, 2004

I am developing an estimating application and at the "quantity takeoff" level, all products/equipment/sub contracting/etc.... end up on the same table because of the common elements:


Item | Quantity | Unit Price | SubTotal | Total


Now, since the unit price of a product is not determined from the same tables as the unit price of equipment rentals or sub contract work, etc...
how do I direct the attention to the appropriate table when trying to obtain the unit price or edit the unit price etc...

If my question is not clear, let me know, I will try to clarify.

Mike B

View 3 Replies View Related

Design Table

May 10, 2008

Hi,

Is there a way to copy and save my Design Table? I want to transfer it to another workstation.

View 8 Replies View Related

Table Design

Feb 13, 2006

Hi am trying to figure out my table design need some advice

I have a table that catches the telephone numbers of a customer , there are 5 telephones for each customer. All the numbers are there in the DB

Should I create the design in the following format

CustomerName
Tel1
Tel2
Tel3
Tel4
Tel5

Or Should I have

Customer
Telephone

& then have 5 rows for each customer

Please advice


I even wanted to knw how should the design be , if all the Tel Nos are not captured, I mean what if some customers have 3 tel Nos, while some may just have 1 while some may have all 5

Thanks

View 7 Replies View Related

Please Help With SQL Table Design

Aug 21, 2006

Hi I'm having trouble figuring out this database design and normalising the data. Following are the tables and I am wonder if it can be normalised any further. This is a database of Architects and their work history and building they have designed.

Architects:
FirstName
LastName
Gender
DOB
Bio

Works:
Title
Client
Type_of_Building
Style
Address
Year_Designed
Year_Completed
Comments
Architect_ID

Firm: (this is the various firms that the architect has worked for)
CompanyName
Address

EmploymentHistory: (when the architect worked with a particular firm)
Year_Start
Year_End
Firm_ID
Architect_ID

Publication: (where the architects works were published)
Author
Date_Publication
Title
Source
Publisher
Architect_ID

I would really appreciate some help and suggestions on creating the relationships.
thanks

View 5 Replies View Related

Table Design

Sep 17, 2007

I create following tables.

employee table
------------------------
EMP_ID varchar
NAME varchar
DEPARTMENT_CODEint
POSITION_CODEint
COUNTRY_CODEint


department table
------------------
DEPARTMENT_CODEint
DEPARTMENT_NAMEvarchar

position table
---------------
POSITION_CODEint
POSITION_NAMEvarchar

country table
-------------
COUNTRY_CODEint
COUNTRY_NAMEvarchar


In employee table I have to store two country names.
ie. employee currently working in this country
but his home country name (origin country) is another
name. In country table all countries information available.
ie. country_code and country_name.

How I can design the employee table that it get country_name from COUNTRY TABLE ?
but we can not use same country_code in two fields.

OR
otherwise I will have to create employee table like this

employee table
------------------------
EMP_ID varchar
NAME varchar
DEPARTMENT_CODEint
POSITION_CODEint
COUNTRY_CODEint
COUNTRY_NAMEvarchar

ie. during data entries direct insert the country_name in employee
table ?

I want to create separate table for separate data.
department,postion,country.

How I can use unique country_code in employee table's two
fields ?

regards
Martin

View 2 Replies View Related

Best Table Design

Nov 8, 2007

Hi,

I'm struggling coming up with an optimal table design for the following scenario.

I have a table in which each row is recording information about a document - author, publisher, publication, title, abstract and so forth. I also have an image table which contains information about the images which can be associated with the documents.

Each document can have on of three image types associated with it - an author photo, a publisher logo and a publication logo. There aren't actually that many different authors, publishers and publications in the database so it would be common for many documents to have the same author or the same publisher although authors sometimes write for different publications. In the current setup it's possible for a document to have more than one image of each type associated with it, which is undesirable - this needs to eliminated and we need to ensure that each document can only have one image of each type associated with it.

It'd also be a huge boon if I could get all the information about a document and it's attached images with a single database call. In the current setup, trying to do this returns multiple rows so I've ended up making two calls, one for the document and one for it's attached images.

I can see two possible ways of setting this up, neither of which appeal.

The first is to add three columns to my document table to record the image URLs which is simple but inflexible should I want to add more image types later on.

The second is to set up three new tables for author, publisher and publication and associate each of these with the document table through a key and then to the image table through another key. There's also an image type table which is going to come in to play. I'm unwilling to do this because it's going to just explode the number of tables I've got, especially if we add more image types, and play havoc with my XML schemas.

Is there another way of rationalizing this that I've missed?

Cheers,
Matt

View 3 Replies View Related

Table Design

Jan 11, 2007

Hi,

I am trying to decide between 2 table designs. I basically have several different types of work items that need to be tracked. Each work item has their own set of statuses, some of which may be the same as other work item's statuses, some of which will be unique for that work item.

Now, should I create one status table for each work item, or would it be better to use one status table, but add a column to track which work item the status belongs to?

I'm not sure which is a better design, or perhaps there is some alternate design that is better. Any help is appreciated.

Thx.

View 1 Replies View Related

Design Table Need Help

Sep 20, 2007

Currently I need to design database table and got stuck.

I have a project and its sub projects. A parent project and its sub projects share the same requirement.The description of the requirement will be changed every day.
For example
Project A - Do Some thing 1 on Project A [09/28/2007]
Project A-A1 - Do Some thing 1 on Project A [09/28/2007] , Do Some thing 2 on Project A [09/29/2007]

Every time the comments updated, both project A and project A-A1 should share the same update i.e select project A and its subproject will be displayed
Project A Do Some thing 1 on Project A [09/28/2007] , Do Some thing 2 on Project A [09/29/2007]
Project A-A1 Do Some thing 1 on Project A [09/28/2007] , Do Some thing 2 on Project A [09/29//2007]

When you tried to insert new sub project, the requirement will be shared with the parent project ie.
Project A - Do Some thing 1 on Project A [09/28/2007]
Project A-A1 - Do Some thing 1 on Project A [09/28/2007] , Do Some thing 2 on Project A [09/29/2007]
Project A-A2 - Do Some thing 1 on Project A [09/28/2007] , Do Some thing 2 on Project A [09/29/2007] , Do Some thing 2 on Project A-A2 [09/30/2007]

assume Project A-A1 and Project A-A2 are sub project of project A

Could anyone show me how to design the database table for those mess?

Thank you

View 6 Replies View Related

Table Design

Jan 3, 2008

Hi All,

If I have the following data that I need to put in a lookup table, what would be considered the proper create table schema for it?

G, "Group"
R, "Region"
D, "District"

Would you setup your table like this:

Level_ID Varchar(1),
Level_Desc Varchar(20)

Or would you go ahead and create like this

Level_ID Integer,
Level_Code Varchar(1),
Level_Desc Varchar(20)

Not sure which one would be the preferred method.

Thanks,

JJ

View 5 Replies View Related

Table Design

Dec 17, 2007

I have a huge database and off lately, I have been experiencing some performance issues on some queries. Some of my tables now have over 10 million records. I noticed the performance issue was caused mainly from one table created as a work around. If I remove the column from the workaround table (but still leave the table in the query), I get the results in 1 second. However if I include a column from the workaround table, the same query takes 14 seconds (same output only an extra column) . I will appreciate any advise on a better design to get around my workaround table.


Below is my scenario

Table - Team
-------------------
Column -
TeamID (Primary Key)
TeamName

Table - Matches
---------------------------
Columns -
MatchID (Primary Key)
MatchName
Team1ID (Foreign to "TeamID" in Table "Team")
Team2ID (Foreign to "TeamID" in Table "Team")

Table - Players
----------------------
Columns -
PlayerID (Primary)
TeamID (Foreign to "TeamID" in Table "Team")
PlayerName


The above tables work very well... The tables I listed below are my cause of issue... I need to write a query to list every match with the names of players who played in it comma delimited (one row per match).

I created a table

Table - MatchPlayer
-----------------------------
Columns -
MatchPlayerID (Primary)
MatchID (Foreign to "MatchD" in Table "Match")
PlayerID (Foreign to "PlayerD" in Table "Player")


But I couldnt write a query that would list me all the players comma delimited in one row per match..

So I put a workaround

Table - MatchPlayer1
-----------------------------
Columns -
MatchPlayerID (Primary)
MatchID (Foreign to "MatchD" in Table "Match")
Team1PlayerNames (Comma Delimited values - varchar(800))
Team2PlayerNames (Comma Delimited values - varchar(800))


This allows me to easily list the player names comma delimited per match but is a very bad design. Is it possible to list the same using the table Match Player.

Thanks in advance

View 5 Replies View Related

SQL Table Design

Jan 3, 2007

hi there,im new to sql server 2005 and this forum

need help here pertaining to the database table definitions

all was well when i started using it a month or 2 ago until now that when i tried to redesign my tables,it wouldnt prompt me to choose a primary key for my table

previously what happened was that when i saved the table without selecting an attribute as a primary key,it would prompt me to do so nu could choose to have the primary key auto-generated

but now it seems it stopped prompting me about it

whats wrong with it?anyone else faced this?

pardon my question,im a noob at this sql server thingie

thanx in advance!

View 12 Replies View Related

Table Design Of User Table.

Jun 23, 2006

We are in the early stages of developing a small project and I have a question I would like an opinion on.
When deciding how to design a table to store information on users who will be different types.
The project involves setting up webpage that allow " appointment setters" to book demos for our Sales reps. We want to keep track of how many each appointment setter books.
I  have a user table with user_id, fname,lname, type. Where type represents the type of users they will be either "appointment setter" or "Sales Rep".
In the Appointment table I would like to store the Appoinment setter ID, sales rep Id, date/time appointment was booked and some other data on the appointment.
My question is how do I set up the relationship from  the appointment table back to the user table.
Since each record in the appointment table will have a App Setter ID and a Sales Rep ID.
Should I just pick either the app setter id or the sales rep id as the foreign key back to the userID in the user table. Or is there another method how to handle this.
Any thoughts or articles would be greatly appreciated.
thanks,

View 1 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved