DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

+ Reply to Thread
Results 1 to 2 of 2
  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

Bookmarks

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


Top DevX Stories

Easy Web Services with SQL Server 2005 HTTP Endpoints
JavaOne 2005: Java Platform Roadmap Focuses on Ease of Development, Sun Focuses on the "Free" in F.O.S.S.
Wed Yourself to UML with the Power of Associations
Microsoft to Add AJAX Capabilities to ASP.NET
IBM's Cloudscape Versus MySQL


Sponsored Links