354 reputation
24
bio website
location United Kingdom
age
visits member for 1 year, 2 months
seen Jun 14 at 16:22
stats profile views 24

Jun
8
answered Why don't databases create their own indexes automatically?
May
31
comment Updating a table with millions of records, its been 4 days
I've done this sort of thing on HES data many times (I'm guessing you're using SUS/HES) and it shouldn't take that long regardless of indexing or the use of left(,3) to join. Your hardware is more than enough for this. @gbn's answer is great, but I can say from experience here that that isn't the cause in this particular instance. Are you sure that table2 actually does hold a single copy of the PbR reference data?
May
30
awarded  Yearling
May
24
comment When to split a large table
If insert performance is not the issue, then you need to define what you mean when you say: Will this improve performance... performance in what context? What kind of operations will you need to do?
May
24
comment Trigger for updating a count of rows from a table into another table
You also need an after update trigger.
May
21
awarded  Constituent
May
21
awarded  Caucus
Apr
26
comment Help with modeling this table
(I still prefer the use of foreign keys for various reasons, including the increasing complexity of the triggers needed for phones which has to decide which table to check on update/insert and the likelihood that someone else adding another parent table may not be aware of the triggers and not update them, allowing inconsistent data for that parent type.)
Apr
26
revised Help with modeling this table
Added foreign keys.
Apr
26
comment Help with modeling this table
It is possible to implement something like that, but you are then not able to use a foreign key from parent id to enforce consistency (as the key would have to point to multiple tables). So, an employee could be deleted leaving behind an invalid reference in the phone number table. I'll amend my answer with foreign keys (I should have done this before really!). I guess you could use triggers to enforce consistency with your model, and since you said you're new to setting up dbs now might be a good time to look into that; just get thinking about consistency enforced at the db layer!
Apr
25
awarded  Editor
Apr
25
revised Header and line item data source mismatch
added 1886 characters in body
Apr
25
answered Help with modeling this table
Apr
25
answered What is the benefit of two FK, when one of them can be deduced from another table?
Apr
25
comment Header and line item data source mismatch
If that's the case @Romoku, then I would agree with going with the two tables. It's definitely not unacceptable once you've explored the other options and found they don't fit.
Apr
25
answered Header and line item data source mismatch
Apr
20
answered Linked Server Risks
Nov
21
comment Does varchar size matter in temporary tables?
Sorry, I realise that my answer is incomplete. What I mean is that I would err on the side of caution (i.e. not making a change which could negatively effect performance) unless that assumption is established to be wrong.
Nov
17
answered Does varchar size matter in temporary tables?
Nov
17
awarded  Supporter