do table types support default constraints?

  • I'm trying to create a table type that has columns w/ default values and i'm running into issues. Is this not supported?

  • What problem are you facing?

    This works:

    CREATE TYPE SomeTableType AS TABLE

    ( SomeID int IDENTITY(1,1)

    , SomeValue Varchar(10)

    , SomeDate datetime DEFAULT GETDATE());

    GO

    DECLARE @test-2 AS SomeTableType;

    INSERT INTO @test-2 (SomeValue) VALUES ('ABC');

    SELECT * FROM @test-2;

    GO

    DROP TYPE SomeTableType

    Luis C.
    General Disclaimer:
    Are you seriously taking the advice and code from someone from the internet without testing it? Do you at least understand it? Or can it easily kill your server?

    How to post data/code on a forum to get the best help: Option 1 / Option 2

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

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