Home > Archive > MS SQL Server > October 2006 > How to update a filed with today









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author How to update a filed with today
ad

2006-10-24, 6:31 pm

I have a talbe, there is a smallDateTime field in it.
I want to update this filed with today's date.
How can I do?


Tom Moreau

2006-10-24, 6:31 pm

Try:

update MyTable
set
MyCol = convert (char (8), getdate (), 112)
where
...

--
Tom

----------------------------------------------------
Thomas A. Moreau, BSc, PhD, MCSE, MCDBA, MCITP, MCTS
SQL Server MVP
Toronto, ON Canada
..
"ad" <flying@wfes.tcc.edu.tw> wrote in message
news:O4dx3$o3GHA.1252@TK2MSFTNGP04.phx.gbl...
I have a talbe, there is a smallDateTime field in it.
I want to update this filed with today's date.
How can I do?


Hari Prasad

2006-10-24, 6:31 pm

Hi,

You could also use function CURRENT_TIMESTAMP

Update table
set col1=CURRENT_TIMESTA
MP
Where ...

Thanks
Hari
SQL Server MVP


"Tom Moreau" <tom@dont.spam.me.cips.ca> wrote in message
news:ezfzfQp3GHA.1300@TK2MSFTNGP05.phx.gbl...
> Try:
>
> update MyTable
> set
> MyCol = convert (char (8), getdate (), 112)
> where
> ...
>
> --
> Tom
>
> ----------------------------------------------------
> Thomas A. Moreau, BSc, PhD, MCSE, MCDBA, MCITP, MCTS
> SQL Server MVP
> Toronto, ON Canada
> .
> "ad" <flying@wfes.tcc.edu.tw> wrote in message
> news:O4dx3$o3GHA.1252@TK2MSFTNGP04.phx.gbl...
> I have a talbe, there is a smallDateTime field in it.
> I want to update this filed with today's date.
> How can I do?
>
>



Sponsored Links





Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive | Programming forum archive

Copyright 2009 droptable.com