column

  • Hello Everyone,

    I am new to this (especially T-sql).I need to define a column in a table.I can use either varchar or char ,but my condition is positions 1-4 alpha prefix,position 5-8 numeric,9-12 alphabetic??how to give that condition in defining the column??

  • Dear Swekik,

    Try this:

    CREATE TABLE TableName (Field VARCHAR(12) CHECK (Field LIKE '[a-z][a-z][a-z][a-z][0-9][0-9][0-9][0-9][a-z][a-z][a-z][a-z]'))

    cheers 😛

  • Why don't you have three fields?

  • It is Identification number like 'ABC123456YZ' ,1st three alpha numneric,nxt 6 digits like numeric,nxt 2 digits like alphabets

Viewing 4 posts - 1 through 3 (of 3 total)

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