Click here to Skip to main content
15,900,818 members
Home / Discussions / Database
   

Database

 
GeneralRe: Convert Decimal To Date? Pin
obarahmeh21-Jul-08 21:54
obarahmeh21-Jul-08 21:54 
GeneralRe: Convert Decimal To Date? Pin
Mycroft Holmes21-Jul-08 23:52
professionalMycroft Holmes21-Jul-08 23:52 
QuestionFile size Pin
rezarafiee20-Jul-08 19:01
rezarafiee20-Jul-08 19:01 
AnswerRe: File size Pin
Krish - KP20-Jul-08 20:58
Krish - KP20-Jul-08 20:58 
AnswerRe: File size Pin
Ashfield20-Jul-08 21:00
Ashfield20-Jul-08 21:00 
QuestionNortwind database selection through database expert ??? Pin
amistry_petlad20-Jul-08 8:30
amistry_petlad20-Jul-08 8:30 
AnswerRe: Nortwind database selection through database expert ??? Pin
Paul Conrad20-Jul-08 9:51
professionalPaul Conrad20-Jul-08 9:51 
GeneralRe: Nortwind database selection through database expert ??? [modified] Pin
amistry_petlad20-Jul-08 13:06
amistry_petlad20-Jul-08 13:06 
GeneralRe: Nortwind database selection through database expert ??? Pin
Paddy Boyd21-Jul-08 2:30
Paddy Boyd21-Jul-08 2:30 
GeneralRe: Nortwind database selection through database expert ??? Pin
Paul Conrad21-Jul-08 6:13
professionalPaul Conrad21-Jul-08 6:13 
QuestionProblem in a query Pin
Shuaib wasif khan19-Jul-08 23:18
Shuaib wasif khan19-Jul-08 23:18 
AnswerRe: Problem in a query Pin
Colin Angus Mackay20-Jul-08 0:00
Colin Angus Mackay20-Jul-08 0:00 
GeneralRe: Problem in a query Pin
Shuaib wasif khan20-Jul-08 0:54
Shuaib wasif khan20-Jul-08 0:54 
GeneralRe: Problem in a query Pin
Blue_Boy20-Jul-08 2:50
Blue_Boy20-Jul-08 2:50 
GeneralRe: Problem in a query Pin
Shuaib wasif khan20-Jul-08 4:40
Shuaib wasif khan20-Jul-08 4:40 
GeneralRe: Problem in a query Pin
Wendelius20-Jul-08 9:29
mentorWendelius20-Jul-08 9:29 
AnswerRe: Problem in a query Pin
zahedonline21-Jul-08 1:43
zahedonline21-Jul-08 1:43 
Questionloading records problem Pin
harcaype19-Jul-08 16:50
harcaype19-Jul-08 16:50 
AnswerRe: loading records problem Pin
Ashfield20-Jul-08 8:20
Ashfield20-Jul-08 8:20 
QuestionRe: loading records problem Pin
harcaype22-Jul-08 3:28
harcaype22-Jul-08 3:28 
AnswerRe: loading records problem Pin
Ashfield22-Jul-08 8:44
Ashfield22-Jul-08 8:44 
QuestionOne to one Relationship problem Pin
snouto19-Jul-08 6:45
snouto19-Jul-08 6:45 
hello everybody in this forum

i would like to know what is the appropriate solution for the current case in hand

i have two tables one called userinformation and the other called accountinformation

userinformation
================
id int not null primary key ,
firstname varchar(50) not null,
lastname varchar(50) not null,
email varchar(50) not null

accountinformation
===================
id int not null primary key ,
username varchar(50) not null,
password varchar(50) not null



now there is a relationship between the userinformation table and the accountinformation table (one to one) relationship where id in the userinformation refers to the id in the other table (accountinformation) now there are problems when inserting data into both tables like the following

The INSERT statement conflicted with the FOREIGN KEY constraint "LeftHalfHasMatchingRight". The conflict occurred in database "Sandbox", table "dbo.RightHalf", column 'PairID'.
The statement has been terminated.



now i tried to solve this problem by creating a stored procedure and within that stored procedure i created a transaction in it there is two insert statements like the following





<br />
create procedure adduser (@first varchar(50) , @last varchar(50) , @email varchar(50) , @user varchar(50) ,@pass varchar(50))<br />
as<br />
<br />
begin tran<br />
<br />
insert into userinformation (firstname , lastname , email ) values ('bla','bla','bla')<br />
insert into accountinformation (username , password ) values ('bla','bla')<br />
<br />
<br />
commit<br />
Go<br />



it works just fine but if i tried to insert single record in one of the two tables and try to execute this stored procedure with a new different records for these tables it gives me the same error message because there is a record in the userinformation without referential integrity into the other table which is the accountinformation table .

So please tell me how can i solve this current problem in hand


thank you very much

Human knowledge belongs to the world.

AnswerRe: One to one Relationship problem Pin
Wendelius19-Jul-08 8:39
mentorWendelius19-Jul-08 8:39 
AnswerRe: One to one Relationship problem Pin
zahedonline21-Jul-08 1:53
zahedonline21-Jul-08 1:53 
AnswerRe: One to one Relationship problem Pin
nelsonpaixao24-Jul-08 12:28
nelsonpaixao24-Jul-08 12:28 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.