Tuesday, March 27, 2012

auto date & time

there is an auto increment function at SQL server.
is there a function to automatically to stamp the date and time of the
record?
is it the only way to do it at application level?
thanks a lot.
TonyHi Tony,
You can set a default of getdate() on a DateTime Column an this will record
the current date and time when you insert a row
Is that what you mean?
kind regards
Greg O
Need to document your databases. Use the firs and still the best AGS SQL
Scribe
http://www.ag-software.com
"tony wong" <x34@.netvigator.com> wrote in message
news:OMlsTGxpFHA.3656@.TK2MSFTNGP09.phx.gbl...
> there is an auto increment function at SQL server.
> is there a function to automatically to stamp the date and time of the
> record?
> is it the only way to do it at application level?
> thanks a lot.
> Tony
>|||Sounds like getdate() function. Something like,
insert into table values(getdate())
or when you create a table,
create table table1 (d datetime default getdate())
Pohwan Han. Seoul. Have a nice day.
"tony wong" <x34@.netvigator.com> wrote in message
news:OMlsTGxpFHA.3656@.TK2MSFTNGP09.phx.gbl...
> there is an auto increment function at SQL server.
> is there a function to automatically to stamp the date and time of the
> record?
> is it the only way to do it at application level?
> thanks a lot.
> Tony
>|||Yes
Thanks Greg & Han
"GregO" <grego@.community.nospam> glsD:e9m7ZKxpFHA.1480@.TK2MSFTNGP10.phx.gbl...[co
lor=darkred]
> Hi Tony,
> You can set a default of getdate() on a DateTime Column an this will
> record the current date and time when you insert a row
> Is that what you mean?
>
> --
> kind regards
> Greg O
> Need to document your databases. Use the firs and still the best AGS SQL
> Scribe
> http://www.ag-software.com
> "tony wong" <x34@.netvigator.com> wrote in message
> news:OMlsTGxpFHA.3656@.TK2MSFTNGP09.phx.gbl...
>[/color]|||Here is another example:
http://www.mssql.com.au/kb/html/gmg...=psearch_articl
e_text&@.sa_id=63
"tony wong" <x34@.netvigator.com> wrote in message
news:OMlsTGxpFHA.3656@.TK2MSFTNGP09.phx.gbl...
> there is an auto increment function at SQL server.
> is there a function to automatically to stamp the date and time of the
> record?
> is it the only way to do it at application level?
> thanks a lot.
> Tony
>|||I forgot to mention smalldatetime. Generally the data type is more economic.
Pohwan Han. Seoul. Have a nice day.
"tony wong" <x34@.netvigator.com> wrote in message
news:u%23DBjNxpFHA.764@.TK2MSFTNGP14.phx.gbl...
> Yes
> Thanks Greg & Han
>
> "GregO" <grego@.community.nospam>
> glsD:e9m7ZKxpFHA.1480@.TK2MSFTNGP10.phx.gbl...
>

No comments:

Post a Comment