搜索
人大经济论坛 附件下载

附件下载

所在主题:
文件名:  How to Get SQL Server Data-Conversion Horribly Wrong.docx
资料下载链接地址: https://bbs.pinggu.org/a-1777823.html
附件大小:
168.42 KB   举报本内容
以下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);


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 butcan cause a lot of trouble to the unwary. These boil down to seven ways offailing 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
[hide][/hide]
信息来源:redgate







    熟悉论坛请点击新手指南
下载说明
1、论坛支持迅雷和网际快车等p2p多线程软件下载,请在上面选择下载通道单击右健下载即可。
2、论坛会定期自动批量更新下载地址,所以请不要浪费时间盗链论坛资源,盗链地址会很快失效。
3、本站为非盈利性质的学术交流网站,鼓励和保护原创作品,拒绝未经版权人许可的上传行为。本站如接到版权人发出的合格侵权通知,将积极的采取必要措施;同时,本站也将在技术手段和能力范围内,履行版权保护的注意义务。
(如有侵权,欢迎举报)
二维码

扫码加我 拉你入群

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

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

GMT+8, 2025-12-28 22:09