Help me with syntax ? How do I know whether a particular table type exists

  • So I declared this table data type , cool.. It works

    CREATE TYPE BP_Data_XXX

    as table

    (

    XXX_VALUE_NUMERIC numeric(19,2),

    bp_type VARCHAR(4),

    Dt datetime,

    ID int IDENTITY(1,1),

    MBP numeric(19,2),

    CONCEPT_ID VARCHAR(10)

    )

    Now my question is later how do we check whether this type exists. I need help with syntax.

    The following does not work.

    if( object_id('BP_Data_XXX') IS NOT NULL )

    print 'IT is there '

  • I don't believe custom types will show up in object_id, try.

    IF EXISTS(SELECT * FROM sys.types WHERE name = 'BP_Data_XXX')

Viewing 2 posts - 1 through 2 (of 2 total)

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