Showing posts with label automatically. Show all posts
Showing posts with label automatically. Show all posts

Wednesday, March 21, 2012

Date loop

Please Help!
I am looking for a way to automatically loop thru dates starting 2006-01-01
thru 2006-12-01. The field I am trying to query is called endts.
I need to know where endts between '2006-01-01 12:00:00AM' and '2006-01-01
12:00:00PM'
I need to loop thru this everyday from 2006-01-01 thru 2006-12-01.
Could someone please post sample code on how this can be done. If it is
possible.
Thanks in Advance.
BRyou can try this one:
declare @.enddate datetime
declare @.loopdate datetime
set @.loopdate = '2006-01-01 12:00:00AM'
set @.enddate = '2006-12-01 12:00:00PM'
while @.loopdate <= @.enddate
begin
select @.loopdate -- Put your code here
set @.loopdate = @.loopdate+1
end
"BR" wrote:

> Please Help!
> I am looking for a way to automatically loop thru dates starting 2006-01-0
1
> thru 2006-12-01. The field I am trying to query is called endts.
> I need to know where endts between '2006-01-01 12:00:00AM' and '2006-01-01
> 12:00:00PM'
> I need to loop thru this everyday from 2006-01-01 thru 2006-12-01.
> Could someone please post sample code on how this can be done. If it is
> possible.
> Thanks in Advance.
> BR
>
>|||You may find that this, and similar date related tasks, are best done using
a Calendar Table.
See:
Datetime -Calendar Table
http://www.aspfaq.com/show.asp?id=2519
Arnie Rowland, Ph.D.
Westwood Consulting, Inc
Most good judgment comes from experience.
Most experience comes from bad judgment.
- Anonymous
You can't help someone get up a hill without getting a little closer to the
top yourself.
- H. Norman Schwarzkopf
"BR" <so> wrote in message news:%23Cq1lVuHHHA.4712@.TK2MSFTNGP04.phx.gbl...
> Please Help!
> I am looking for a way to automatically loop thru dates starting
> 2006-01-01 thru 2006-12-01. The field I am trying to query is called
> endts.
> I need to know where endts between '2006-01-01 12:00:00AM' and '2006-01-01
> 12:00:00PM'
> I need to loop thru this everyday from 2006-01-01 thru 2006-12-01.
> Could someone please post sample code on how this can be done. If it is
> possible.
> Thanks in Advance.
> BR
>|||BR
Can you post DDL+ sample data + an expected result?
SELECT <columns> FROM Table WHERE dtcolumn >= '20060101 12:00:00' AND
dtcolumn <DATEADD(d,1,'20060101' )
"BR" <so> wrote in message news:%23Cq1lVuHHHA.4712@.TK2MSFTNGP04.phx.gbl...
> Please Help!
> I am looking for a way to automatically loop thru dates starting
> 2006-01-01 thru 2006-12-01. The field I am trying to query is called
> endts.
> I need to know where endts between '2006-01-01 12:00:00AM' and '2006-01-01
> 12:00:00PM'
> I need to loop thru this everyday from 2006-01-01 thru 2006-12-01.
> Could someone please post sample code on how this can be done. If it is
> possible.
> Thanks in Advance.
> BR
>

Date loop

Please Help!
I am looking for a way to automatically loop thru dates starting 2006-01-01
thru 2006-12-01. The field I am trying to query is called endts.
I need to know where endts between '2006-01-01 12:00:00AM' and '2006-01-01
12:00:00PM'
I need to loop thru this everyday from 2006-01-01 thru 2006-12-01.
Could someone please post sample code on how this can be done. If it is
possible.
Thanks in Advance.
BR
you can try this one:
declare @.enddate datetime
declare @.loopdate datetime
set @.loopdate = '2006-01-01 12:00:00AM'
set @.enddate = '2006-12-01 12:00:00PM'
while @.loopdate <= @.enddate
begin
select @.loopdate-- Put your code here
set @.loopdate = @.loopdate+1
end
"BR" wrote:

> Please Help!
> I am looking for a way to automatically loop thru dates starting 2006-01-01
> thru 2006-12-01. The field I am trying to query is called endts.
> I need to know where endts between '2006-01-01 12:00:00AM' and '2006-01-01
> 12:00:00PM'
> I need to loop thru this everyday from 2006-01-01 thru 2006-12-01.
> Could someone please post sample code on how this can be done. If it is
> possible.
> Thanks in Advance.
> BR
>
>
|||You may find that this, and similar date related tasks, are best done using
a Calendar Table.
See:
Datetime -Calendar Table
http://www.aspfaq.com/show.asp?id=2519
Arnie Rowland, Ph.D.
Westwood Consulting, Inc
Most good judgment comes from experience.
Most experience comes from bad judgment.
- Anonymous
You can't help someone get up a hill without getting a little closer to the
top yourself.
- H. Norman Schwarzkopf
"BR" <so> wrote in message news:%23Cq1lVuHHHA.4712@.TK2MSFTNGP04.phx.gbl...
> Please Help!
> I am looking for a way to automatically loop thru dates starting
> 2006-01-01 thru 2006-12-01. The field I am trying to query is called
> endts.
> I need to know where endts between '2006-01-01 12:00:00AM' and '2006-01-01
> 12:00:00PM'
> I need to loop thru this everyday from 2006-01-01 thru 2006-12-01.
> Could someone please post sample code on how this can be done. If it is
> possible.
> Thanks in Advance.
> BR
>
|||BR
Can you post DDL+ sample data + an expected result?
SELECT <columns> FROM Table WHERE dtcolumn >= '20060101 12:00:00' AND
dtcolumn <DATEADD(d,1,'20060101' )
"BR" <so> wrote in message news:%23Cq1lVuHHHA.4712@.TK2MSFTNGP04.phx.gbl...
> Please Help!
> I am looking for a way to automatically loop thru dates starting
> 2006-01-01 thru 2006-12-01. The field I am trying to query is called
> endts.
> I need to know where endts between '2006-01-01 12:00:00AM' and '2006-01-01
> 12:00:00PM'
> I need to loop thru this everyday from 2006-01-01 thru 2006-12-01.
> Could someone please post sample code on how this can be done. If it is
> possible.
> Thanks in Advance.
> BR
>

Date loop

Please Help!
I am looking for a way to automatically loop thru dates starting 2006-01-01
thru 2006-12-01. The field I am trying to query is called endts.
I need to know where endts between '2006-01-01 12:00:00AM' and '2006-01-01
12:00:00PM'
I need to loop thru this everyday from 2006-01-01 thru 2006-12-01.
Could someone please post sample code on how this can be done. If it is
possible.
Thanks in Advance.
BRYou may find that this, and similar date related tasks, are best done using
a Calendar Table.
See:
Datetime -Calendar Table
http://www.aspfaq.com/show.asp?id=2519
Arnie Rowland, Ph.D.
Westwood Consulting, Inc
Most good judgment comes from experience.
Most experience comes from bad judgment.
- Anonymous
You can't help someone get up a hill without getting a little closer to the
top yourself.
- H. Norman Schwarzkopf
"BR" <so> wrote in message news:%23Cq1lVuHHHA.4712@.TK2MSFTNGP04.phx.gbl...
> Please Help!
> I am looking for a way to automatically loop thru dates starting
> 2006-01-01 thru 2006-12-01. The field I am trying to query is called
> endts.
> I need to know where endts between '2006-01-01 12:00:00AM' and '2006-01-01
> 12:00:00PM'
> I need to loop thru this everyday from 2006-01-01 thru 2006-12-01.
> Could someone please post sample code on how this can be done. If it is
> possible.
> Thanks in Advance.
> BR
>|||BR
Can you post DDL+ sample data + an expected result?
SELECT <columns> FROM Table WHERE dtcolumn >= '20060101 12:00:00' AND
dtcolumn <DATEADD(d,1,'20060101' )
"BR" <so> wrote in message news:%23Cq1lVuHHHA.4712@.TK2MSFTNGP04.phx.gbl...
> Please Help!
> I am looking for a way to automatically loop thru dates starting
> 2006-01-01 thru 2006-12-01. The field I am trying to query is called
> endts.
> I need to know where endts between '2006-01-01 12:00:00AM' and '2006-01-01
> 12:00:00PM'
> I need to loop thru this everyday from 2006-01-01 thru 2006-12-01.
> Could someone please post sample code on how this can be done. If it is
> possible.
> Thanks in Advance.
> BR
>sql

Monday, March 19, 2012

Date in subject line of email subscription

Hi,
is there any way to automatically put the date of previous day in
subject line of email subscription? Can anybody tell me how to do it?The only way to do this would be with Data Driven subscriptions. First you
have to have Enterprise edition or Data Driven subscriptions are not
present. If you do have the Enterprise edition then you can generate the
subject from a SQL query.
--
-Daniel
This posting is provided "AS IS" with no warranties, and confers no rights.
"mentor" <daniel.pater@.pl.ibm.com> wrote in message
news:1126166552.090643.170840@.f14g2000cwb.googlegroups.com...
> Hi,
> is there any way to automatically put the date of previous day in
> subject line of email subscription? Can anybody tell me how to do it?
>|||Thanks a lot
i resolved this problem in different way. I save the reports to shared
folder and send them using vbs file :)

Tuesday, February 14, 2012

Date / Time types

Hi, I'be just started to import data into sqlserver from ms access, and it automatically stores my dates as smallint length 4. Is this ok? For display purposes I want dd/mm/yyyy. Will 4 bytes store this?I generally recommend DATETIME unless I know that the values can be stored properly in a SMALLDATETIME column. See the Using Date and Time data (http://msdn.microsoft.com/library/default.asp?url=/library/en-us/acdata/ac_8_con_03_7uzy.asp) discussion in MSDN for more details.

-PatP