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 ...
| |||||||
| Register | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| ||||
| 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 |
| |||
| 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 > > >. > |
| |||
| 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 > > > > > >. > > |
| ||||
| 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 >> > >> > >> >. >> > > > >. > |
| Thread Tools | |
| Display Modes | |
|
|