VB5 EE, SQL Server 6.5, stored procedures adding a value of 0, not null. 
Author Message
 VB5 EE, SQL Server 6.5, stored procedures adding a value of 0, not null.

I've written a stored procedure in Microsoft SQL Server 6.5, which I use to
store some values into a table, however I do not store values for all of the
fields in the table (intentionally) when I call this stored procedure to insert
a new record into the table.

One of the fields in this table is called InvoiceNumber and is a smallint (SQL
Server terminology).  It has no default value.  The InvoiceNumber field is one
of the fields I do NOT specify when performing the INSERT via the stored
procedure.  However, we've discovered that this field is getting values of 0
(zero) whenever my stored procedure is called to insert a new record.

Why?  I honestly thought that if a new record was inserted into a table, then
any field which is nullable would get a value of Null, why is this field
getting a value of 0???

Rod
--
Rod Falanga                     |  Any opinions expressed, or implied,
UNM's Alb. Metro Central Intake |  are mine alone.  They do not represent my
842-1730                        |  employer's opinions or policies.



Fri, 22 Oct 1999 03:00:00 GMT  
 VB5 EE, SQL Server 6.5, stored procedures adding a value of 0, not null.

There are two places in your system where you set whether a field is
supposed to be nullable or defaulted, etc.

1) In the definition of the table when use the CREATE TABLE ... etc or the
Server Manager. This I assume is what you've done

2) In the definition of stored procedure, you specify again what parameters
can be nullable and what can be defaulted.  My guess is you have something
like:



as nullable, so the above should be:



values are NULL.

        -- Rehan --



Quote:

> One of the fields in this table is called InvoiceNumber and is a smallint
(SQL
> Server terminology).  It has no default value.  The InvoiceNumber field
is one
> of the fields I do NOT specify when performing the INSERT via the stored
> procedure.  However, we've discovered that this field is getting values
of 0
> (zero) whenever my stored procedure is called to insert a new record.

> Why?  I honestly thought that if a new record was inserted into a table,
then
> any field which is nullable would get a value of Null, why is this field
> getting a value of 0???

> Rod
> --



Sat, 23 Oct 1999 03:00:00 GMT  
 
 [ 2 post ] 

 Relevant Pages 

1. Stored Procedures with VB5/SQL Server 6.5

2. VB5 EE, SQL/Server 6.5, Win NT

3. Return value from stored procedure in SQL 6.5 to VB4 to a 16 bits client

4. Return a value from stored procedure in SQL 6.5 to VB4 to a 16 bits client

5. VB4 and SQL Server 6.5, Null values

6. executing SQL Server 6.5 stored procedure using VB 5

7. S10008 Error From SQL Server 6.5 Running VB 5.0 Stored Procedures

8. VB 5.0 & Stored Procedure (SQL Server 6.5)

9. S10008 Error From SQL Server 6.5 Running VB 5.0 Stored Procedures

10. S10008 Error From SQL Server 6.5 Running VB 5.0 Stored Procedures

11. SQL 6.5 stored procedure - parameter not returning

12. Locking in VB5 and SQL Server 6.5 using stored procs

 

 
Powered by phpBB® Forum Software