Convert CHAR to DATETIME

  • No, but 2012-07-29 00:05:28 does work.

  • So the output of the below returns 0 | 1

    SELECT ISDATE('2012-07-29 00:05:28.819'), ISDATE('2012-07-29 00:05:28')

  • No, 1|1 🙁

  • Now this just gets stranger every post.

    Can you provide the CREATE TABLE script for the table in question?

  • just to check...please run

    dbcc useroptions

    ________________________________________________________________
    you can lead a user to data....but you cannot make them think
    and remember....every day is a school day

  • Create Table:

    USE [MSSQL_PerfmonCollector]

    GO

    /****** Object: Table [dbo].[CounterData] Script Date: 6/08/2012 13:09:51 ******/

    SET ANSI_NULLS ON

    GO

    SET QUOTED_IDENTIFIER ON

    GO

    SET ANSI_PADDING ON

    GO

    CREATE TABLE [dbo].[CounterData](

    [GUID] [uniqueidentifier] NOT NULL,

    [CounterID] [int] NOT NULL,

    [RecordIndex] [int] NOT NULL,

    [CounterDateTime] [char](24) NOT NULL,

    [CounterValue] [float] NOT NULL,

    [FirstValueA] [int] NULL,

    [FirstValueB] [int] NULL,

    [SecondValueA] [int] NULL,

    [SecondValueB] [int] NULL,

    [MultiCount] [int] NULL,

    PRIMARY KEY CLUSTERED

    (

    [GUID] ASC,

    [CounterID] ASC,

    [RecordIndex] ASC

    )WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]

    ) ON [PRIMARY]

    GO

    SET ANSI_PADDING OFF

    GO

    dbcc useroptions output:

    Set OptionValue

    textsize2147483647

    languageus_english

    dateformatmdy

    datefirst7

    lock_timeout-1

    quoted_identifierSET

    arithabortSET

    ansi_null_dflt_onSET

    ansi_warningsSET

    ansi_paddingSET

    ansi_nullsSET

    concat_null_yields_nullSET

    isolation levelread committed

Viewing 6 posts - 16 through 20 (of 20 total)

You must be logged in to reply to this topic. Login to reply