Quantcast
Channel: Forum Getting started with SQL Server
Viewing all articles
Browse latest Browse all 7129

How SQL Server compares date/datetime in low level?

$
0
0

Hello Everybody,

I have one question, related with date comparation on SQL Server 2008R2.

For example I had declared one variable:

declare 
@aDate1 DATE = '2011-01-011',

Then, if I need to filter data from some table, let's call it Table1.

I can write constuction block like this:

select * from Table1 t1 where t1.someFiled >= @aDate1

OR, I can use datediff internal function 

select * from Table1 t1 where datediff(dd, t1.someFiled, @aDate1) >= 1



My question is: is it correct thought that construction t1.someFiled >= @aDate1 it's a shorten version of datediff(dd, t1.someFiled, @aDate1) >= 1?


Viewing all articles
Browse latest Browse all 7129

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>