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.
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.