SQL Clone
SQLServerCentral is supported by Redgate
 
Log in  ::  Register  ::  Not logged in
 
 
 


Brand new error - Invalid object name in T-SQL insert statement


Brand new error - Invalid object name in T-SQL insert statement

Author
Message
kahanu14
kahanu14
SSC-Enthusiastic
SSC-Enthusiastic (124 reputation)SSC-Enthusiastic (124 reputation)SSC-Enthusiastic (124 reputation)SSC-Enthusiastic (124 reputation)SSC-Enthusiastic (124 reputation)SSC-Enthusiastic (124 reputation)SSC-Enthusiastic (124 reputation)SSC-Enthusiastic (124 reputation)

Group: General Forum Members
Points: 124 Visits: 7
I've been using SQL Server 2008 R2 for my web development for years and it's been working perfectly. But something strange happened last night that has stopped my development in my tracks.

Here's some steps in the process:

-- I create a new database from the Management Studio, named "BloggerTest" (dbo)
-- I open a query window and paste in a CREATE table sql script for many tables, such as [dbo].[Blog], etc., with the "use [BloggerTest] GO" at the top
-- I run the script and it runs without errors or messages, and I validate that the tables were created
-- I open another query window and paste in another script for INSERT statements into some of the tables
-- Before I run the script I notice that all the INSERT statement objects display the red squigglie lines under them. When I hover my cursor over the table name I get the message, "Invalid object name '[dbo].[Blog]'". The same squiggle is under all the column names also.

Now here's the part that makes my head explode. I have another table with the same tables and it's a working application, the database is named "BlogApp".

When I change the name of the "use" value from [BloggerTest] to [BlogApp] at the top of the INSERT sql script T-SQL query, all the red squigglie lines disappear!

What the heck is going on? The script that is creating the tables for BloggerTest is the same script that created the tables for BlogApp, so why is this a problem? I've also created the database the exact same way.

And to clarify some things so you don't have to ask questions about it:

-- this is my local development laptop
-- no one else is using this machine
-- the tables exist, in both databases

I've looked through these Forum posts for answers and have not found one. I've also scoured stackoverflow and other resources and haven't found and answer there either. Does anyone have an understanding of why this occurs, because at the moment, it's preventing me from creating new databases.

Any help is appreciated. Thanks.
Sean Lange
Sean Lange
SSC Guru
SSC Guru (101K reputation)SSC Guru (101K reputation)SSC Guru (101K reputation)SSC Guru (101K reputation)SSC Guru (101K reputation)SSC Guru (101K reputation)SSC Guru (101K reputation)SSC Guru (101K reputation)

Group: General Forum Members
Points: 101491 Visits: 18186
That is because your intellisense needs to be refreshed. ctrl+shift+r

Wait a couple seconds and the "red squigglies" will go away.

_______________________________________________________________

Need help? Help us help you.

Read the article at http://www.sqlservercentral.com/articles/Best+Practices/61537/ for best practices on asking questions.

Need to split a string? Try Jeff Modens splitter.

Cross Tabs and Pivots, Part 1 – Converting Rows to Columns
Cross Tabs and Pivots, Part 2 - Dynamic Cross Tabs
Understanding and Using APPLY (Part 1)
Understanding and Using APPLY (Part 2)
kahanu14
kahanu14
SSC-Enthusiastic
SSC-Enthusiastic (124 reputation)SSC-Enthusiastic (124 reputation)SSC-Enthusiastic (124 reputation)SSC-Enthusiastic (124 reputation)SSC-Enthusiastic (124 reputation)SSC-Enthusiastic (124 reputation)SSC-Enthusiastic (124 reputation)SSC-Enthusiastic (124 reputation)

Group: General Forum Members
Points: 124 Visits: 7
Sean, thanks for the response, but that wasn't it.

I'll keep working on it.
SQLRNNR
SQLRNNR
SSC Guru
SSC Guru (100K reputation)SSC Guru (100K reputation)SSC Guru (100K reputation)SSC Guru (100K reputation)SSC Guru (100K reputation)SSC Guru (100K reputation)SSC Guru (100K reputation)SSC Guru (100K reputation)

Group: General Forum Members
Points: 100200 Visits: 18616
This will usually resolve for me if I shut down SSMS and re-open it.

At any rate, the red squiggles are just for intellisense and the queries should continue to work for you.



Jason AKA CirqueDeSQLeil
I have given a name to my pain...
MCM SQL Server, MVP


SQL RNNR

Posting Performance Based Questions - Gail Shaw

Sean Lange
Sean Lange
SSC Guru
SSC Guru (101K reputation)SSC Guru (101K reputation)SSC Guru (101K reputation)SSC Guru (101K reputation)SSC Guru (101K reputation)SSC Guru (101K reputation)SSC Guru (101K reputation)SSC Guru (101K reputation)

Group: General Forum Members
Points: 101491 Visits: 18186
Did you execute a USE statement in SSMS? I have seen many times where that seems to totally confuse intellisense. If however, you use the combobox at the top it seems to keep intellisense in line.

_______________________________________________________________

Need help? Help us help you.

Read the article at http://www.sqlservercentral.com/articles/Best+Practices/61537/ for best practices on asking questions.

Need to split a string? Try Jeff Modens splitter.

Cross Tabs and Pivots, Part 1 – Converting Rows to Columns
Cross Tabs and Pivots, Part 2 - Dynamic Cross Tabs
Understanding and Using APPLY (Part 1)
Understanding and Using APPLY (Part 2)
kahanu14
kahanu14
SSC-Enthusiastic
SSC-Enthusiastic (124 reputation)SSC-Enthusiastic (124 reputation)SSC-Enthusiastic (124 reputation)SSC-Enthusiastic (124 reputation)SSC-Enthusiastic (124 reputation)SSC-Enthusiastic (124 reputation)SSC-Enthusiastic (124 reputation)SSC-Enthusiastic (124 reputation)

Group: General Forum Members
Points: 124 Visits: 7
Sean Lange (2/6/2014)
Did you execute a USE statement in SSMS? I have seen many times where that seems to totally confuse intellisense. If however, you use the combobox at the top it seems to keep intellisense in line.


I used both and everything and initially the red squiggles persisted, but as mentioned by another poster it did not interfere with it executing.

But for some reason today when I opened SSMS and pasted in my Insert statements into a query window, the red squiggles were gone! I don't think I did anything different, but I like it anyway.

Thanks to everyone who helped out with this.
Luis Cazares
Luis Cazares
SSC Guru
SSC Guru (65K reputation)SSC Guru (65K reputation)SSC Guru (65K reputation)SSC Guru (65K reputation)SSC Guru (65K reputation)SSC Guru (65K reputation)SSC Guru (65K reputation)SSC Guru (65K reputation)

Group: General Forum Members
Points: 65443 Visits: 20250
Sometimes Intellisense won't work great and can become a PITA.
I sure like it, but it can get some improvements and bug fixing.


Luis C.
General Disclaimer:
Are you seriously taking the advice and code from someone from the internet without testing it? Do you at least understand it? Or can it easily kill your server?


How to post data/code on a forum to get the best help: Option 1 / Option 2
Go


Permissions

You can't post new topics.
You can't post topic replies.
You can't post new polls.
You can't post replies to polls.
You can't edit your own topics.
You can't delete your own topics.
You can't edit other topics.
You can't delete other topics.
You can't edit your own posts.
You can't edit other posts.
You can't delete your own posts.
You can't delete other posts.
You can't post events.
You can't edit your own events.
You can't edit other events.
You can't delete your own events.
You can't delete other events.
You can't send private messages.
You can't send emails.
You can read topics.
You can't vote in polls.
You can't upload attachments.
You can download attachments.
You can't post HTML code.
You can't edit HTML code.
You can't post IFCode.
You can't post JavaScript.
You can post emoticons.
You can't post or upload images.

Select a forum

































































































































































SQLServerCentral


Search