开发者

Is there any way to disable automatic type coercion in SQL Server 2005/2008, from varchar to int (as an example)?

If I have the following SQL:

INSERT INTO sometable (someintcolumn) VALUES ('1')

This will succeed, inserting the value 1.

Is there any way I can ask SQL Server to please d开发者_运维问答on't convert the types for me, permanently or temporarily, and instead fail the above SQL execution?

We have a large import project that we'd like to fix all SQL's for, but that requires meticulously going through all SQL's and analyzing the data types of all columns. Since this is executed against test databases on our servers, we'd like to get our server to tell us when we've got the data types wrong.


Martin says SQL Server can't do it. I wonder how hard it would be to cut the type conversion code out of an open source dbms.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜