4

I say 'issue' because it's not breaking anything, it's merely a small thing I've noticed in SSMS.

I run the following:

SP_RENAME 'MyTable.OldName', 'NewName' , 'COLUMN'

And then type the following in SSMS:

SELECT [NewName] FROM MyTable;

The [NewName] part now has a red squiggly line under it with a 'Invalid column name' warning.

Why? Is the old name cached in SSMS somehow somewhere? Is my column rename incomplete somehow? I don't really care if it's a bug of SSMS, but I'd like to know there isn't a 'step 2' I'm meant to do once renaming a column.

Note: If I type SELECT [OldName] FROM MyTable; I don't get the warning, but it (obviously) doesn't run.

  • *"Is the old name cached in SSMS somehow somewhere"* - Yes; Go to Edit => IntelliSense => Refresh or Ctrl+Shift+R to make it update itself. You don't need to do anything else, its a false warning. – Alex K. Oct 13 '15 at 12:12
  • 1
    Sorted! Thanks. Post it as the answer so I can mark it accordingly. –  Oct 13 '15 at 12:20

1 Answers1

6

"Is the old name cached in SSMS somehow somewhere" - Yes.

Go to Edit => IntelliSense => Refresh or Ctrl+Shift+R to make it update itself.

You don't need to do anything else, its a false warning.

Alex K.
  • 171,639
  • 30
  • 264
  • 288
  • I suppose this does not work in a single transaction, as SSMS doesn't know the column was renamed by `sp_rename` just before. – Mike de Klerk May 03 '21 at 11:16