Click here to Skip to main content
15,891,136 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
hi guys....


different between for this two query


select left(GETDATE(), 50)
select CONVERT(varchar,GETDATE(),100)


the result is same for this both query but what is the major difference for this two query
Posted
Updated 21-Sep-16 1:08am
v2

1 solution

Effectively, nothing.
The LEFT(GETDATE(), 50) version uses the default conversion format, which is exactly what CONVERT format 100 does.
In fact, you can omit the 100 completely:
SQL
SELECT CONVERT(VARCHAR, GETDATE())

Will also produce the same result.
The CONVERT version is clearer to read however.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900