Sunday, February 26, 2012

generate real date time

hi, i need to create a function to do some like this...
update myTable set DateModify = getdate()
... but... i need to get a minimum difference bettwen records...
milisecons... or...
how can i get an array or cursor (SQL server side) with 500 records
with different datetime programatically?Hi,
I assume that you are asking about writing a procedure for this and not
a function. A function cannot update tables nor can it use getdate().
To do this in a procedure you can use the WAITFOR DELAY statement in
SQL.
Regards,
Kart
celerno wrote:
> hi, i need to create a function to do some like this...
> update myTable set DateModify = getdate()
> ... but... i need to get a minimum difference bettwen records...
> milisecons... or...
> how can i get an array or cursor (SQL server side) with 500 records
> with different datetime programatically?|||Hi Kart.. thanks for your response...
I try to use waitfor, but i can't find the way to do it.
sorry, i don't have good programming skills in sql server...
here is my problem:
i retrieve a bunch of data using the DateTime field to get the lastest
data using "select top N... ... where dateTimeNew>myDate"
after download the N rows, myDate gets the biggest dateTime value from
the N rows.
and when we have N+1 data with the same DateTime my new select Top is
equal to the previus sentence and i got the same data bunch.
in order to evade this problem i want to create a routine on store
procedure or any way on the server side to set different datetimes to
all data...
excuse my poor english... thanks in advance...!
On 10 nov, 13:08, "Kart" <skarthike...@.bigfoot.com> wrote:
> Hi,
> I assume that you are asking about writing a procedure for this and not
> a function. A function cannot update tables nor can it use getdate().
> To do this in a procedure you can use the WAITFOR DELAY statement in
> SQL.
> Regards,
> Kart
> celerno wrote:
> > hi, i need to create a function to do some like this...
> > update myTable set DateModify = getdate()
> > ... but... i need to get a minimum difference bettwen records...
> > milisecons... or...
> > how can i get an array or cursor (SQL server side) with 500 records
> > with different datetime programatically?|||yeah, this query it all that i need... it was so simple.!
reference to:
http://www.sqlteam.com/item.asp?ItemID=765
declare @.intCounter datetime
set @.intCounter = getdate()
update articulo
SET @.intCounter = fechahora = dateadd(s, 1, @.intCounter)
select fechahora from articulo
On 11 nov, 11:06, "celerno" <cele...@.gmail.com> wrote:
> Hi Kart.. thanks for your response...
> I try to use waitfor, but i can't find the way to do it.
> sorry, i don't have good programming skills in sql server...
> here is my problem:
> i retrieve a bunch of data using the DateTime field to get the lastest
> data using "select top N... ... where dateTimeNew>myDate"
> after download the N rows, myDate gets the biggest dateTime value from
> the N rows.
> and when we have N+1 data with the same DateTime my new select Top is
> equal to the previus sentence and i got the same data bunch.
> in order to evade this problem i want to create a routine on store
> procedure or any way on the server side to set different datetimes to
> all data...
> excuse my poor english... thanks in advance...!
> On 10 nov, 13:08, "Kart" <skarthike...@.bigfoot.com> wrote:
> > Hi,
> > I assume that you are asking about writing a procedure for this and not
> > a function. A function cannot update tables nor can it use getdate().
> > To do this in a procedure you can use the WAITFOR DELAY statement in
> > SQL.
> > Regards,
> > Kart
> > celerno wrote:
> > > hi, i need to create a function to do some like this...
> > > update myTable set DateModify = getdate()
> > > ... but... i need to get a minimum difference bettwen records...
> > > milisecons... or...
> > > how can i get an array or cursor (SQL server side) with 500 records
> > > with different datetime programatically?

No comments:

Post a Comment