Re: Date Conversion

From: Sarah (skingswell_at_donotreply.com)
Date: 02/27/04


Date: Fri, 27 Feb 2004 11:44:37 -0000

The problem that I am having is the format of the date because if I actually
look at the Date values in the table with the enterprise manager they are in
the same format as the @tempdate variable

25/05/2004

but the select query returns 2004-05-25 00:00:00. This is why I am
converting the select results. I still cannot get this working.

"Hari" <hari_prasad_k@hotmail.com> wrote in message
news:OUg2CeR$DHA.1452@TK2MSFTNGP09.phx.gbl...
> Hi,
>
> Infact you dont require a conversion in that place, because it seems the
> Date field in the table is datetime datatype and @tempdate variable also a
> datetime datype.
> In this case you dont require a convert.
>
> Incase you need to convert please use 101 instead of 103.
>
> Thanks
> Hari
> MCDBA
>
> "Sarah" <skingswell@donotreply.com> wrote in message
> news:u6RnNUR$DHA.220@TK2MSFTNGP09.phx.gbl...
> > I need some help with Date Conversions. I am getting the following
error
> > when I run the query below.
> >
> > The conversion of a char data type to a datetime data type resulted in
an
> > out-of-range datetime value.
> >
> > declare @inputdate char(10)
> > declare @tempdate datetime
> > declare @validdate char(10)
> >
> > SET @inputdate = '15/05/2004'
> >
> > SET @tempdate = (SELECT convert (char(10), Date, 103) FROM [The
> Company -
> > Dev$Base Calendar Change]
> > WHERE Date = @InputDate and Nonworking = '1')
> > if @tempdate is not null
> > SET @validdate = '0' else SET @validdate = '1'
> > select @validdate
> >
> >
>
>



Relevant Pages

  • Re: Dates
    ... I have never ever had any problems with a date in ISO 8601 format. ... The conversion of a char data type to a datetime data type resulted in an out-of-range datetime value. ... System.Data.Common.DbDataAdapter.FillFromReader(Object data, String srcTable, IDataReader dataReader, Int32 startRecord, Int32 maxRecords, DataColumn parentChapterColumn, Object parentChapterValue) +260 ...
    (microsoft.public.dotnet.framework.aspnet)
  • Re: Oh... no....
    ... select castas datetime) ... Obviously it would be better to use the "standard" format. ... Pro SQL Server 2000 Database Design ... >> data type of the date_variable in stored proc have been set to char ...
    (microsoft.public.sqlserver.programming)
  • Re: Searching on DATETIME Fields
    ... format since it is stored internally as numeric data. ... Another option your might consider is to pass the value as a datetime ... >> Tibor Karaszi, SQL Server MVP ... >>> The field I am querying is of DATETIME data type, ...
    (microsoft.public.sqlserver.server)
  • Re: dateTime Manupulations
    ... Notice the quoted string, a specific format for a date & time. ... will need to convert that string into a DateTime. ... > datetime conversion between strings, however it was a datetime conversion ...
    (microsoft.public.dotnet.languages.vb)
  • Re: Insert DateTime Value In DB Table?
    ... Is the date format whch you are trying to insert the same ... The data type of the column named "DOB" in the ... DB table is "datetime" which means SQL ...
    (microsoft.public.dotnet.framework.aspnet)