SQLTeam.com | Weblogs | Forums

Two Seperate servers appear to deal with null values differently

#1

Afternoon all,

I'm pulling my hair out here, I have 2 completely seperate servers both set up with MS SQL 2008 R2. Think of them as testserver1 & testserver2. I have a test database (as far as I can tell identically) setup on them both.
Employees table consists of:
EmpID Int notnull primarykey
Branch varchar(20) null
FirstName varchar(20) null
SurName varchar(20) null

Employees Table Data consists of:
EmpID Branch FirstName Surname
1000 London Jane Doe
1001 London John Smith
1002 null Dan Brown

So, from SSMS if you execute 'SELECT * FROM Employees' you
get exactly what you'd expect:

EmpID Branch FirstName Surname
1000 London Jane Doe
1001 London John Smith
1002 null Dan Brown

Right, here is where it gets rather odd... I have a small VB.NET application I wrote which displays the above table. If i run it on testserver1 i get:

EmpID Branch FirstName Surname
1000 London Jane Doe
1001 London John Smith
1002 null Dan Brown

However if i run it on testserver2 i get:

EmpID Branch FirstName Surname
1000 London Jane Doe
1001 London John Smith

After a bit of testing testserer2 completely ignores which ever record has a 'null' branch. If I have a null value for either firstname or surname its fine with that, its only the 'Branch' field it doesn't like being 'null'.

Can anyone shed any rhyme or reason as to this odd behavour...?

Thanks

Dave

#2

Right click on database and see properties. On the left pane go to Options. Show us that please?

1 Like
#3

Hey,

Thanks for your reply & apologies for my late reply, I've been on a different project for a few days... Weirdly I restarted the server and its all working as expected. I have no idea as to what the problem might have been. I'll keep an eye out and see if any weirdness returns...

Thanks

Dave

#4

restart fixed it? Maybe a Windows hotfix ?