Home > Archive > MS SQL Server New Users > November 2005 > Nulls Varchar and NVarChar









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author Nulls Varchar and NVarChar
aaj

2005-11-25, 7:24 am

Hello All

While using VB6, ADO 2.8, and SQL Server 2000 I've come across an odity that
I haven't been able to track an answer down on.

I wonder if anyone here can help

I have a string array called elecrical details and I write an element to a
SQLServer 2000 database i.e.

.AddNew
!RCD_PartNumber = electrical_details(1
5, record)

If I use VARCHAR in the database table and electrical_details(1
5, record) =
"" then a null value is created in the datatable (as I would hope)

If I use NVARCHAR in the database and electrical_details(1
5, record) = ""
then the update fails on a multi step error.

If electrical_details(1
5, record) has any text in then both NVARCHAR and
VARCHAR both work.

in all cases I have the column RCD_PartNumber set to allow NULLS

Obviously I can can catch the length of electrical_details(1
5, record) and
not write that particular column, but I am interested as to why VARCHAR and
NVARCHAR should behave differently

many thanks in advance

Andy



Sponsored Links





Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive | Programming forum archive

Copyright 2008 droptable.com