Re: DateTime

Tech-Archive recommends: Fix windows errors by optimizing your registry

From: Tibor Karaszi (tibor_please.no.email_karaszi_at_hotmail.nomail.com)
Date: 07/02/04


Date: Fri, 2 Jul 2004 08:50:16 +0200

http://www.karaszi.com/SQLServer/info_datetime.asp

-- 
Tibor Karaszi, SQL Server MVP
http://www.karaszi.com/sqlserver/default.asp
http://www.solidqualitylearning.com/
"Niles" <Niles@discussions.microsoft.com> wrote in message
news:ABC7EAEA-A16B-42D9-84B7-A1B4FE9710DB@microsoft.com...
> Well, this is a vendor product.  you're right, I don't want to change the language The tables are
already created and i can't make any changes to the front end.  It is a european vendor.  The system
came with an MSDE database.  I am trying to switch it to an enterprise version of sql 2000.  When I
made the switch, data wasn't being written to the main table.  After running a trace, I noticed that
the insert to that table was failing because the datetime that was being inserted was in European
format and the datetime field was rejecting that.  Changing the data type to varchar allowed the
insert but I don't want to keep it as varchar obviously.  Can this issue be fixed with some change
to the Datetime field (like some formula or something), any other suggestions? I am not sure where
to use set dateformat
> thanks
>
>
> "Gregory A. Larsen" wrote:
>
> > I'm not sure what you are trying to do, but I don't think you want to mess
> > with your language setting.  The "set language" command is only in affect
> > for the session.   What I really think you need is to use the "set
> > dateformat" statement to control the format of your input data.   Sorry for
> > the confusion.  Something like this:
> >
> >
> > create table x(d datetime)
> > set dateformat dmy
> > insert into x values ('30/06/2002')
> > set dateformat mdy
> > insert into x values ('09/30/2002')
> > select * from x
> > drop table x
> >
> >
> > -- 
> >
> > ----------------------------------------------------------------------------
> > ----------------------------------------------------------------------------
> > ----
> >
> > Need SQL Server Examples check out my website at
> > http://www.geocities.com/sqlserverexamples
> > "Niles" <Niles@discussions.microsoft.com> wrote in message
> > news:5F4A1DCC-329E-4232-8661-26212099F305@microsoft.com...
> > > does the set language command do that at the server level or database
> > level or table level or field level?
> > > can I change the datetime field in my db table to accept european time?
> > >
> > > "Gregory A. Larsen" wrote:
> > >
> > > > Have you check what the dateformat for the language you are using.  You
> > can
> > > > do this by issuing the following command:
> > > >
> > > > sp_helplanguage @@language
> > > >
> > > > If you want a different format then your langauge format you can change
> > it
> > > > by using the SET DATEFORMAT.
> > > >
> > > > Here is an example of where I used two different language.  In these
> > > > examples us_english like mm/dd/yyyy format and British like dd/mm/yyyy.
> > > > Hopefully this will give you some ideas on how to fix you problem.
> > > >
> > > > set language us_english
> > > > exec sp_helplanguage @@language
> > > > create table x(d datetime)
> > > > insert into x values ('30/06/2002')
> > > > insert into x values ('09/30/2002')
> > > > select * from x
> > > > drop table x
> > > >
> > > > set language  British
> > > > exec sp_helplanguage @@language
> > > > create table x(d datetime)
> > > > insert into x values ('30/06/2002')
> > > > insert into x values ('09/30/2002')
> > > > select * from x
> > > > drop table x
> > > > -- 
> > > >
> > >
> > > --------------------------------------------------------------------------
> > --
> > >
> > > --------------------------------------------------------------------------
> > --
> > > > ----
> > > >
> > > > Need SQL Server Examples check out my website at
> > > > http://www.geocities.com/sqlserverexamples
> > > > "Niles" <Niles@discussions.microsoft.com> wrote in message
> > > > news:164CBB03-BCA1-41DB-96A9-6739B33547F7@microsoft.com...
> > > > > I have an application that is sending the date with the following
> > format
> > > > dd/mm/yyyy the field in the table in sql is a datetime and the record is
> > not
> > > > being inserted.  If I manually change the value in the query analyzer to
> > > > mm/dd/yyyy the record is inserted successfully.  How can I change the
> > data
> > > > type to accept the values as is
> > > > >
> > > > > Thanks
> > > >
> > > >
> > > >
> >
> >
> >


Relevant Pages

  • Re: General .Net Question
    ... I contend very difficult to just jump in and learn, and the SQL Server ... development using Java. ... A/E/C Consulting, Web Design, e-Commerce Software Development ... >> Language Specification). ...
    (microsoft.public.dotnet.framework.aspnet)
  • Re: FTS for particular language
    ... John, ... installed SQL Server with Arabic or Latin collation. ... While your default FT Language ... >> regardless of Arabics). ...
    (microsoft.public.sqlserver.fulltext)
  • Re: Why cant recursive queries contain...?
    ... Triggers would be events, stored procs would be functions, views would be linq statements, tables would be collections etc. Imagine writing your application in C# and stepping through code and straight into a C# stored proc ... You can definitely use C# as a front end for a database; in fact, people do exactly this every day when they write .NET Windows and Web client applications. ... C# would probably make a better native language for an object-oriented database as opposed to a database derived from the relational model though. ... "Expert SQL Server 2008 Encryption" ...
    (microsoft.public.sqlserver.programming)
  • Re: Why plural table names? (Celko)
    ... > language, would you name an array of Employee objects 'Employee'? ... Pro SQL Server 2000 Database Design - ... >> I hope you are kidding:) I know you CAN think that way, ...
    (microsoft.public.sqlserver.programming)
  • Re: How to read a table record by record and process and update another table
    ... When you use sql server, your stored procedures are the t-sql language. ... Of course, using ms-access, we have been spoiled, and for 10+ years have ...
    (microsoft.public.access.macros)