gpt4 book ai didi

SQL Server : How can I copy data from one table to another table without the characters 'e+' being added to the results

转载 作者:行者123 更新时间:2023-12-04 06:15:50 24 4
gpt4 key购买 nike

我正在从 Excel 电子表格导入创建的表中复制数据。

这是我将数据从导入表移动到实际表的操作:

INSERT INTO TableName ([Column1], [Column2])
SELECT [Column1], [Column2] FROM [Sheet1$]

在第 1 列下执行此操作后,我得到如下记录:
5.31752e+007当该记录的实际值(来自我从中导入的表)是 5046610163
有任何想法吗?

最佳答案

您没有指定其中包含浮点数据的是 Column1 还是 Column2,但这里有一个示例,假设 Column1 是您需要的。

INSERT INTO TableName ([Column1], [Column2])
SELECT CAST([Column1] AS decimal(38,2)), [Column2] FROM [Sheet1$]

我经常使用相同的代码转换为 varchar 而不使用所有格式:
SELECT CONVERT(varchar(100), CAST(@value as decimal(38,2)))

关于SQL Server : How can I copy data from one table to another table without the characters 'e+' being added to the results,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7263271/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com