Unix Technical Forum

Re: Timestamp for Database

This is a discussion on Re: Timestamp for Database within the SQL Server Data Warehousing forums, part of the Microsoft SQL Server category; --> Hi Chuck, If you want to use the current date and time, you can use either the ANSI standard ...


Go Back   Unix Technical Forum > Database Server Software > Microsoft SQL Server > SQL Server Data Warehousing

Register FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 02-27-2008, 05:09 PM
Jacco Schalkwijk
 
Posts: n/a
Default Re: Timestamp for Database

Hi Chuck,

If you want to use the current date and time, you can use either the ANSI
standard CURRENT_TIMESTAMP() or the T-SQL proprietary GETDATE() function.
Timestamp is indeed a confusing name, and there is an alias for it,
rowversion, that describes it's purpose far better.

--
Jacco Schalkwijk MCDBA, MCSD, MCSE
Database Administrator
Eurostop Ltd.


"Chuck" <chuckvu@hotmail.com> wrote in message
news:003601c36808$6d46f620$a501280a@phx.gbl...
>
> I need to create a timestamp every time I load data. One
> timestamp (date) for each batch of new data. I researched
> the timestamp function in T-SQL but it is a unique value
> for each record. Do you know how to address this issue?
> The data I add are updated records. I want to be able to
> maintain a data history.
>
> Thanks
> Chuck



Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #2 (permalink)  
Old 02-27-2008, 05:09 PM
Chuck
 
Posts: n/a
Default Re: Timestamp for Database

Thanks for the tip. The problem is the timestamp in getdate
() function is dynamic. It keeps changing. How do I make
it fixed value at the time I load the data?

Thanks
Chuck

>-----Original Message-----
>Hi Chuck,
>
>If you want to use the current date and time, you can use

either the ANSI
>standard CURRENT_TIMESTAMP() or the T-SQL proprietary

GETDATE() function.
>Timestamp is indeed a confusing name, and there is an

alias for it,
>rowversion, that describes it's purpose far better.
>
>--
>Jacco Schalkwijk MCDBA, MCSD, MCSE
>Database Administrator
>Eurostop Ltd.
>
>
>"Chuck" <chuckvu@hotmail.com> wrote in message
>news:003601c36808$6d46f620$a501280a@phx.gbl...
>>
>> I need to create a timestamp every time I load data. One
>> timestamp (date) for each batch of new data. I

researched
>> the timestamp function in T-SQL but it is a unique value
>> for each record. Do you know how to address this issue?
>> The data I add are updated records. I want to be able to
>> maintain a data history.
>>
>> Thanks
>> Chuck

>
>
>.
>

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #3 (permalink)  
Old 02-27-2008, 05:09 PM
Russell Fields
 
Posts: n/a
Default Re: Timestamp for Database

Chuck,

It depends on how you are loading the data (as they always say).

Logically speaking:

SELECT @MyLoadDateTime = GETDATE()

INSERT INTO MyTable VALUES( ..., @MyLoadDateTime)

Since you probably have a bit of a process going on to load the
datawarehouse, you could have a LoadState table which includes useful values
for your load process. One column of that table could be the MyLoadDate.
You would set that at the beginning of your process and include it in alll
INSERTs (and UPDATEs?) until the process is finished.

Russell Fields


"Chuck" <chuckvu@hotmail.com> wrote in message
news:0ae201c368ae$24c2f2e0$a501280a@phx.gbl...
> Thanks for the tip. The problem is the timestamp in getdate
> () function is dynamic. It keeps changing. How do I make
> it fixed value at the time I load the data?
>
> Thanks
> Chuck
>
> >-----Original Message-----
> >Hi Chuck,
> >
> >If you want to use the current date and time, you can use

> either the ANSI
> >standard CURRENT_TIMESTAMP() or the T-SQL proprietary

> GETDATE() function.
> >Timestamp is indeed a confusing name, and there is an

> alias for it,
> >rowversion, that describes it's purpose far better.
> >
> >--
> >Jacco Schalkwijk MCDBA, MCSD, MCSE
> >Database Administrator
> >Eurostop Ltd.
> >
> >
> >"Chuck" <chuckvu@hotmail.com> wrote in message
> >news:003601c36808$6d46f620$a501280a@phx.gbl...
> >>
> >> I need to create a timestamp every time I load data. One
> >> timestamp (date) for each batch of new data. I

> researched
> >> the timestamp function in T-SQL but it is a unique value
> >> for each record. Do you know how to address this issue?
> >> The data I add are updated records. I want to be able to
> >> maintain a data history.
> >>
> >> Thanks
> >> Chuck

> >
> >
> >.
> >



Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #4 (permalink)  
Old 02-27-2008, 05:10 PM
Chuck
 
Posts: n/a
Default Re: Timestamp for Database

Hi Russell:

That answers my question. Thanks

Chuck

>-----Original Message-----
>Chuck,
>
>It depends on how you are loading the data (as they

always say).
>
>Logically speaking:
>
>SELECT @MyLoadDateTime = GETDATE()
>
>INSERT INTO MyTable VALUES( ..., @MyLoadDateTime)
>
>Since you probably have a bit of a process going on to

load the
>datawarehouse, you could have a LoadState table which

includes useful values
>for your load process. One column of that table could be

the MyLoadDate.
>You would set that at the beginning of your process and

include it in alll
>INSERTs (and UPDATEs?) until the process is finished.
>
>Russell Fields
>
>
>"Chuck" <chuckvu@hotmail.com> wrote in message
>news:0ae201c368ae$24c2f2e0$a501280a@phx.gbl...
>> Thanks for the tip. The problem is the timestamp in

getdate
>> () function is dynamic. It keeps changing. How do I make
>> it fixed value at the time I load the data?
>>
>> Thanks
>> Chuck
>>
>> >-----Original Message-----
>> >Hi Chuck,
>> >
>> >If you want to use the current date and time, you can

use
>> either the ANSI
>> >standard CURRENT_TIMESTAMP() or the T-SQL proprietary

>> GETDATE() function.
>> >Timestamp is indeed a confusing name, and there is an

>> alias for it,
>> >rowversion, that describes it's purpose far better.
>> >
>> >--
>> >Jacco Schalkwijk MCDBA, MCSD, MCSE
>> >Database Administrator
>> >Eurostop Ltd.
>> >
>> >
>> >"Chuck" <chuckvu@hotmail.com> wrote in message
>> >news:003601c36808$6d46f620$a501280a@phx.gbl...
>> >>
>> >> I need to create a timestamp every time I load data.

One
>> >> timestamp (date) for each batch of new data. I

>> researched
>> >> the timestamp function in T-SQL but it is a unique

value
>> >> for each record. Do you know how to address this

issue?
>> >> The data I add are updated records. I want to be

able to
>> >> maintain a data history.
>> >>
>> >> Thanks
>> >> Chuck
>> >
>> >
>> >.
>> >

>
>
>.
>

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Forum Jump


All times are GMT. The time now is 04:30 AM.


Powered by vBulletin® Version 3.6.5
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
SEO by vBSEO 3.2.0
www.UnixAdminTalk.com