SQL Clone
SQLServerCentral is supported by Redgate
 
Log in  ::  Register  ::  Not logged in
 
 
 


Relationships -_- Completely need help


Relationships -_- Completely need help

Author
Message
SomeDude123
SomeDude123
Forum Newbie
Forum Newbie (5 reputation)Forum Newbie (5 reputation)Forum Newbie (5 reputation)Forum Newbie (5 reputation)Forum Newbie (5 reputation)Forum Newbie (5 reputation)Forum Newbie (5 reputation)Forum Newbie (5 reputation)

Group: General Forum Members
Points: 5 Visits: 290
So i have a project for school that i need to make an SQL server. I created the note pad file for all the tables and i think i have all the keys i need but i can't figure out how i am supposed to build the relationships. Supposedly you can use the same PK for two tables but i thought that wasn't possible so i am really confused from top to bottom. So the project I have to take someone's DB design from visio and create it in SQL server 2008 from the virtual thing at school. I provided a link to my Dropbox folder with all the files. I really appreciate any help i can get.

https://www.dropbox.com/sh/y7t21cjav5wx6o7/Vfos1JHHxi

Thanks HF
pietlinden
pietlinden
SSCertifiable
SSCertifiable (6.9K reputation)SSCertifiable (6.9K reputation)SSCertifiable (6.9K reputation)SSCertifiable (6.9K reputation)SSCertifiable (6.9K reputation)SSCertifiable (6.9K reputation)SSCertifiable (6.9K reputation)SSCertifiable (6.9K reputation)

Group: General Forum Members
Points: 6921 Visits: 13465
Can you post a really brief description of what you're modeling and your table definitions on the part you're having trouble with? (start with only maybe two or three tables). Once you get the hang of it, it gets a lot easier.
SomeDude123
SomeDude123
Forum Newbie
Forum Newbie (5 reputation)Forum Newbie (5 reputation)Forum Newbie (5 reputation)Forum Newbie (5 reputation)Forum Newbie (5 reputation)Forum Newbie (5 reputation)Forum Newbie (5 reputation)Forum Newbie (5 reputation)

Group: General Forum Members
Points: 5 Visits: 290
Will you be on in 2-3 hours? I finally found someone at my school to help me so i might know what i am doing. In 2 to 3 hours i should have it done and it would be cool if you could just double check it to see if it was completed right. If the relationships are not 100% right it will take my grade from a C-D or if it is 100% right from a C-B so it is a huge turning point if i can get this right for tomorrow!
pietlinden
pietlinden
SSCertifiable
SSCertifiable (6.9K reputation)SSCertifiable (6.9K reputation)SSCertifiable (6.9K reputation)SSCertifiable (6.9K reputation)SSCertifiable (6.9K reputation)SSCertifiable (6.9K reputation)SSCertifiable (6.9K reputation)SSCertifiable (6.9K reputation)

Group: General Forum Members
Points: 6921 Visits: 13465
seeing that it will be around 1 AM, probably not. But if you post a simple description of what you're modeling and then your model (create table scripts with the foreign keys in there), someone can help you.

Can you post a really simple description of what you're modeling? Start with two tables (parent and child) and work your way out. If you try doing everything at once, you're going to get really confused. (Been there, done that!) If you think you have it down, then add a few records to the two tables and see if you get the right answers from your query. (Add only enough records to verify your design is right - you can delete the records later.)

Hope that helps.
SomeDude123
SomeDude123
Forum Newbie
Forum Newbie (5 reputation)Forum Newbie (5 reputation)Forum Newbie (5 reputation)Forum Newbie (5 reputation)Forum Newbie (5 reputation)Forum Newbie (5 reputation)Forum Newbie (5 reputation)Forum Newbie (5 reputation)

Group: General Forum Members
Points: 5 Visits: 290
YES!!!!!!! I figured it out and it loaded! Could you please look over it and see if everything is right....it loaded correctly but who knows.


Now for this I am curious if this is accurate.
Also are these two queries right? The answers are made up as an example of what SHOULD pop up.

"SELECT Employees.EmployeeID, Employees.Department, Location.City
FROM EMPLOYEES
INNER JOIN Location
ON
Employees.LocID = Location.LocID
Where Employees.Department = "Nurse" and Location.City = "DeKab";


1000 Nurse DeKalb




SELECT PatientRecords.PatientID, PatientRecords.FirstName, PatientRecords.LastName, PatientRecords.DateofBirthBirthday
FROM PatientRecords
WHERE PatientRecords.Firstname = "Kevin";


5 Kevin Smith 06271990


SELECT PatientRecords.PatientID, PatientRecords.FirstName, PatientRecords.LastName, PatientRecords.DateofBirthBirthday
FROM PatientRecords
WHERE PatientRecords.Enthicity = "White" and PatientRecords.City = "Chicago";


5 Kevin Smith 06271990
6 Bob Donald 08121983"
Attachments
HF database.txt (39 views, 5.00 KB)
Sean Lange
Sean Lange
SSC-Dedicated
SSC-Dedicated (33K reputation)SSC-Dedicated (33K reputation)SSC-Dedicated (33K reputation)SSC-Dedicated (33K reputation)SSC-Dedicated (33K reputation)SSC-Dedicated (33K reputation)SSC-Dedicated (33K reputation)SSC-Dedicated (33K reputation)

Group: General Forum Members
Points: 33148 Visits: 17669
Without going into great detail you need to use the datetime datatype for dates. Using numeric(8) for dates is going to be a serious pain to deal with. I realize this is school work but DO NOT use anything other datetime for datetime data.

I would also suggest that using char for columns like Name is not the best choice. You should use varchar instead. There is no need to store a bunch of spaces. You will just have to trim the spaces every time you pull the data back out.

Proper datatype usage is critical to implementing a good database in the real world. Sadly, many people don't seem to understand that.

I suspect your professor will ask you why you have a unique constraint on FirstName, LastName. That prevents you from having more than 1 patient with the same name. Also, it prevents you from having the same contact for more than 1 patient. w00t

Some other questions, why do you have City, State, Zip in the employees table and the same columns in the Locations table? Shouldn't you have a Departments table instead of the department name in the Employees table?

Payments, shouldn't that be payments made against a Bill? You should not store the AmountBilled in the payments table. What happens if the AmountBilled needs to be changed? You have no solid way of updating however many payment rows there are.

Rooms should be a table. Then you would have a table for PatientRooms which would contain the PatientID, the RoomID and maybe Admission and Discharge dates.

To be fair, this looks like a very complicated project for a college student to put together. I don't know the actual assignment but hospital systems are incredibly complicated.

_______________________________________________________________

Need help? Help us help you.

Read the article at http://www.sqlservercentral.com/articles/Best+Practices/61537/ for best practices on asking questions.

Need to split a string? Try Jeff Modens splitter.

Cross Tabs and Pivots, Part 1 – Converting Rows to Columns
Cross Tabs and Pivots, Part 2 - Dynamic Cross Tabs
Understanding and Using APPLY (Part 1)
Understanding and Using APPLY (Part 2)
SomeDude123
SomeDude123
Forum Newbie
Forum Newbie (5 reputation)Forum Newbie (5 reputation)Forum Newbie (5 reputation)Forum Newbie (5 reputation)Forum Newbie (5 reputation)Forum Newbie (5 reputation)Forum Newbie (5 reputation)Forum Newbie (5 reputation)

Group: General Forum Members
Points: 5 Visits: 290
ok here is the most updated one. and yea the dates are killing me. How would i do this date time thing? This should be a lot more updated. It loads and everything but when i insert my date i get the obvious date check issue and patient foreign key issue out the butt.

Also the reason why i used a lot of what i did was because i followed this one that was provided for my class....and yes this class is absurb. If you have 90%+ right the teacher gives you 50% #$^#$&#$& One missing relationship is like 25-50% off -_- I also attached the example files

Also the reason why it is like it is because the requirements were to make any type of database that would have 7-10 relationships, 7-10 tables, 16 records, 8 queries with 4 compound. This is like a semester long project.

So from what the directions are for the project you are looking too deep into it. We simply need to have it relate for the most part, be able to input data, and query it. It doesn't have to update perfectly and be 100% linked and stuff liek your saying but yea this project is a bit extreme

Lastly, i have been getting help from like 2 class mates so who knows if they know what they are doing -_- At least half the class is lost as can be.

"
(1 row(s) affected)

(1 row(s) affected)

(1 row(s) affected)

(1 row(s) affected)

(1 row(s) affected)

(1 row(s) affected)

(1 row(s) affected)

(1 row(s) affected)

(1 row(s) affected)

(1 row(s) affected)

(1 row(s) affected)

(1 row(s) affected)

(1 row(s) affected)

(1 row(s) affected)

(1 row(s) affected)

(1 row(s) affected)
Msg 547, Level 16, State 0, Line 134
The INSERT statement conflicted with the CHECK constraint "ValidHireDate". The conflict occurred in database "Z1725527", table "NIUNT\Z1725527.Employees", column 'HireDate'.
The statement has been terminated.
Msg 547, Level 16, State 0, Line 141
The INSERT statement conflicted with the CHECK constraint "ValidHireDate". The conflict occurred in database "Z1725527", table "NIUNT\Z1725527.Employees", column 'HireDate'.
The statement has been terminated.

(1 row(s) affected)

(1 row(s) affected)
Msg 547, Level 16, State 0, Line 162
The INSERT statement conflicted with the CHECK constraint "ValidHireDate". The conflict occurred in database "Z1725527", table "NIUNT\Z1725527.Employees", column 'HireDate'.
The statement has been terminated.
Msg 547, Level 16, State 0, Line 169
The INSERT statement conflicted with the CHECK constraint "ValidHireDate". The conflict occurred in database "Z1725527", table "NIUNT\Z1725527.Employees", column 'HireDate'.
The statement has been terminated.
Msg 547, Level 16, State 0, Line 176
The INSERT statement conflicted with the CHECK constraint "ValidHireDate". The conflict occurred in database "Z1725527", table "NIUNT\Z1725527.Employees", column 'HireDate'.
The statement has been terminated.
Msg 547, Level 16, State 0, Line 183
The INSERT statement conflicted with the CHECK constraint "ValidHireDate". The conflict occurred in database "Z1725527", table "NIUNT\Z1725527.Employees", column 'HireDate'.
The statement has been terminated.
Msg 547, Level 16, State 0, Line 190
The INSERT statement conflicted with the CHECK constraint "ValidHireDate". The conflict occurred in database "Z1725527", table "NIUNT\Z1725527.Employees", column 'HireDate'.
The statement has been terminated.

(1 row(s) affected)
Msg 547, Level 16, State 0, Line 204
The INSERT statement conflicted with the CHECK constraint "ValidHireDate". The conflict occurred in database "Z1725527", table "NIUNT\Z1725527.Employees", column 'HireDate'.
The statement has been terminated.
Msg 547, Level 16, State 0, Line 211
The INSERT statement conflicted with the CHECK constraint "ValidHireDate". The conflict occurred in database "Z1725527", table "NIUNT\Z1725527.Employees", column 'HireDate'.
The statement has been terminated.
Msg 547, Level 16, State 0, Line 218
The INSERT statement conflicted with the CHECK constraint "ValidHireDate". The conflict occurred in database "Z1725527", table "NIUNT\Z1725527.Employees", column 'HireDate'.
The statement has been terminated.
Msg 547, Level 16, State 0, Line 225
The INSERT statement conflicted with the CHECK constraint "ValidHireDate". The conflict occurred in database "Z1725527", table "NIUNT\Z1725527.Employees", column 'HireDate'.
The statement has been terminated.
Msg 547, Level 16, State 0, Line 232
The INSERT statement conflicted with the CHECK constraint "ValidHireDate". The conflict occurred in database "Z1725527", table "NIUNT\Z1725527.Employees", column 'HireDate'.
The statement has been terminated.
Msg 547, Level 16, State 0, Line 239
The INSERT statement conflicted with the CHECK constraint "ValidHireDate". The conflict occurred in database "Z1725527", table "NIUNT\Z1725527.Employees", column 'HireDate'.
The statement has been terminated.
Msg 547, Level 16, State 0, Line 261
The INSERT statement conflicted with the CHECK constraint "ValidDateOfBirth". The conflict occurred in database "Z1725527", table "NIUNT\Z1725527.PATIENTRECORDS", column 'DateOfBirth'.
The statement has been terminated.

(1 row(s) affected)
Msg 547, Level 16, State 0, Line 269
The INSERT statement conflicted with the CHECK constraint "ValidDateOfBirth". The conflict occurred in database "Z1725527", table "NIUNT\Z1725527.PATIENTRECORDS", column 'DateOfBirth'.
The statement has been terminated.
Msg 547, Level 16, State 0, Line 273
The INSERT statement conflicted with the CHECK constraint "ValidDateOfBirth". The conflict occurred in database "Z1725527", table "NIUNT\Z1725527.PATIENTRECORDS", column 'DateOfBirth'.
The statement has been terminated.
Msg 547, Level 16, State 0, Line 277
The INSERT statement conflicted with the CHECK constraint "ValidDateOfBirth". The conflict occurred in database "Z1725527", table "NIUNT\Z1725527.PATIENTRECORDS", column 'DateOfBirth'.
The statement has been terminated.
Msg 547, Level 16, State 0, Line 281
The INSERT statement conflicted with the CHECK constraint "ValidDateOfBirth". The conflict occurred in database "Z1725527", table "NIUNT\Z1725527.PATIENTRECORDS", column 'DateOfBirth'.
The statement has been terminated.

(1 row(s) affected)

(1 row(s) affected)
Msg 547, Level 16, State 0, Line 293
The INSERT statement conflicted with the CHECK constraint "ValidDateOfBirth". The conflict occurred in database "Z1725527", table "NIUNT\Z1725527.PATIENTRECORDS", column 'DateOfBirth'.
The statement has been terminated.

(1 row(s) affected)

(1 row(s) affected)
Msg 547, Level 16, State 0, Line 305
The INSERT statement conflicted with the CHECK constraint "ValidDateOfBirth". The conflict occurred in database "Z1725527", table "NIUNT\Z1725527.PATIENTRECORDS", column 'DateOfBirth'.
The statement has been terminated.
Msg 547, Level 16, State 0, Line 309
The INSERT statement conflicted with the CHECK constraint "ValidDateOfBirth". The conflict occurred in database "Z1725527", table "NIUNT\Z1725527.PATIENTRECORDS", column 'DateOfBirth'.
The statement has been terminated.
Msg 547, Level 16, State 0, Line 313
The INSERT statement conflicted with the CHECK constraint "ValidDateOfBirth". The conflict occurred in database "Z1725527", table "NIUNT\Z1725527.PATIENTRECORDS", column 'DateOfBirth'.
The statement has been terminated.
Msg 547, Level 16, State 0, Line 317
The INSERT statement conflicted with the CHECK constraint "ValidDateOfBirth". The conflict occurred in database "Z1725527", table "NIUNT\Z1725527.PATIENTRECORDS", column 'DateOfBirth'.
The statement has been terminated.

(1 row(s) affected)
Msg 547, Level 16, State 0, Line 338
The INSERT statement conflicted with the FOREIGN KEY constraint "PatientIDFK1". The conflict occurred in database "Z1725527", table "NIUNT\Z1725527.PATIENTRECORDS", column 'PatientID'.
The statement has been terminated.

(1 row(s) affected)
Msg 547, Level 16, State 0, Line 348
The INSERT statement conflicted with the FOREIGN KEY constraint "PatientIDFK1". The conflict occurred in database "Z1725527", table "NIUNT\Z1725527.PATIENTRECORDS", column 'PatientID'.
The statement has been terminated.
Msg 547, Level 16, State 0, Line 353
The INSERT statement conflicted with the FOREIGN KEY constraint "PatientIDFK1". The conflict occurred in database "Z1725527", table "NIUNT\Z1725527.PATIENTRECORDS", column 'PatientID'.
The statement has been terminated.
Msg 547, Level 16, State 0, Line 358
The INSERT statement conflicted with the FOREIGN KEY constraint "PatientIDFK1". The conflict occurred in database "Z1725527", table "NIUNT\Z1725527.PATIENTRECORDS", column 'PatientID'.
The statement has been terminated.
Msg 547, Level 16, State 0, Line 363
The INSERT statement conflicted with the FOREIGN KEY constraint "PatientIDFK1". The conflict occurred in database "Z1725527", table "NIUNT\Z1725527.PATIENTRECORDS", column 'PatientID'.
The statement has been terminated.

(1 row(s) affected)

(1 row(s) affected)
Msg 547, Level 16, State 0, Line 378
The INSERT statement conflicted with the FOREIGN KEY constraint "PatientIDFK1". The conflict occurred in database "Z1725527", table "NIUNT\Z1725527.PATIENTRECORDS", column 'PatientID'.
The statement has been terminated.

(1 row(s) affected)

(1 row(s) affected)
Msg 547, Level 16, State 0, Line 393
The INSERT statement conflicted with the FOREIGN KEY constraint "PatientIDFK1". The conflict occurred in database "Z1725527", table "NIUNT\Z1725527.PATIENTRECORDS", column 'PatientID'.
The statement has been terminated.
Msg 547, Level 16, State 0, Line 398
The INSERT statement conflicted with the FOREIGN KEY constraint "PatientIDFK1". The conflict occurred in database "Z1725527", table "NIUNT\Z1725527.PATIENTRECORDS", column 'PatientID'.
The statement has been terminated.
Msg 547, Level 16, State 0, Line 403
The INSERT statement conflicted with the FOREIGN KEY constraint "PatientIDFK1". The conflict occurred in database "Z1725527", table "NIUNT\Z1725527.PATIENTRECORDS", column 'PatientID'.
The statement has been terminated.
Msg 547, Level 16, State 0, Line 408
The INSERT statement conflicted with the FOREIGN KEY constraint "PatientIDFK1". The conflict occurred in database "Z1725527", table "NIUNT\Z1725527.PATIENTRECORDS", column 'PatientID'.
The statement has been terminated.

(1 row(s) affected)
Msg 547, Level 16, State 0, Line 430
The INSERT statement conflicted with the FOREIGN KEY constraint "PatientIDFK2". The conflict occurred in database "Z1725527", table "NIUNT\Z1725527.PATIENTRECORDS", column 'PatientID'.
The statement has been terminated.

(1 row(s) affected)
Msg 547, Level 16, State 0, Line 440
The INSERT statement conflicted with the FOREIGN KEY constraint "PatientIDFK2". The conflict occurred in database "Z1725527", table "NIUNT\Z1725527.PATIENTRECORDS", column 'PatientID'.
The statement has been terminated.
Msg 547, Level 16, State 0, Line 445
The INSERT statement conflicted with the FOREIGN KEY constraint "PatientIDFK2". The conflict occurred in database "Z1725527", table "NIUNT\Z1725527.PATIENTRECORDS", column 'PatientID'.
The statement has been terminated.
Msg 547, Level 16, State 0, Line 450
The INSERT statement conflicted with the FOREIGN KEY constraint "PatientIDFK2". The conflict occurred in database "Z1725527", table "NIUNT\Z1725527.PATIENTRECORDS", column 'PatientID'.
The statement has been terminated.
Msg 547, Level 16, State 0, Line 455
The INSERT statement conflicted with the FOREIGN KEY constraint "PatientIDFK2". The conflict occurred in database "Z1725527", table "NIUNT\Z1725527.PATIENTRECORDS", column 'PatientID'.
The statement has been terminated.

(1 row(s) affected)

(1 row(s) affected)
Msg 547, Level 16, State 0, Line 470
The INSERT statement conflicted with the FOREIGN KEY constraint "PatientIDFK2". The conflict occurred in database "Z1725527", table "NIUNT\Z1725527.PATIENTRECORDS", column 'PatientID'.
The statement has been terminated.

(1 row(s) affected)

(1 row(s) affected)
Msg 547, Level 16, State 0, Line 485
The INSERT statement conflicted with the FOREIGN KEY constraint "PatientIDFK2". The conflict occurred in database "Z1725527", table "NIUNT\Z1725527.PATIENTRECORDS", column 'PatientID'.
The statement has been terminated.
Msg 547, Level 16, State 0, Line 490
The INSERT statement conflicted with the FOREIGN KEY constraint "PatientIDFK2". The conflict occurred in database "Z1725527", table "NIUNT\Z1725527.PATIENTRECORDS", column 'PatientID'.
The statement has been terminated.
Msg 547, Level 16, State 0, Line 495
The INSERT statement conflicted with the FOREIGN KEY constraint "PatientIDFK2". The conflict occurred in database "Z1725527", table "NIUNT\Z1725527.PATIENTRECORDS", column 'PatientID'.
The statement has been terminated.
Msg 547, Level 16, State 0, Line 500
The INSERT statement conflicted with the FOREIGN KEY constraint "PatientIDFK2". The conflict occurred in database "Z1725527", table "NIUNT\Z1725527.PATIENTRECORDS", column 'PatientID'.
The statement has been terminated.

(1 row(s) affected)
Msg 547, Level 16, State 0, Line 524
The INSERT statement conflicted with the FOREIGN KEY constraint "PatientIDFK3". The conflict occurred in database "Z1725527", table "NIUNT\Z1725527.PATIENTRECORDS", column 'PatientID'.
The statement has been terminated.

(1 row(s) affected)
Msg 547, Level 16, State 0, Line 534
The INSERT statement conflicted with the FOREIGN KEY constraint "PatientIDFK3". The conflict occurred in database "Z1725527", table "NIUNT\Z1725527.PATIENTRECORDS", column 'PatientID'.
The statement has been terminated.
Msg 547, Level 16, State 0, Line 539
The INSERT statement conflicted with the FOREIGN KEY constraint "PatientIDFK3". The conflict occurred in database "Z1725527", table "NIUNT\Z1725527.PATIENTRECORDS", column 'PatientID'.
The statement has been terminated.
Msg 547, Level 16, State 0, Line 544
The INSERT statement conflicted with the FOREIGN KEY constraint "PatientIDFK3". The conflict occurred in database "Z1725527", table "NIUNT\Z1725527.PATIENTRECORDS", column 'PatientID'.
The statement has been terminated.
Msg 547, Level 16, State 0, Line 549
The INSERT statement conflicted with the FOREIGN KEY constraint "PatientIDFK3". The conflict occurred in database "Z1725527", table "NIUNT\Z1725527.PATIENTRECORDS", column 'PatientID'.
The statement has been terminated.

(1 row(s) affected)

(1 row(s) affected)
Msg 547, Level 16, State 0, Line 564
The INSERT statement conflicted with the FOREIGN KEY constraint "PatientIDFK3". The conflict occurred in database "Z1725527", table "NIUNT\Z1725527.PATIENTRECORDS", column 'PatientID'.
The statement has been terminated.

(1 row(s) affected)

(1 row(s) affected)
Msg 547, Level 16, State 0, Line 579
The INSERT statement conflicted with the FOREIGN KEY constraint "PatientIDFK3". The conflict occurred in database "Z1725527", table "NIUNT\Z1725527.PATIENTRECORDS", column 'PatientID'.
The statement has been terminated.
Msg 547, Level 16, State 0, Line 584
The INSERT statement conflicted with the FOREIGN KEY constraint "PatientIDFK3". The conflict occurred in database "Z1725527", table "NIUNT\Z1725527.PATIENTRECORDS", column 'PatientID'.
The statement has been terminated.
Msg 547, Level 16, State 0, Line 589
The INSERT statement conflicted with the FOREIGN KEY constraint "PatientIDFK3". The conflict occurred in database "Z1725527", table "NIUNT\Z1725527.PATIENTRECORDS", column 'PatientID'.
The statement has been terminated.
Msg 547, Level 16, State 0, Line 594
The INSERT statement conflicted with the FOREIGN KEY constraint "PatientIDFK3". The conflict occurred in database "Z1725527", table "NIUNT\Z1725527.PATIENTRECORDS", column 'PatientID'.
The statement has been terminated.

(1 row(s) affected)
Msg 547, Level 16, State 0, Line 620
The INSERT statement conflicted with the CHECK constraint "ValidAdmissionDate". The conflict occurred in database "Z1725527", table "NIUNT\Z1725527.PATIENTROOM", column 'AdmissionDate'.
The statement has been terminated.
Msg 547, Level 16, State 0, Line 625
The INSERT statement conflicted with the CHECK constraint "ValidAdmissionDate". The conflict occurred in database "Z1725527", table "NIUNT\Z1725527.PATIENTROOM", column 'AdmissionDate'.
The statement has been terminated.
Msg 547, Level 16, State 0, Line 630
The INSERT statement conflicted with the CHECK constraint "ValidAdmissionDate". The conflict occurred in database "Z1725527", table "NIUNT\Z1725527.PATIENTROOM", column 'AdmissionDate'.
The statement has been terminated.
Msg 547, Level 16, State 0, Line 635
The INSERT statement conflicted with the CHECK constraint "ValidAdmissionDate". The conflict occurred in database "Z1725527", table "NIUNT\Z1725527.PATIENTROOM", column 'AdmissionDate'.
The statement has been terminated.
Msg 547, Level 16, State 0, Line 640
The INSERT statement conflicted with the CHECK constraint "ValidAdmissionDate". The conflict occurred in database "Z1725527", table "NIUNT\Z1725527.PATIENTROOM", column 'AdmissionDate'.
The statement has been terminated.
Msg 547, Level 16, State 0, Line 645
The INSERT statement conflicted with the CHECK constraint "ValidAdmissionDate". The conflict occurred in database "Z1725527", table "NIUNT\Z1725527.PATIENTROOM", column 'AdmissionDate'.
The statement has been terminated.
Msg 547, Level 16, State 0, Line 650
The INSERT statement conflicted with the CHECK constraint "ValidAdmissionDate". The conflict occurred in database "Z1725527", table "NIUNT\Z1725527.PATIENTROOM", column 'AdmissionDate'.
The statement has been terminated.
Msg 547, Level 16, State 0, Line 655
The INSERT statement conflicted with the CHECK constraint "ValidAdmissionDate". The conflict occurred in database "Z1725527", table "NIUNT\Z1725527.PATIENTROOM", column 'AdmissionDate'.
The statement has been terminated.
Msg 547, Level 16, State 0, Line 660
The INSERT statement conflicted with the CHECK constraint "ValidAdmissionDate". The conflict occurred in database "Z1725527", table "NIUNT\Z1725527.PATIENTROOM", column 'AdmissionDate'.
The statement has been terminated.
Msg 547, Level 16, State 0, Line 665
The INSERT statement conflicted with the CHECK constraint "ValidAdmissionDate". The conflict occurred in database "Z1725527", table "NIUNT\Z1725527.PATIENTROOM", column 'AdmissionDate'.
The statement has been terminated.
Msg 547, Level 16, State 0, Line 670
The INSERT statement conflicted with the CHECK constraint "ValidAdmissionDate". The conflict occurred in database "Z1725527", table "NIUNT\Z1725527.PATIENTROOM", column 'AdmissionDate'.
The statement has been terminated.
Msg 547, Level 16, State 0, Line 675
The INSERT statement conflicted with the CHECK constraint "ValidAdmissionDate". The conflict occurred in database "Z1725527", table "NIUNT\Z1725527.PATIENTROOM", column 'AdmissionDate'.
The statement has been terminated.
Msg 547, Level 16, State 0, Line 680
The INSERT statement conflicted with the CHECK constraint "ValidAdmissionDate". The conflict occurred in database "Z1725527", table "NIUNT\Z1725527.PATIENTROOM", column 'AdmissionDate'.
The statement has been terminated.
Msg 547, Level 16, State 0, Line 685
The INSERT statement conflicted with the CHECK constraint "ValidAdmissionDate". The conflict occurred in database "Z1725527", table "NIUNT\Z1725527.PATIENTROOM", column 'AdmissionDate'.
The statement has been terminated.
Msg 547, Level 16, State 0, Line 690
The INSERT statement conflicted with the CHECK constraint "ValidAdmissionDate". The conflict occurred in database "Z1725527", table "NIUNT\Z1725527.PATIENTROOM", column 'AdmissionDate'.
The statement has been terminated.
Msg 547, Level 16, State 0, Line 695
The INSERT statement conflicted with the CHECK constraint "ValidAdmissionDate". The conflict occurred in database "Z1725527", table "NIUNT\Z1725527.PATIENTROOM", column 'AdmissionDate'.
The statement has been terminated.
Msg 547, Level 16, State 0, Line 714
The INSERT statement conflicted with the FOREIGN KEY constraint "PatientIDFK5". The conflict occurred in database "Z1725527", table "NIUNT\Z1725527.PATIENTRECORDS", column 'PatientID'.
The statement has been terminated.

(1 row(s) affected)
Msg 547, Level 16, State 0, Line 724
The INSERT statement conflicted with the FOREIGN KEY constraint "PatientIDFK5". The conflict occurred in database "Z1725527", table "NIUNT\Z1725527.PATIENTRECORDS", column 'PatientID'.
The statement has been terminated.
Msg 547, Level 16, State 0, Line 729
The INSERT statement conflicted with the FOREIGN KEY constraint "PatientIDFK5". The conflict occurred in database "Z1725527", table "NIUNT\Z1725527.PATIENTRECORDS", column 'PatientID'.
The statement has been terminated.
Msg 547, Level 16, State 0, Line 734
The INSERT statement conflicted with the FOREIGN KEY constraint "PatientIDFK5". The conflict occurred in database "Z1725527", table "NIUNT\Z1725527.PATIENTRECORDS", column 'PatientID'.
The statement has been terminated.
Msg 547, Level 16, State 0, Line 739
The INSERT statement conflicted with the FOREIGN KEY constraint "PatientIDFK5". The conflict occurred in database "Z1725527", table "NIUNT\Z1725527.PATIENTRECORDS", column 'PatientID'.
The statement has been terminated.

(1 row(s) affected)

(1 row(s) affected)
Msg 547, Level 16, State 0, Line 754
The INSERT statement conflicted with the FOREIGN KEY constraint "PatientIDFK5". The conflict occurred in database "Z1725527", table "NIUNT\Z1725527.PATIENTRECORDS", column 'PatientID'.
The statement has been terminated.

(1 row(s) affected)

(1 row(s) affected)
Msg 547, Level 16, State 0, Line 769
The INSERT statement conflicted with the FOREIGN KEY constraint "PatientIDFK5". The conflict occurred in database "Z1725527", table "NIUNT\Z1725527.PATIENTRECORDS", column 'PatientID'.
The statement has been terminated.
Msg 547, Level 16, State 0, Line 774
The INSERT statement conflicted with the FOREIGN KEY constraint "PatientIDFK5". The conflict occurred in database "Z1725527", table "NIUNT\Z1725527.PATIENTRECORDS", column 'PatientID'.
The statement has been terminated.
Msg 547, Level 16, State 0, Line 779
The INSERT statement conflicted with the FOREIGN KEY constraint "PatientIDFK5". The conflict occurred in database "Z1725527", table "NIUNT\Z1725527.PATIENTRECORDS", column 'PatientID'.
The statement has been terminated.
Msg 547, Level 16, State 0, Line 784
The INSERT statement conflicted with the FOREIGN KEY constraint "PatientIDFK5". The conflict occurred in database "Z1725527", table "NIUNT\Z1725527.PATIENTRECORDS", column 'PatientID'.
The statement has been terminated.

(1 row(s) affected)
"
Attachments
HF database.txt (6 views, 4.00 KB)
data insert2.txt (17 views, 31.00 KB)
Sean Lange
Sean Lange
SSC-Dedicated
SSC-Dedicated (33K reputation)SSC-Dedicated (33K reputation)SSC-Dedicated (33K reputation)SSC-Dedicated (33K reputation)SSC-Dedicated (33K reputation)SSC-Dedicated (33K reputation)SSC-Dedicated (33K reputation)SSC-Dedicated (33K reputation)

Group: General Forum Members
Points: 33148 Visits: 17669
utdc1 (4/17/2014)
ok here is the most updated one. and yea the dates are killing me. How would i do this date time thing?



You fix it by using datetime instead of numeric(8).

_______________________________________________________________

Need help? Help us help you.

Read the article at http://www.sqlservercentral.com/articles/Best+Practices/61537/ for best practices on asking questions.

Need to split a string? Try Jeff Modens splitter.

Cross Tabs and Pivots, Part 1 – Converting Rows to Columns
Cross Tabs and Pivots, Part 2 - Dynamic Cross Tabs
Understanding and Using APPLY (Part 1)
Understanding and Using APPLY (Part 2)
SomeDude123
SomeDude123
Forum Newbie
Forum Newbie (5 reputation)Forum Newbie (5 reputation)Forum Newbie (5 reputation)Forum Newbie (5 reputation)Forum Newbie (5 reputation)Forum Newbie (5 reputation)Forum Newbie (5 reputation)Forum Newbie (5 reputation)

Group: General Forum Members
Points: 5 Visits: 290
i don't have to actually fix any values? just the column? The monthdayyear can stay "01312000"

Also what is up with the patient foreign keys...what am i doing wrong? i have no idea. was messing with that for hours with a classmate
Sean Lange
Sean Lange
SSC-Dedicated
SSC-Dedicated (33K reputation)SSC-Dedicated (33K reputation)SSC-Dedicated (33K reputation)SSC-Dedicated (33K reputation)SSC-Dedicated (33K reputation)SSC-Dedicated (33K reputation)SSC-Dedicated (33K reputation)SSC-Dedicated (33K reputation)

Group: General Forum Members
Points: 33148 Visits: 17669
utdc1 (4/17/2014)
i don't have to actually fix any values? just the column? The monthdayyear can stay "01312000"


You would have to add a dateformat to your script for this to work.


SET DATEFORMAT MDY




Also what is up with the patient foreign keys...what am i doing wrong? i have no idea. was messing with that for hours with a classmate


Dunno. I didn't look at all the errors.

_______________________________________________________________

Need help? Help us help you.

Read the article at http://www.sqlservercentral.com/articles/Best+Practices/61537/ for best practices on asking questions.

Need to split a string? Try Jeff Modens splitter.

Cross Tabs and Pivots, Part 1 – Converting Rows to Columns
Cross Tabs and Pivots, Part 2 - Dynamic Cross Tabs
Understanding and Using APPLY (Part 1)
Understanding and Using APPLY (Part 2)
Go


Permissions

You can't post new topics.
You can't post topic replies.
You can't post new polls.
You can't post replies to polls.
You can't edit your own topics.
You can't delete your own topics.
You can't edit other topics.
You can't delete other topics.
You can't edit your own posts.
You can't edit other posts.
You can't delete your own posts.
You can't delete other posts.
You can't post events.
You can't edit your own events.
You can't edit other events.
You can't delete your own events.
You can't delete other events.
You can't send private messages.
You can't send emails.
You can read topics.
You can't vote in polls.
You can't upload attachments.
You can download attachments.
You can't post HTML code.
You can't edit HTML code.
You can't post IFCode.
You can't post JavaScript.
You can post emoticons.
You can't post or upload images.

Select a forum

































































































































































SQLServerCentral


Search