The error message
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.
is a run time error message of severity level 16. It can occur on all versions of SQL Server. This error message appears when you try to create a view or a function on a temporary table. You cannot create views or functions on temporary tables.