Sending null strings and NULL values 
Author Message
 Sending null strings and NULL values

I have a stored procedure that takes on a few varchars.  I set my parameters
up and one of my string parameters is "" in VB.  I set the value and then
the len to 0 and I get error 3708 back which says "Inconsistent parameter
value" or something along those lines.

I find NO way to send a null string or even a NULL value.

Anyone find the err of my ways????

Thanks



Mon, 04 Apr 2005 06:16:31 GMT  
 Sending null strings and NULL values
in the ado command send it NULL if the String = "" it
should work unless the DB has a constraint of not null.

Quote:
>-----Original Message-----
>I have a stored procedure that takes on a few varchars.  I
set my parameters
>up and one of my string parameters is "" in VB.  I set the
value and then
>the len to 0 and I get error 3708 back which says

"Inconsistent parameter
Quote:
>value" or something along those lines.

>I find NO way to send a null string or even a NULL value.

>Anyone find the err of my ways????

>Thanks

>.



Mon, 04 Apr 2005 06:36:56 GMT  
 Sending null strings and NULL values
The Size property of the Parameter object must be at least one (for
strings).

Bruce


Quote:
> I have a stored procedure that takes on a few varchars.  I set my
parameters
> up and one of my string parameters is "" in VB.  I set the value and then
> the len to 0 and I get error 3708 back which says "Inconsistent parameter
> value" or something along those lines.

> I find NO way to send a null string or even a NULL value.

> Anyone find the err of my ways????

> Thanks



Mon, 04 Apr 2005 08:11:06 GMT  
 Sending null strings and NULL values
Bruce,

Then how in the heck do you clear out a column that has some data in it???

Kevin


Quote:
> The Size property of the Parameter object must be at least one (for
> strings).

> Bruce



> > I have a stored procedure that takes on a few varchars.  I set my
> parameters
> > up and one of my string parameters is "" in VB.  I set the value and
then
> > the len to 0 and I get error 3708 back which says "Inconsistent
parameter
> > value" or something along those lines.

> > I find NO way to send a null string or even a NULL value.

> > Anyone find the err of my ways????

> > Thanks



Mon, 04 Apr 2005 10:32:22 GMT  
 Sending null strings and NULL values
and what do you set the size to?  I'm passing these parameters to a stored
procedure.


Quote:
> in the ado command send it NULL if the String = "" it
> should work unless the DB has a constraint of not null.

> >-----Original Message-----
> >I have a stored procedure that takes on a few varchars.  I
> set my parameters
> >up and one of my string parameters is "" in VB.  I set the
> value and then
> >the len to 0 and I get error 3708 back which says
> "Inconsistent parameter
> >value" or something along those lines.

> >I find NO way to send a null string or even a NULL value.

> >Anyone find the err of my ways????

> >Thanks

> >.



Mon, 04 Apr 2005 10:33:02 GMT  
 Sending null strings and NULL values
If your column allows Nulls you could set your parameter value to Null
otherwise you could set it to "".    You could set the size to 6 and the
parameter value to "      " it would be the same thing.

A varchar is a variable-length column which automatically truncates trailing
spaces.  Your length would be 0 (sql server anyway no experience with other
db's but I imagine they would be the same).

Bruce


Quote:
> Bruce,

> Then how in the heck do you clear out a column that has some data in it???

> Kevin



> > The Size property of the Parameter object must be at least one (for
> > strings).

> > Bruce



> > > I have a stored procedure that takes on a few varchars.  I set my
> > parameters
> > > up and one of my string parameters is "" in VB.  I set the value and
> then
> > > the len to 0 and I get error 3708 back which says "Inconsistent
> parameter
> > > value" or something along those lines.

> > > I find NO way to send a null string or even a NULL value.

> > > Anyone find the err of my ways????

> > > Thanks



Mon, 04 Apr 2005 12:47:23 GMT  
 Sending null strings and NULL values
Kevin,

You would need declare your parameter in VB code with EXACT same size as you
have in your stored procedure. then set Value property of your parameter to
Null

If MyString="" then
    MyParameter.Value=Null
else
   MyParameter.Value=MyString
endif

--
Val Mazur
Microsoft MVP


Quote:
> I have a stored procedure that takes on a few varchars.  I set my
parameters
> up and one of my string parameters is "" in VB.  I set the value and then
> the len to 0 and I get error 3708 back which says "Inconsistent parameter
> value" or something along those lines.

> I find NO way to send a null string or even a NULL value.

> Anyone find the err of my ways????

> Thanks



Mon, 04 Apr 2005 20:35:11 GMT  
 Sending null strings and NULL values
Bruce,

The type of column I'm dealing with is Text.  If I set the value to Null (in
the case of the column accepting Null values), what do you set the length
to?

Thanks,

Kevin


Quote:
> If your column allows Nulls you could set your parameter value to Null
> otherwise you could set it to "".    You could set the size to 6 and the
> parameter value to "      " it would be the same thing.

> A varchar is a variable-length column which automatically truncates
trailing
> spaces.  Your length would be 0 (sql server anyway no experience with
other
> db's but I imagine they would be the same).

> Bruce



> > Bruce,

> > Then how in the heck do you clear out a column that has some data in
it???

> > Kevin



> > > The Size property of the Parameter object must be at least one (for
> > > strings).

> > > Bruce



> > > > I have a stored procedure that takes on a few varchars.  I set my
> > > parameters
> > > > up and one of my string parameters is "" in VB.  I set the value and
> > then
> > > > the len to 0 and I get error 3708 back which says "Inconsistent
> > parameter
> > > > value" or something along those lines.

> > > > I find NO way to send a null string or even a NULL value.

> > > > Anyone find the err of my ways????

> > > > Thanks



Mon, 04 Apr 2005 23:11:38 GMT  
 Sending null strings and NULL values
Like I said before, set it to 1 or 6 or 2147483647
(default size of a Text parameter) if you like.

Are you having problems with this? What provider are you
using?

Bruce

Quote:
>-----Original Message-----
>Bruce,

>The type of column I'm dealing with is Text.  If I set

the value to Null (in
Quote:
>the case of the column accepting Null values), what do
you set the length
>to?

>Thanks,

>Kevin



>> If your column allows Nulls you could set your

parameter value to Null
Quote:
>> otherwise you could set it to "".    You could set the
size to 6 and the
>> parameter value to "      " it would be the same thing.

>> A varchar is a variable-length column which

automatically truncates
Quote:
>trailing
>> spaces.  Your length would be 0 (sql server anyway no
experience with
>other
>> db's but I imagine they would be the same).

>> Bruce



>> > Bruce,

>> > Then how in the heck do you clear out a column that
has some data in
>it???

>> > Kevin



>> > > The Size property of the Parameter object must be
at least one (for
>> > > strings).

>> > > Bruce


message

>> > > > I have a stored procedure that takes on a few
varchars.  I set my
>> > > parameters
>> > > > up and one of my string parameters is "" in VB.  
I set the value and
>> > then
>> > > > the len to 0 and I get error 3708 back which
says "Inconsistent
>> > parameter
>> > > > value" or something along those lines.

>> > > > I find NO way to send a null string or even a
NULL value.

>> > > > Anyone find the err of my ways????

>> > > > Thanks

>.



Wed, 06 Apr 2005 03:52:45 GMT  
 
 [ 9 post ] 

 Relevant Pages 

1. Differences between NULL, Empty String, Null String?

2. How can I pass NULL value to WinAPI which is expecting a NULL pointer

3. Null Null Null!!!!!!!!!

4. Null, Null, Null!

5. double null question [2 * Null = Null] !!!

6. Send a <NULL> value

7. SQL Update - Sending Null values

8. ASSIGN STRING NULL VALUE?

9. Reading null values from a string

10. how to handle NULL values from a FORM when using date string functions - help please

11. sending strings with embedded nulls to serial port

12. how to handle NULL values from a FORM when using date string functions - help please

 

 
Powered by phpBB® Forum Software