Best practice for required varchars


DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

Results 1 to 2 of 2

Thread: Best practice for required varchars

  1. #1
    Michael Culley Guest

    Best practice for required varchars

    Using SQLServer I can set fields as required but with the string field it is
    still possible to insert an empty string. I can create a check constraint
    that checks to make sure the length is greater than zero but this is a
    hassle for every required varchar field. Is there some alternative.

    Cheers
    --
    Michael Culley
    www.vbdotcom.com





  2. #2
    jy Guest

    Re: Best practice for required varchars


    "Michael Culley" <m_culley@hotmail.com> wrote:
    >Using SQLServer I can set fields as required but with the string field it

    is
    >still possible to insert an empty string. I can create a check constraint
    >that checks to make sure the length is greater than zero but this is a
    >hassle for every required varchar field. Is there some alternative.
    >
    >Cheers
    >--
    >Michael Culley
    >www.vbdotcom.com
    >
    >
    >
    >

    one possibility, if you can live with all fields being the same length, is
    to create your own user-defined type ( based on varchar() )& bind an appropriate
    rule to this type. jy

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center
 
 
FAQ
Latest Articles
Java
.NET
XML
Database
Enterprise
Questions? Contact us.
C++
Web Development
Wireless
Latest Tips
Open Source


   Development Centers

   -- Android Development Center
   -- Cloud Development Project Center
   -- HTML5 Development Center
   -- Windows Mobile Development Center