Few days Befor I have tried a lot to get the date in different format SQL
ResuleSet:
The required outcome was only 2007/06/10.
using function CONVERT.
The reason I use this because it is very convenient as well as provides quick support to convert the date in any format. The table which suggest many format are displayed on MSDN.
SELECT GETDATE()
ResuleSet:
2007-06-10 7:00:56.107
The required outcome was only 2007/06/10.
SELECT DATEADD(D, 0, DATEDIFF(D, 0, GETDATE()))
SELECT CONVERT(VARCHAR(10),GETDATE(),111)
The reason I use this because it is very convenient as well as provides quick support to convert the date in any format. The table which suggest many format are displayed on MSDN.
Some claims that using CONVERT is slower then using DATE functions but it is extremely negligible.