SQLServer and empty strings


DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

Results 1 to 3 of 3

Thread: SQLServer and empty strings

  1. #1
    Join Date
    Jun 2005
    Posts
    1

    Question SQLServer and empty strings

    I am writing a C++ application using ADO to manage an SQL Server dbase.
    The database is set to compatibility version 80.
    If I set an nvarchar field to an empty string ""; it is stored in the dbase as a
    single space string: " ". I need it to be an empty string in the dbase so I can distinguish between an empty string and a single space string.

    I am using the SQLOLEDB connector. According to the help that came with SQL Enterprise manager, if the dbase is set to compatibility level 70 or 80 then
    "The empty string literal (' ') is interpreted as an empty string."
    But it does not to make a difference.

    Thanks,

    JBird

  2. #2
    Join Date
    Feb 2004
    Posts
    16
    I know this sounds silly, but your c++ code doesnt have a space between the ''s does it? make sure in your code you are placing '' and not ' ' ...

  3. #3
    Join Date
    Nov 2004
    Location
    Huddinge, Sweden
    Posts
    283
    Use the SQL Profiler to see what the SQL that's submitted actually looks like.

    Rune
    If you hit a brick wall, you didn't jump high enough!

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