Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.databases.ms-sqlserver > #1449

Re: SQL Date expressions

X-Received by 10.224.207.2 with SMTP id fw2mr5094250qab.6.1366210208944; Wed, 17 Apr 2013 07:50:08 -0700 (PDT)
X-Received by 10.182.190.4 with SMTP id gm4mr224019obc.36.1366210208856; Wed, 17 Apr 2013 07:50:08 -0700 (PDT)
Path csiph.com!newsfeed.hal-mli.net!feeder3.hal-mli.net!newsfeed.hal-mli.net!feeder2.hal-mli.net!npeer01.iad.highwinds-media.com!news.highwinds-media.com!feed-me.highwinds-media.com!ca1no546265qab.0!news-out.google.com!ef9ni24qab.0!nntp.google.com!ca1no546255qab.0!postnews.google.com!glegroupsg2000goo.googlegroups.com!not-for-mail
Newsgroups comp.databases.ms-sqlserver
Date Wed, 17 Apr 2013 07:50:08 -0700 (PDT)
In-Reply-To <03f8c0f4-4009-4762-8337-aeb7d15a926a@googlegroups.com>
Complaints-To groups-abuse@google.com
Injection-Info glegroupsg2000goo.googlegroups.com; posting-host=195.57.19.2; posting-account=jIl9nQoAAAA9P37IIqQq64yAx-2NQYiu
NNTP-Posting-Host 195.57.19.2
References <03f8c0f4-4009-4762-8337-aeb7d15a926a@googlegroups.com>
User-Agent G2/1.0
MIME-Version 1.0
Message-ID <0fa01ee9-58f2-4d47-b9eb-78212b694d8b@googlegroups.com> (permalink)
Subject Re: SQL Date expressions
From bradbury9 <ray.bradbury9@gmail.com>
Injection-Date Wed, 17 Apr 2013 14:50:08 +0000
Content-Type text/plain; charset=ISO-8859-1
Content-Transfer-Encoding quoted-printable
X-Received-Bytes 1628
Xref csiph.com comp.databases.ms-sqlserver:1449

Show key headers only | View raw


El miércoles, 17 de abril de 2013 16:17:20 UTC+2, contracer  escribió:
> Hi, 
> 
> 
> 
> How could I create these sql expressions ?
> 
> 
> 
> last 7 days
> 
> last 30 days
> 
> last month
> 
> last week
> 
> this year
> 
> last year
> 
> 
> 
> Thanks

Using TSQL date functions, here is a list:

http://msdn.microsoft.com/en-us/library/ms186724.aspx

Most usual functions are GetDate(), DatePart() and DateAdd()

Back to comp.databases.ms-sqlserver | Previous | NextPrevious in thread | Find similar


Thread

SQL Date expressions contracer <contracer11@gmail.com> - 2013-04-17 07:17 -0700
  Re: SQL Date expressions bradbury9 <ray.bradbury9@gmail.com> - 2013-04-17 07:50 -0700

csiph-web