Red lines under third occurance of a table name

  • Hello. I have an annoying problem and I can't find anything about it.

    In scripts I have, that are templates created by my co-workers, the first occurance of a table name, ex: dbo.Exception_Ibank, is fine.

    The third occurance has a red squiggly line under it as do all following occurances. If I move my mouse over the table name, it says that it can't find it. The script runs properly, though. Also, all of the field names of the columns in that table have red lines under them, too.

    I've tried to clear the cache, which didn't do anything.

    This isn't a performance issue. It's just annoying.

    Any help would be greatly appreciated.

    Bert

  • IntelliSense is not a strongest point of SSMS...

    You will use to it.

    BTW. SQL2012 adds more annoying features in to it eg. pinky UPDATE...

    _____________________________________________
    "The only true wisdom is in knowing you know nothing"
    "O skol'ko nam otkrytiy chudnyh prevnosit microsofta duh!":-D
    (So many miracle inventions provided by MS to us...)

    How to post your question to get the best and quick help[/url]

  • I think SQL parses things a batch at a time. All your code is in the same batch, and the table is created in that batch. That might be why SQL doesn't recognize that the table exists in the later SELECT statement(s).

    SQL DBA,SQL Server MVP(07, 08, 09) A socialist is someone who will give you the shirt off *someone else's* back.

  • You are correct! Thank you. I took out the create table statement and the following alter statement and all of the red lines went away.

    It's no less annoying, but thank you for the answer.

    Microsoft is so stupid sometimes.

  • You could also just add a "GO" after the ALTER TABLE; that will put the SELECTs in a separate batch, by which table SQL should "know" they already exist, having been created by a previous batch.

    SQL DBA,SQL Server MVP(07, 08, 09) A socialist is someone who will give you the shirt off *someone else's* back.

  • I tried that. Nothing. I also added BEGINs and ENDs. Nothing.

  • bert.hooks (7/10/2013)


    You are correct! Thank you. I took out the create table statement and the following alter statement and all of the red lines went away.

    It's no less annoying, but thank you for the answer.

    Microsoft is so stupid sometimes.

    Users are so stupid sometimes. Those objects do not currently exist, as the red lines indicate. The script runs fine, as expected, and a refresh of the intelli-sense cache should reflect the new table.

    The SQL Guy @ blogspot[/url]

    @SeanPearceSQL

    About Me[/url]

  • Wow. Insults from an idiotic know-it-all.

    As I indicated in my original post, the tables and column names do exist. I work with people who have used SQL for years and they get the red lines, too, even through the tables exist.

    Ten Centuries was correct. You are not.

  • bert.hooks (7/11/2013)


    Wow. Insults from an idiotic know-it-all.

    Pot --> kettle --> black.

    Excuse me for being defensive, but Microsoft products have been putting food on my table since 1996. I don't think you should be calling them stupid because of your OCD being offended by squiggly red lines.

    The SQL Guy @ blogspot[/url]

    @SeanPearceSQL

    About Me[/url]

  • I have my opinion and you have yours.

    Have a great day.

  • Sean Pearce (7/11/2013)


    bert.hooks (7/11/2013)


    Wow. Insults from an idiotic know-it-all.

    Pot --> kettle --> black.

    Excuse me for being defensive, but Microsoft products have been putting food on my table since 1996. I don't think you should be calling them stupid because of your OCD being offended by squiggly red lines.

    You're not excused. I don't object per se to verbal fisticuffs when warranted, but it's not in this case. There's a huge difference between calling a product "stupid" and calling a person "stupid".

    SQL DBA,SQL Server MVP(07, 08, 09) A socialist is someone who will give you the shirt off *someone else's* back.

  • ScottPletcher (7/11/2013)


    Sean Pearce (7/11/2013)


    bert.hooks (7/11/2013)


    Wow. Insults from an idiotic know-it-all.

    Pot --> kettle --> black.

    Excuse me for being defensive, but Microsoft products have been putting food on my table since 1996. I don't think you should be calling them stupid because of your OCD being offended by squiggly red lines.

    You're not excused. I don't object per se to verbal fisticuffs when warranted, but it's not in this case. There's a huge difference between calling a product "stupid" and calling a person "stupid".

    I wasn't asking you.

    The SQL Guy @ blogspot[/url]

    @SeanPearceSQL

    About Me[/url]

  • Sean Pearce (7/11/2013)


    ScottPletcher (7/11/2013)


    Sean Pearce (7/11/2013)


    bert.hooks (7/11/2013)


    Wow. Insults from an idiotic know-it-all.

    Pot --> kettle --> black.

    Excuse me for being defensive, but Microsoft products have been putting food on my table since 1996. I don't think you should be calling them stupid because of your OCD being offended by squiggly red lines.

    You're not excused. I don't object per se to verbal fisticuffs when warranted, but it's not in this case. There's a huge difference between calling a product "stupid" and calling a person "stupid".

    I wasn't asking you.

    I never claimed you did.

    SQL DBA,SQL Server MVP(07, 08, 09) A socialist is someone who will give you the shirt off *someone else's* back.

Viewing 13 posts - 1 through 12 (of 12 total)

You must be logged in to reply to this topic. Login to reply