Jump to content

Recommended Posts

Hi

 

"Msg 1769, Level 16, State 1, Line 25

Foreign key 'AsstNo' references invalid column 'AsstNo' in referencing table 'ExpenseItem'."

 

i'm getting this error as i try to execute a bunch of tables into ms sql server. Here are the tables if anyone would be so kind as to have a look;

 

create table ExpenseItem (

EINo integer,

ExpDesc varchar(255) not null,

ExpenseDate datetime default getdate(),

ExpAmt money default (0) not null,

ExpApprAmt money default (0),

ERNo integer not null,

ECNo integer not null,

AssetNo integer not null,

PRIMARY KEY (EINo),

FOREIGN KEY (ERNo) References ExpenseReport,

FOREIGN KEY (ECNo) References ExpCat,

FOREIGN KEY (AsstNo) References Asset);

 

create table Asset (

AssetNo integer,

AssetDesc varchar(255) not null,

PRIMARY KEY (AssetNo));

 

There are other tables but these seem to be the ones with the errors. Hope someone can give me some indication as to whats wrong. Cheers!

Link to comment
https://forums.phpfreaks.com/topic/147750-ms-sql-server-error/
Share on other sites

Hi there,

 

I was doing some research about your error and it looks this error message appears when you try to create a FOREIGN KEY constraint on a column that does not exist in the referenced table. Error of the Severity Level 16 are generated by the user and are correctable by the user. The statement cannot be executed this way. FOREIGN KEY constraints can only reference columns that do exist at the time when the constraint is created.

Link to comment
https://forums.phpfreaks.com/topic/147750-ms-sql-server-error/#findComment-778458
Share on other sites

  • 2 weeks later...
This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.