Msg 4508, Level 16, State 1, Procedure v#t, Line 4
Views or functions are not allowed on temporary tables. Table names that begin with ‘#’ denote temporary tables.
This error message appears when you try to create a view or a function on a temporary table.
The T-SQL statement can be parsed, but causes the error at runtime.
Errors of the Severity Level 16 are generated by the user and can be fixed by the SQL Server user. The statement cannot be executed this way. You cannot create views or functions on temporary tables.
All versions of SQL Server.
CREATE TABLE #t
c1 INT PRIMARY KEY
CREATE VIEW dbo.v#t
DROP VIEW dbo.v#t
DROP TABLE #t
In the above example we try to create a view on a temporary table. This raises the error.