William
William

Reputation: 508

How to force INFORMATION_SCHEMA.COLUMNS to update

I'm creating a new table in a SQL Server 2008 database and I want it to show up in a view, which looks something like this:

SELECT
    [TABLE_NAME],
    [ORDINAL_POSITION],
    [COLUMN_NAME],
    [DATA_TYPE]
FROM INFORMATION_SCHEMA.COLUMNS

I've confirmed that the table was successfully created and data inserted, but it's not showing up in INFORMATION_SCHEMA.COLUMNS. I found this similar question about SQL Server 2005, but the solution there - running exec sp_refreshsqlmodule 'dbo.myview' - didn't seem to help.

Upvotes: 1

Views: 3634

Answers (1)

William
William

Reputation: 508

Silly mistake, but here's the reason I couldn't get an update: my new table was being added to the wrong schema. I copied it over to the correct schema and now everything is working correctly.

Upvotes: 1

Related Questions