Skip to content
Advertisement

References invalid table in create table script with foreign keys

I’m trying to create a table in SQL Server with two foreign keys. But the problem is it’s not recognizing one of the reference tables.

Here is table creation script.

SQL Server is throwing the error on [dbo].[Group]. Here is the error message.

enter image description here

I have created both of the tables [dbo].[Group] and [dbo].[Employee]. And the confusion is, why it’s not throwing the same error for [dbo].[Employee]?

Edit

Script of Group and Employee Table

Advertisement

Answer

If you’re only concerned about the red squiggle under [dbo].[Group] it could just be that the IntelliSense cache in SSMS hasn’t sensed a newly created table yet – press Ctrl+Shift+R to refresh it then wait a few seconds to see if it goes away.

User contributions licensed under: CC BY-SA
2 People found this is helpful
Advertisement