364 reputation
26
bio website
location United Kingdom
age
visits member for 2 years
seen Apr 12 at 19:54

Mar
28
awarded  Critic
Mar
26
answered Create Table Script in SQL Server 2008 R2
Mar
15
awarded  Commentator
Mar
15
comment Update Statement takes forever to complete
The answers at the moment are shots on the dark. If you provide the create table script (including indexes etc) you'll get much better answers.
Jan
28
answered Pulling data from identical tables in different databases
Nov
30
comment Broken tempdb location and can't recover
+1 never had to do this but good to know
Sep
16
comment Backup SQL Server with a system backup
+1 for appropriate use of bold text!
Jul
8
answered Combine datetime + string to make a proper datetime
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
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