Click here to Skip to main content
15,908,166 members
Home / Discussions / Database
   

Database

 
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 
QuestionNeed Arrange Query result into another table Header Pin
rrrriiizz19-Jul-08 1:45
rrrriiizz19-Jul-08 1:45 
AnswerRe: Need Arrange Query result into another table Header Pin
Ashfield20-Jul-08 8:06
Ashfield20-Jul-08 8:06 
GeneralRe: Need Arrange Query result into another table Header Pin
rrrriiizz20-Jul-08 22:54
rrrriiizz20-Jul-08 22:54 
AnswerRe: Need Arrange Query result into another table Header Pin
Mycroft Holmes20-Jul-08 14:47
professionalMycroft Holmes20-Jul-08 14:47 
GeneralRe: Need Arrange Query result into another table Header Pin
Paul Conrad20-Jul-08 14:55
professionalPaul Conrad20-Jul-08 14:55 
GeneralRe: Need Arrange Query result into another table Header Pin
Mycroft Holmes20-Jul-08 15:08
professionalMycroft Holmes20-Jul-08 15:08 
GeneralRe: Need Arrange Query result into another table Header Pin
rrrriiizz20-Jul-08 22:12
rrrriiizz20-Jul-08 22:12 
GeneralRe: Need Arrange Query result into another table Header Pin
Mycroft Holmes20-Jul-08 22:21
professionalMycroft Holmes20-Jul-08 22:21 
AnswerRe: Need Arrange Query result into another table Header Pin
zahedonline21-Jul-08 2:03
zahedonline21-Jul-08 2:03 
GeneralRe: Need Arrange Query result into another table Header Pin
rrrriiizz21-Jul-08 23:52
rrrriiizz21-Jul-08 23:52 
GeneralRe: Need Arrange Query result into another table Header Pin
zahedonline23-Jul-08 1:42
zahedonline23-Jul-08 1:42 
Questionsetup and deployment sql server 2005 database along with Setup file Pin
vishnukamath19-Jul-08 1:06
vishnukamath19-Jul-08 1:06 
AnswerRe: setup and deployment sql server 2005 database along with Setup file Pin
SimulationofSai19-Jul-08 4:30
SimulationofSai19-Jul-08 4:30 
AnswerRe: setup and deployment sql server 2005 database along with Setup file Pin
zahedonline21-Jul-08 2:07
zahedonline21-Jul-08 2:07 

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.