在SQL中转换函数。 [英] convert function in SQL.

查看:83
本文介绍了在SQL中转换函数。的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

亲爱的团队,



我有如下选择查询:

Dear Team,

I have the Select Query as follows:

select count(c.ID) as [RECORDCOUNT], U.NETWORKID from CUSTOMERLOANDATA C (nolock)
Inner Join USERMASTER U (nolock) on U.Id = C.QCUSERID
where convert(varchar(10),C.UpdatedON,120) = CONVERT(VARCHAR(10), GETDATE(),120)
AND
 where isnull(c.QCPRocessed,0) = 1
group by U.NETWORKID
order by U.NETWORKID





我无法找到其中的条件。这是什么意思?



I cant find the where condition .What does it mean ??

where convert(varchar(10),C.UpdatedON,120) = CONVERT(VARCHAR(10), GETDATE(),120)





请指导我。

谢谢

Harshal



Please Guide me.
Thanks
Harshal

推荐答案

http://msdn.microsoft.com/en-us/library/ms187928.aspx [<一个href =http://msdn.microsoft.com/en-us/library/ms187928.aspxtarget =_ blanktitle =新窗口> ^ ]



从来没有理由使用SQL的转换,但显然它将日期强制为长度为10的通用格式(varchar),04/15/2014。这可以确保where语句比较格式相同的日期。



选择由GETDATE()函数确定的特定日期更新的记录,并将日期作为10个字符的字符串进行匹配。
http://msdn.microsoft.com/en-us/library/ms187928.aspx[^]

Never had a reason to use SQL's "convert", but apparently it is forcing the dates into a common format (varchar) with a length of 10, "04/15/2014". This ensures that the where statement is comparing identically formatted dates.

it's selecting records that were updated on a particular day determined by the GETDATE() function and matching the dates as a 10-character string.


这篇关于在SQL中转换函数。的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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