SQL auto converts decimal to numeric when select & insert

耗尽温柔 提交于 2019-12-24 14:38:02

问题


I have SQL Server 2008 R2 and linked SQL Server 2012. When I do the following

SELECT * INTO dbo.Local_table FROM dbo.Linked_table

all decimal columns automatically get converted into numeric.

What is the reason and how can I get rid of it?


回答1:


This is automatic conversion that occurs with most SQL Servers. You'll find this happening with at least, but not limited to, server year versions 2000-2014. I don't know of a way to get rid of this restriction because it's a built in server feature which restricts arithmetic equations via query statements.

Here is another SO question/answer which might help you: T-SQL Decimal Division Accuracy

Here is some MSDN for clarification: https://msdn.microsoft.com/en-us/library/ms187746.aspx



来源:https://stackoverflow.com/questions/33513776/sql-auto-converts-decimal-to-numeric-when-select-insert

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!