?
Solved

0 being treat as Null value

Posted on 2004-11-15
7
Medium Priority
?
486 Views
Last Modified: 2008-03-17
I have a VB application that copies data from a table on server A to a table on server B. Whenever the value to be copied from server A is 0 it is written to server B as a Null value. I have tested the application on another PC (using different SQL servers) but cannot replicate the problem (the value is correctly written as a 0).

Is there a setting in SQL Server that treats values of 0 as Null values? If there is how do I turn it off?

Thanks,

Louise
0
Comment
Question by:louiserutherford
  • 4
  • 2
7 Comments
 
LVL 18

Accepted Solution

by:
ShogunWade earned 1000 total points
ID: 12583804
There is no such setting.   It must be a difference in your code.
0
 
LVL 18

Expert Comment

by:ShogunWade
ID: 12583810
can you post us the code and the DDL for the tables
0
 

Author Comment

by:louiserutherford
ID: 12583878
I'm using exactly the same code, and have even tried using the same data. On one set of severs it works fine, on the other set it writes nulls.

There is too much code to post.

If there is no setting that writes null instead of zero then I will test the code further and hopefully replicate the problem on my test server.
0
NEW Veeam Agent for Microsoft Windows

Backup and recover physical and cloud-based servers and workstations, as well as endpoint devices that belong to remote users. Avoid downtime and data loss quickly and easily for Windows-based physical or public cloud-based workloads!

 
LVL 50

Expert Comment

by:Lowfatspread
ID: 12583889
yes and confirm that no triggers are involved.
0
 
LVL 18

Expert Comment

by:ShogunWade
ID: 12583905
Are you definately inserting the value 0 or are you inserting a NULL with is intepreted as a 0.   (in the case of the latter this could be a DEFAULT (0) on the column)
0
 

Author Comment

by:louiserutherford
ID: 12584096
Thank you both for your help. The problem was in the code. I was using the IsEmpty() function which appears to read 0 as empty! I have changed the code and it is working fine.
I have no idea why it was working with one set of servers but not the other.
0
 
LVL 18

Expert Comment

by:ShogunWade
ID: 12584106
your welcome.
0

Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In this article we will learn how to fix  “Cannot install SQL Server 2014 Service Pack 2: Unable to install windows installer msi file” error ?
What if you have to shut down the entire Citrix infrastructure for hardware maintenance, software upgrades or "the unknown"? I developed this plan for "the unknown" and hope that it helps you as well. This article explains how to properly shut down …
This video shows, step by step, how to configure Oracle Heterogeneous Services via the Generic Gateway Agent in order to make a connection from an Oracle session and access a remote SQL Server database table.
Using examples as well as descriptions, and references to Books Online, show the documentation available for date manipulation functions and by using a select few of these functions, show how date based data can be manipulated with these functions.
Suggested Courses

840 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question