T-SQL View type conversion error; DROP and CREATE view makes issue vanish?

This error is really strange (SQL Server 2008 R2 (RTM). I am SELECTing from a view in some application code, and very infrequently, I get an error about an invalid data type conversion. The SQL in the view looked OK, so I scripted the view for DROP and CREATE, ran the generated script, and the issue goes away!

What could be going on here? Could it be something with statistics? I don't have the full error message, but if it happens again, I will update my description with it.

Thanks, Carl


You probably changed definition of underlying tables.

Once You CREATE VIEW, SQL Server keeps metadata of returning columns. If You change metadata of underlying tables, You need to recreate (DROP and CREATE VIEW) in order for view metadata to get refreshed.

Need Your Help

Oracle JDBC prefetch: how to avoid running out of RAM

java oracle jdbc prefetch

Using Oracle java JDBC (ojdbc14 10.2.x), loading a query with many rows takes forever (high latency environment. This is apparently the default prefetch in Oracle JDBC is default size "10" which

Org babel code blocks cannot be called from a org table

python emacs elisp org-mode org-babel

I am having trouble calling my babel code blocks from tables using

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.