楼主: jerker
1486 7

How to Get SQL Server Data Conversion Horribly Wrong [推广有奖]

已卖:115份资源

学术权威

80%

还不是VIP/贵宾

-

TA的文库  其他...

数据科学(Data Science)

威望
6
论坛币
50722 个
通用积分
554.7265
学术水平
3272 点
热心指数
3508 点
信用等级
3023 点
经验
532 点
帖子
5802
精华
28
在线时间
3532 小时
注册时间
2009-11-19
最后登录
2025-6-30

初级学术勋章 中级热心勋章 初级热心勋章 初级信用勋章 中级学术勋章 高级学术勋章 特级学术勋章 高级热心勋章 特级热心勋章 中级信用勋章 高级信用勋章 特级信用勋章

楼主
jerker 发表于 2015-4-22 15:48:13 |AI写论文

+2 论坛币
k人 参与回答

经管之家送您一份

应届毕业生专属福利!

求职就业群
赵安豆老师微信:zhaoandou666

经管之家联合CDA

送您一个全额奖学金名额~ !

感谢您参与论坛问题回答

经管之家送您两个论坛币!

+2 论坛币
以下SQL Server代码在你不能确定是否可以正常运行的话,建议您细读这篇文章,关于隐式数据转换。
  • DECLARE @A CHAR(3) = 'DEF';
  • SELECT CASE
  •   WHEN @A = 'DEF' THEN 0
  •   WHEN @A = 'GHI' THEN 1
  •   ELSE 'DOES NOT APPLY'
  • END;

  • GO
  • DECLARE @A CHAR(3) = 'ABC';
  • SELECT CASE
  •   WHEN @A = 'DEF' THEN 0
  •   WHEN @A = 'GHI' THEN 1
  •   ELSE 'DOES NOT APPLY'
  • END;

  • GO
  • DECLARE
  •   @A CHAR(3) = 'ABC',
  •   @B CHAR(5) = 'DEFGH',
  •   @C VARCHAR(10) = NULL,
  •   @D INT = 1234;
  • SELECT COALESCE(@C, @D, @A);

  • GO
  • DECLARE
  •   @A CHAR(3) = 'ABC',
  •   @B CHAR(5) = 'DEFGH',
  •   @C VARCHAR(10) = NULL,
  •   @D INT = 1234;
  • SELECT COALESCE(@C, @A, @D);

QQ截图20150422153945.png
How to Get SQL Server Data-Conversion Horribly Wrong
One of the most certain ways of going wrong with any relational database is to get data conversion wrong. Implicit data conversion is a good feature for the expert but  can cause a lot of trouble to the unwary. These boil down to seven ways of  failing to get data conversion right. Rob Sheldon explains and gives sage advice on how to avoid the problems。


Failure #1: Not understanding data type precedence
Failure #2: Not taking performance into consideration
Failure #3: Assuming all numbers are created equal
Failure #4: Relying on the ISNUMERIC built-in function
Failure #5: Underestimating the world of silent truncation
Failure #6: Not understanding date/time data
Failure #7: Importing Excel data without thought to data types
Failure #8: Treating XML just like any other string
Failure #9: Failing to take portability into account

本帖隐藏的内容

How to Get SQL Server Data-Conversion Horribly Wrong.docx (168.42 KB)


信息来源:redgate





二维码

扫码加我 拉你入群

请注明:姓名-公司-职位

以便审核进群资格,未注明则拒绝

关键词:conversion Version Server Serve wrong

已有 2 人评分经验 论坛币 学术水平 热心指数 信用等级 收起 理由
Nicolle + 20 + 1 + 1 精彩帖子
fantuanxiaot + 35 + 1 + 1 + 1 精彩帖子

总评分: 经验 + 20  论坛币 + 35  学术水平 + 2  热心指数 + 2  信用等级 + 1   查看全部评分

本帖被以下文库推荐

沙发
mike68097 发表于 2015-4-22 19:10:00

藤椅
rrjj101022 发表于 2015-4-22 19:15:34
谢谢分享~~~

板凳
sunyiping 发表于 2015-4-23 14:25:05
学习学习.

报纸
jerker 发表于 2015-4-23 14:29:51
sunyiping 发表于 2015-4-23 14:25
学习学习.

地板
sunyiping 发表于 2015-4-23 14:31:00

7
karmenlv 发表于 2015-5-9 18:45:43
How to Get SQL Server Data Conversion Horribly Wrong

8
sos1154 发表于 2015-5-19 13:39:37

您需要登录后才可以回帖 登录 | 我要注册

本版微信群
加好友,备注cda
拉您进交流群
GMT+8, 2025-12-28 17:58