Any Insight on CREATE TYPE in management studio?

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • bushnellweb
    New Member
    • Jan 2010
    • 48

    Any Insight on CREATE TYPE in management studio?

    Hello, I am trying to create a data type trinary. acceptable values are -1, 0, 1. I found the CREATE TYPE code in the help menu, but cannot find a good example to help me. I am stuck at contraints. I know I need a CHECK constraint but the help makes it seem like I need to make a column contraint and I'm not sure how I implement that into the CREATE TYPE script!? any help would be greatly appreciated.
  • ck9663
    Recognized Expert Specialist
    • Jun 2007
    • 2878

    #2
    I'm not sure if there's a trinary data type in SQL Server. You might just want to create a user-defined data type. Here, read this...

    Good Luck!!!

    ~~ CK

    Comment

    • bushnellweb
      New Member
      • Jan 2010
      • 48

      #3
      obv there is no trinary data type, I've been explaining that was what i was trying to do is create a user defined data type. I need an example of someone's code that explicitly defined a new data type.

      Comment

      • ck9663
        Recognized Expert Specialist
        • Jun 2007
        • 2878

        #4
        Read the link...

        Or just add it as tinyint and create a check constraint that the only valid values are >= -1 and <= 1. Here's the link on creating constraint.

        Good Luck!!!

        ~~ CK

        Comment

        Working...