Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
Author |
Topic |
wsilage
Yak Posting Veteran
82 Posts |
Posted - 2014-03-05 : 15:03:26
|
I have a person who's last name is actually NULL. How can I fix this so his last name pulls in my reports and not being actually blank.Select Distinct[PCS Number],[Last Name],[First Name],[Address 1]FROM [vw_All_Products]Now I have two others that have the last name NULL as well and they are showing up.DAVE NULL, LIZ, NULL AND CHRIS NULL. Chris Null is the one that is showing up with a blank Last name.The last name field is varchar. |
|
tkizer
Almighty SQL Goddess
38200 Posts |
Posted - 2014-03-05 : 15:32:50
|
I think the difference is that those 2 that are showing up are actually named NULL, whereas Chris's last name doesn't have a value (is null). Check this out:Select Distinct[PCS Number],[Last Name],[First Name],[Address 1]FROM [vw_All_Products]where [Last Name] = 'NULL'Select Distinct[PCS Number],[Last Name],[First Name],[Address 1]FROM [vw_All_Products]where [Last Name] IS NULLSo what do you want it to show up as?Tara KizerSQL Server MVP since 2007http://weblogs.sqlteam.com/tarad/ |
|
|
maunishq
Yak Posting Veteran
71 Posts |
Posted - 2014-03-06 : 11:09:09
|
If there is no last name for that particular person in your database, then how can you pull it? It shows NULL means there is no entry for that. Using the query provided by tkizer please check if the last name exist for those persons.=======================Not an Expert, Just a learner.!_(M)_! |
|
|
wsilage
Yak Posting Veteran
82 Posts |
Posted - 2014-03-07 : 08:08:55
|
I Checked in the database and the last name is in there. There Persons last name is actually Null. My query that I run doesn't recogonize the persons name and things it is a null field, but it isn't. |
|
|
tkizer
Almighty SQL Goddess
38200 Posts |
Posted - 2014-03-07 : 11:55:52
|
You'll need to show us some sample data then.Tara KizerSQL Server MVP since 2007http://weblogs.sqlteam.com/tarad/ |
|
|
|
|
|
|
|