sql server - Is this SQL line saying previous day or the next day? -


we have old sql script looks data previous day. in our table have dateplaced column, want able records time ran til previous day. help.

where  datediff(day,[dateplaced],getdate()) = 1 

ugh, don't way. applying function column means index relatively useless. data yesterday (or range, matter), try:

declare @today date = sysdatetime();  ...   dateplaced >= dateadd(day, -1, @today)     , dateplaced <  @today; 

if on old version sql server 2005, instead:

declare @today datetime; set @today = datediff(day, 0, getdate());  ...   dateplaced >= dateadd(day, -1, @today)     , dateplaced <  @today; 

Comments

Popular posts from this blog

php - Calling a template part from a post -

Firefox SVG shape not printing when it has stroke -

How to mention the localhost in android -