当选择&时,SQL自动将十进制转换为数字。插 [英] SQL auto converts decimal to numeric when select & insert

查看:161
本文介绍了当选择&时,SQL自动将十进制转换为数字。插的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有SQL Server 2008 R2和链接的SQL Server 2012.
当我做以下操作时:
$ b $

  SELECT * INTO dbo.Local_table FROM dbo.Linked_table 

所有十进制列自动转换为数字。



这是什么原因,怎样才能摆脱它?

解决方案

是大多数SQL Server发生的自动转换。您至少会发现这种情况,但不限于服务器年度版本2000-2014。我不知道有一种方法来摆脱这个限制,因为它是一个内置的服务器功能,通过查询语句来限制算术方程。

这是另一个SO问题/答案可能会帮助你:
T-SQL十进制分割准确性
a>


下面是一些MSDN的澄清:
https://msdn.microsoft.com/zh-cn/library/ms187746.aspx


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?

解决方案

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

这篇关于当选择&时,SQL自动将十进制转换为数字。插的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆