Click here to Skip to main content
15,895,709 members
Home / Discussions / Database
   

Database

 
QuestionSQL2008 installation Pin
Member 45581399-Feb-09 22:53
Member 45581399-Feb-09 22:53 
AnswerRe: SQL2008 installation Pin
Wendelius9-Feb-09 23:19
mentorWendelius9-Feb-09 23:19 
QuestionQuery still returning NOT EQUAL Fields Pin
Sunset Towers9-Feb-09 14:26
Sunset Towers9-Feb-09 14:26 
AnswerRe: Query still returning NOT EQUAL Fields Pin
Wendelius9-Feb-09 18:24
mentorWendelius9-Feb-09 18:24 
GeneralRe: Query still returning NOT EQUAL Fields Pin
Sunset Towers9-Feb-09 18:58
Sunset Towers9-Feb-09 18:58 
GeneralRe: Query still returning NOT EQUAL Fields Pin
Wendelius9-Feb-09 20:13
mentorWendelius9-Feb-09 20:13 
QuestionAllocation! Pin
Learner5209-Feb-09 12:40
Learner5209-Feb-09 12:40 
QuestionSQL Foreign Key Issue Pin
Harvey Saayman9-Feb-09 10:02
Harvey Saayman9-Feb-09 10:02 
Hey guys, this is probably a stupid syntax error but i can seem to see what I'm doing wrong Sigh | :sigh:

USE master
GO

-- Drop the database if it already exists
IF  EXISTS 
(
	SELECT name 
	FROM sys.databases 
	WHERE name = N'RoomsForRentDB'
)
DROP DATABASE RoomsForRentDB
GO

CREATE DATABASE RoomsForRentDB
GO

USE RoomsForRentDB
GO

CREATE TABLE [User]
(
	UserID            BIGINT IDENTITY(0, 1)      NOT NULL,
	EmailAddress      VARCHAR(1000)              NOT NULL,
	[Password]        VARCHAR(1000)              NOT NULL,
	
	CONSTRAINT PK_UserID PRIMARY KEY(UserID)
)

GO

CREATE TABLE House
(
	HouseID           BIGINT IDENTITY(0, 1)      NOT NULL,
	UserID            BIGINT                     REFERENCES [User].UserID NOT NULL,
	
	CONSTRAINT PK_HouseID_UserID PRIMARY KEY(HouseID, UserID)
)

GO


Error

Msg 1767, Level 16, State 0, Line 2
Foreign key 'FK__House__UserID__014935CB' references invalid table 'User.UserID'.
Msg 1750, Level 16, State 0, Line 2
Could not create constraint. See previous errors.


I'm using SQL 2008 if that makes a difference

Thanks

Harvey Saayman - South Africa
Software Developer
.Net, C#, SQL

you.suck = (you.Passion != Programming & you.Occupation == jobTitles.Programmer)
1000100 1101111 1100101 1110011 100000 1110100 1101000 1101001 1110011 100000 1101101 1100101 1100001 1101110 100000 1101001 1101101 100000 1100001 100000 1100111 1100101 1100101 1101011 111111

AnswerRe: SQL Foreign Key Issue Pin
Wendelius9-Feb-09 18:14
mentorWendelius9-Feb-09 18:14 
GeneralRe: SQL Foreign Key Issue Pin
Harvey Saayman9-Feb-09 19:34
Harvey Saayman9-Feb-09 19:34 
GeneralRe: SQL Foreign Key Issue Pin
Wendelius9-Feb-09 20:18
mentorWendelius9-Feb-09 20:18 
GeneralRe: SQL Foreign Key Issue Pin
Harvey Saayman9-Feb-09 20:32
Harvey Saayman9-Feb-09 20:32 
GeneralRe: SQL Foreign Key Issue Pin
Wendelius9-Feb-09 21:31
mentorWendelius9-Feb-09 21:31 
QuestionWhat is the best way to store scripts? Pin
redjoy9-Feb-09 9:32
redjoy9-Feb-09 9:32 
Questionspecial characters in sqlite? Pin
mirko869-Feb-09 8:08
mirko869-Feb-09 8:08 
AnswerRe: special characters in sqlite? Pin
Wendelius9-Feb-09 8:11
mentorWendelius9-Feb-09 8:11 
GeneralRe: special characters in sqlite? Pin
mirko8610-Feb-09 7:11
mirko8610-Feb-09 7:11 
GeneralRe: special characters in sqlite? Pin
Wendelius10-Feb-09 8:15
mentorWendelius10-Feb-09 8:15 
QuestionExecution Order Pin
mehrdadc489-Feb-09 1:17
mehrdadc489-Feb-09 1:17 
AnswerRe: Execution Order Pin
Rupesh Kumar Swami9-Feb-09 1:37
Rupesh Kumar Swami9-Feb-09 1:37 
AnswerRe: Execution Order Pin
Ennis Ray Lynch, Jr.9-Feb-09 7:17
Ennis Ray Lynch, Jr.9-Feb-09 7:17 
AnswerRe: Execution Order Pin
Ashfield10-Feb-09 1:46
Ashfield10-Feb-09 1:46 
QuestionMicrosoft Sql Server Problem Pin
snouto9-Feb-09 0:58
snouto9-Feb-09 0:58 
AnswerRe: Microsoft Sql Server Problem Pin
Ashfield9-Feb-09 1:18
Ashfield9-Feb-09 1:18 
QuestionMulticolumn Listboxes in Ms-ACCESS [modified] Pin
ketan bader9-Feb-09 0:31
ketan bader9-Feb-09 0:31 

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.