Question about User Defined Data types

  • I need all value in some of my columns to be alphanumeric with a length between 2 and 9. Some of these columns need to nullable while others should not be.

    These columns are currently varchar(9).

    Should I create a user defined data type for it and alter those columns. Or should I use LEN(Column) > 1 check constraints instead?

    Can I define the nullability of these columns when altering them to a user defined data type or do I need to define nullabilty for it when creating the data type.

    These tables have more write traffic to them than read traffic, is there a performance difference between the check constraint and the user defined data type?

  • If you think for CLR datatype, I'd say definitely not. You would add quite a bit of overhead. CRL Datatypes may be great when you need complex validation, but not for simple tasks as length between 2 and 9. For that, use other methods, like check constraint.



    Ole Kristian Velstadbråten Bangås - Virinco - Facebook - Twitter

    Concatenating Row Values in Transact-SQL[/url]

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

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