Unix Technical Forum

Update Column with Type datetime

This is a discussion on Update Column with Type datetime within the SQL Server forums, part of the Microsoft SQL Server category; --> Hi, I want to update a column typed datetime. My statement is: update 'tablename' set Datum_Ende = '2007-12-17 08:49:04.000' ...


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

FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 03-01-2008, 03:46 PM
Thomas609@gmail.com
 
Posts: n/a
Default Update Column with Type datetime

Hi,

I want to update a column typed datetime. My statement is:

update 'tablename' set Datum_Ende = '2007-12-17 08:49:04.000' where
'columnID_name' = 23250 and 'columndate_Name' = convert(datetime,
'17.12.2007 08:08:04')

This effects an error. The Server said, the dateTime value is out of
valid Domain.

I have tried various statements like this and i think, the problem is
the blank between date and time.

Can someone help me?

Thanks

Thomas
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #2 (permalink)  
Old 03-01-2008, 03:46 PM
Dan Guzman
 
Posts: n/a
Default Re: Update Column with Type datetime

> I have tried various statements like this and i think, the problem is
> the blank between date and time.


The interpretation of this date string depends on the DATEFORMAT setting. I
suggest you use either of these 2 formats to avoid ambiguity:

'2007-12-17T08:49:04.000'
'20071217T08:49:04.000'

What is the data type of 'columndate_Name'? If the data type is other than
datetime or smalldatetime, you may get an error if the column contains
invalid datetime data.

--
Hope this helps.

Dan Guzman
SQL Server MVP

<Thomas609@gmail.com> wrote in message
news:dd9db43c-9580-4fc4-b396-f87fa2b2a7dd@w56g2000hsf.googlegroups.com...
> Hi,
>
> I want to update a column typed datetime. My statement is:
>
> update 'tablename' set Datum_Ende = '2007-12-17 08:49:04.000' where
> 'columnID_name' = 23250 and 'columndate_Name' = convert(datetime,
> '17.12.2007 08:08:04')
>
> This effects an error. The Server said, the dateTime value is out of
> valid Domain.
>
> I have tried various statements like this and i think, the problem is
> the blank between date and time.
>
> Can someone help me?
>
> Thanks
>
> Thomas


Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #3 (permalink)  
Old 03-01-2008, 03:46 PM
Madhivanan
 
Posts: n/a
Default Re: Update Column with Type datetime

On Dec 17, 1:52 pm, Thomas...@gmail.com wrote:
> Hi,
>
> I want to update a column typed datetime. My statement is:
>
> update 'tablename' set Datum_Ende = '2007-12-17 08:49:04.000' where
> 'columnID_name' = 23250 and 'columndate_Name' = convert(datetime,
> '17.12.2007 08:08:04')
>
> This effects an error. The Server said, the dateTime value is out of
> valid Domain.
>
> I have tried various statements like this and i think, the problem is
> the blank between date and time.
>
> Can someone help me?
>
> Thanks
>
> Thomas



You need to express date values in universal YYYYMMDD HH:MM:SS format
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 03:58 PM.


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