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 |
AxeSlash
Starting Member
5 Posts |
Posted - 2011-02-02 : 08:16:12
|
Not sure if this post is in the right place, but here goes:OK so I'm in the process of developing an SQL Server (Express) db with a C# winforms front end. I am a complete newbie to SQL Server, and am not that experienced in databases bar some simple hacking around in Access.It's for an audio rental/hire company.I have a couple of questions:1. There is a sort of 'main' database (called "EMS_Main" at the moment) which holds a load of mundane stuff like a list of staff, discount types etc etc, and also some more important stuff like a table with some basic quote details (quote number, status, dates etc). What I'm struggling with is how to store the details of those jobs. Each of these jobs has a 'specification', which in itself will need to be a separate table of data, and then some other tables too (e.g. logistics details, venue details etc).So I end up with this scenario of having a job which is a record in EMS_Main, which needs to have multiple tables attached to it somehow. So what's the best/recommended way to do this? I was toying with the idea of creating a separate database for each job (we quote for ~1500 jobs per year, so that's a lot of databases and tables), and just changing the connection string in the code, but that sounds excessive, possibly a recipe for pain later on, and I don't even know if it's possible (I'm guessing there's an upper limit on number of databases). Is there a nice, easy way to organise this within EMS_Main (can tables be put into folders or classes or something? So I could refer to them like EMS_Main.[folder].[table].[field name]), or am I barking up the wrong tree?2. Equipment clashes. This is where e.g. the office boys are quoting for a job that's 6 months away, then 3 months later they quote for a different job that happens on the same day as the other job. They spec some of the same gear for both jobs, so that we are short on stock that day. I need a way of flagging this up and generating a list of stuff we're short of. Is this possible on a job-by-job basis? I.e. so when they spec the gear for the second job, the frontend will be able to throw some options at them to change one or the other of the specs, or would it have to be done (as they do it at the moment in an Excel/VBA convoluted mess of a system) e.g. a month at a time by a separate process/query altogether (i.e. a guy opens up a form, hits 'go', and is presented with a grid of stock items vs dates with quantities in the cells)?I guess I've jumped in with both feet here. Hoping I can learn to swim in time!Apologies if the post isn't written very well, it's difficult to get this stuff down on paper (screen?) without drawing a diagram...Thanks in advance |
|
denis_the_thief
Aged Yak Warrior
596 Posts |
Posted - 2011-02-02 : 10:08:09
|
quote: So I end up with this scenario of having a job which is a record in EMS_Main, which needs to have multiple tables attached to it somehow. So what's the best/recommended way to do this? I was toying with the idea of creating a separate database for each job (we quote for ~1500 jobs per year, so that's a lot of databases and tables), and just changing the connection string in the code, but that sounds excessive, possibly a recipe for pain later on, and I don't even know if it's possible (I'm guessing there's an upper limit on number of databases). Is there a nice, easy way to organise this within EMS_Main (can tables be put into folders or classes or something? So I could refer to them like EMS_Main.[folder].[table].[field name]), or am I barking up the wrong tree?
I wouldn't say barking up the wrong tree, you just express that differently:select V.FieldNamefrom EMS_Main E, Venues Vwhere E.JobID = 3764 and V.VenueID = E.VenueID Making a separate Database or Table for every job would be like making a separate Class Declaration for every job. |
|
|
AxeSlash
Starting Member
5 Posts |
Posted - 2011-02-02 : 11:58:50
|
I think you're misunderstanding me (I've probably worded my post badly!)I guess what I'm really asking is how best to store the specification for each job without it getting messy.I've done a bit more thinking, and the only way I can see is to create two tables for each job:- Specification- Rest of job info (client details, venue details, payment details, dates etc etc) I'd like the two to stay together in a folder (is that possible?), within a separate area (presumably a separate database) from EMS_Main.So I guess I'd want e.g. EMS_Jobs.[job number].Specification as a table and EMS_Jobs.[job number].Details as a table, where [job number] is like a folder or something?This is the only way I can see to do it at the moment - a) is this possible, and/or b)is there a better way? |
|
|
denis_the_thief
Aged Yak Warrior
596 Posts |
Posted - 2011-02-02 : 13:12:56
|
quote: Originally posted by AxeSlash I think you're misunderstanding me (I've probably worded my post badly!)I guess what I'm really asking is how best to store the specification for each job without it getting messy.I've done a bit more thinking, and the only way I can see is to create two tables for each job:- Specification- Rest of job info (client details, venue details, payment details, dates etc etc) I'd like the two to stay together in a folder (is that possible?), within a separate area (presumably a separate database) from EMS_Main.So I guess I'd want e.g. EMS_Jobs.[job number].Specification as a table and EMS_Jobs.[job number].Details as a table, where [job number] is like a folder or something?This is the only way I can see to do it at the moment - a) is this possible, and/or b)is there a better way?
I can't really say yes or no to your question since we don't use that lingo 'Folder'. It's not that I'm trying to give you a hard time, just that if I think you mean something when you say Folder and it is different than what you are thinking by the term 'Folder' that is not going to help anyone!Here's a few Ideas of Tables:EMSJobs-------EMSJobIDClientIDVenueIDRentalDate (ie venue Date)... (Specification Columns)Clients-------ClientIDClientNameClientAddress...ClientDiscountVenues------VenueIDVenueNameVenueAdress...EquipmentJobRequirements------------------------EquipmentJobRequirementIDEMSJobIDEquipmentIDBookingDateBookedByEmployeeIDEquipments----------EquipmentIDEqupimentName (ie mic, amp...)Quotations----------QuotationIDEMSJobIDQuotedPriceQuoteDateQuotedByEmployeeIDEmployees---------EmployeeIDEmployeeName... |
|
|
AxeSlash
Starting Member
5 Posts |
Posted - 2011-02-03 : 11:05:06
|
Yeah I eventually figured out doing it that way was probably better...I'm just concerned about table size.The average job here has a spec that will be ~150 records. We do about 1500 jobs a year, so that's nearly a quarter of a million records in one table in only a year...I have no idea what is a sensible size for a table before things start to choke up though, do I need to worry about this or is e.g. a million record table nothing to worry about? I'm guessing this question depends on usage and hardware, so:Our server machine ain't great either, it's pretty much a desktop machine with some bells n whistles added. None of this proper 19" rackmount stuff.There will probably only ever be a max of 10 people accessing the server at any one time. Maybe 20 people 10 years from now. 3 or 4 of which will be doing it over a wireless connection (handheld barcode scanner/PDAs), the rest will be on CAT6'd desktops.The desktops will rarely need to query the big table, but the scanners will be doing it on a regular basis (probably averaging once a minute at the mo, but this'll climb in the future).That's about as accurate as I can be with details until the damn thing's up and running.Do I have anything to worry about?Forgot to mention: we regularly do repeat jobs, so archiving old jobs to keep table size isn't really an option. |
|
|
denis_the_thief
Aged Yak Warrior
596 Posts |
Posted - 2011-02-03 : 12:23:03
|
You'll probably be OK with a Million Records. Just need to learn about indexes ahead of time, apologies if you already know about them. |
|
|
|
|
|
|
|