Invalid data type while using user defined table type Invalid data type while using user defined table type database database

Invalid data type while using user defined table type


I had this exact problem happening to me.I simply made sure I had saved everything I needed in SQL Server and restarted the SQL Server Management Studio.

Once restarted, the errors no longer appeared. I am using SQL Server 2012 but I don't see why this shouldn't also work with 2008.


I know I am late to the party but actually what you see is the problem with SSMS Intellisense and you can easily resolve it without restarting whole SSMS. Just press CTRL-SHIFT-R. Wait a few moments and problem is resolved :)


I have had this same issue after creating a new new user-defined table type (UDTT) in one query window and then trying to create a new stored procedure in another. As per another answer to this question, I solved it by restarting SQL Server Management Studio. However it annoyed me that I had to restart the application as I had plenty of other work open/in-progress.

In my case I had noticed that IntelliSense in SSMS had underlined the name of my UDTT with a red squiggly line. I found the following advice...

By far the most common scenario is that your local, in-memory cache is stale. This can be more prevalent if you switch databases often using the USE command, or if the database is changing in other query windows or by other users. You can refresh the cache by pressing Ctrl+Shift+R or by selecting the menu option Edit > IntelliSense > Refresh Local Cache. As above, you may need to wait for the cache to fully load, depending on the size of your metadata and other resources involved...

... on the following web page ...

https://www.mssqltips.com/sqlservertip/2591/troubleshooting-intellisense-in-sql-server-management-studio-2012/

The advice is echoed on MSDN, with another bit of advice here:

https://msdn.microsoft.com/en-us/library/ms173434.aspx

IntelliSense functionality does not cover database objects created by another connection after your editor window connected to the database.

I cannot be sure whether refreshing the IntelliSense cache would have any effect on errors thrown when actually trying to create the Stored Procedure, but since the restart of SMSS solved the problem with no other changes to the script, a caching problem does sound about right.