Re: datetime problem

From: Aaron Bertrand - MVP (aaron_at_TRASHaspfaq.com)
Date: 05/07/04


Date: Fri, 7 May 2004 10:11:40 -0400

Thanks for the reprimand, but I did read all of your post. Recall that I
said "Sounds like"... in other words, you might have been mistaken, or
looking at the wrong column.

You forgot to mention what type of data connection you were using. I
assumed OLEDB, but if you are using an ODBC driver you might see truncation.

My suggestion: why are you making .Net send the current time at all? The
database knows the current time, and you can avoid a lot of problems by
removing those calculations from the app and improve efficiency by not
having to pass the additional data across the network. First, take out that
parameter statement. Next, remove the @date parameter from the stored
procedure, and remove the column from both sides of the insert statement.
Next, change the table definition:

ALTER TABLE tblEvents??? -- I guess once for each language
     ALTER COLUMN [date] DATETIME NOT NULL DEFAULT GETDATE()

(Do you really need the seconds? Time of day even? Are you sure you want
to keep using reserved words for column names? And redundant prefixes like
tbl?)

How many language tables do you have?

-- 
Aaron Bertrand
SQL Server MVP
http://www.aspfaq.com/
"Owen" <anibal@prensa-latina.cu> wrote in message
news:#ak8SrDNEHA.1644@TK2MSFTNGP09.phx.gbl...
> You don't read my all post, because I wrote that the type in table is a
> Datatime with length 8.
>
> thanks any way.
>
> "Aaron Bertrand [MVP]" <aaron@TRASHaspfaq.com> wrote in message
> news:epsO3s7MEHA.2976@TK2MSFTNGP10.phx.gbl...
> > Sounds like the [date] column (poor name choice, by the way) is of
> > SMALLDATETIME type, which will round off any seconds/ms to the minute.
> >
> > -- 
> > Aaron Bertrand
> > SQL Server MVP
> > http://www.aspfaq.com/


Relevant Pages

  • Re: Find the first available integer.
    ... by being in simple recovery model). ... using a real server with a real disk system, and if you insert a reasonable ... Aaron Bertrand ... SQL Server MVP ...
    (microsoft.public.sqlserver.programming)
  • Re: back to referring page
    ... were a direct result of my fingers and brain not being synchronized or my ... "Aaron Bertrand - MVP" wrote in message ... > SQL Server MVP ... >> lack of caffeine. ...
    (microsoft.public.inetserver.asp.general)
  • Re: Trigger for tracking moddate & moduser
    ... update as many rows as were affected by the original statement. ... (SELECT primaryKey FROM Inserted) ... >> Aaron Bertrand ... >> SQL Server MVP ...
    (microsoft.public.sqlserver.programming)
  • Re: Timer function
    ... Can you show the EXACT error message you received (including the 0x800xxxxx ... >> Aaron Bertrand ... >> SQL Server MVP ... >>> I am having a problem calling the Timer function. ...
    (microsoft.public.inetserver.asp.general)
  • Re: HTTP 500 - Internal Server Error - on a Non-Default Web Site
    ... Why are you using ODBC!? ... >>Aaron Bertrand ... >>SQL Server MVP ... >>> C2 Security Settings implemented on the server. ...
    (microsoft.public.inetserver.asp.general)

Loading