Solved

nText field pulling blank records when I use Is Not Null

Posted on 2006-11-17
16
676 Views
Last Modified: 2008-01-09
Is there something else I can use to check this?  I have a linked SQL table in access.  The SQL field is a ntext field.  When I run a query and say Is Not Null it is still in some cases pulling a blank record.  Thanks all
0
Comment
Question by:sbornstein2
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 9
  • 6
16 Comments
 
LVL 29

Expert Comment

by:Nightman
ID: 17967487
Is the record blank or null?
Check whether or not it is an empty string    column=''.
Or perhaps it has been padded RTRIM(column)=''.
0
 

Author Comment

by:sbornstein2
ID: 17967557
ya well I tried in access "Is Not Null and <> """.  But I get an error when I say the <> "" in access against that field.
0
 

Author Comment

by:sbornstein2
ID: 17967576
it is blank I beleive
0
Visualize your virtual and backup environments

Create well-organized and polished visualizations of your virtual and backup environments when planning VMware vSphere, Microsoft Hyper-V or Veeam deployments. It helps you to gain better visibility and valuable business insights.

 
LVL 29

Expert Comment

by:Nightman
ID: 17967616
Blank is not null, but empty string. Do you have access to Query Analyser?

If so, run this:

SELECT * FROM yourTable WHERE RTRIM(YourColumn)=''
0
 

Author Comment

by:sbornstein2
ID: 17967766
I cant access Query Analyzer right now unfortunatly.  I can only link to the table.  It is showing in design a memo field converting the SQL field Text to say that.  But I return approx 10 or so records that are showing my text field as blank in the query when using the Is Not Null only.
0
 
LVL 29

Expert Comment

by:Nightman
ID: 17967786
Then those records are not null, but probably empty string.

Post your query here and I'll see if I can modify it for you.
0
 
LVL 28

Expert Comment

by:imran_fast
ID: 17971126
hi,
Is it showng <logn text> in enterprise manager? Can you verify that?
0
 

Author Comment

by:sbornstein2
ID: 17974875
it is just showing blank in Enterprise Manager and I dont want to change the datatype to a varchar(4000) etc. because it is setup using replication right now. I dont want to mess with that.
0
 
LVL 29

Expert Comment

by:Nightman
ID: 17974882
So run this query in Query Analyser:
SELECT COUNT(*) FROM yourTable WHERE RTRIM(YourColumn)=''

What does that return?
0
 

Author Comment

by:sbornstein2
ID: 17974895
anytime I use the '' it never works on a Text field.  I am in SQL now and it is not ntext it is a text field.  Your query above returns:

Server: Msg 8116, Level 16, State 2, Line 1
Argument data type text is invalid for argument 1 of rtrim function.

I open the table and it is showing blank or an empty string.
0
 
LVL 29

Accepted Solution

by:
Nightman earned 125 total points
ID: 17974904
Do this then
SELECT COUNT(*) FROM yourTable WHERE RTRIM(CAST(YourColumn as nvarchar(4000)))=''
0
 

Author Comment

by:sbornstein2
ID: 17974915
4850 rows out of about 9K.  So looks like there is quite alot.
0
 

Author Comment

by:sbornstein2
ID: 17974916
should I try an update to Null on these?
0
 

Author Comment

by:sbornstein2
ID: 17974921
ya that worked I did an update to null where those came up and it now works.  Thanks for your help though.  I wonder what I can do for the future for this other than changing the datatype
0
 
LVL 29

Expert Comment

by:Nightman
ID: 17974937
Identify how it became '' in the first place. i.e. prevent unexpected data from coming in to your database from the UI by validating it.

Good to see it's working now.
0
 

Author Comment

by:sbornstein2
ID: 17974939
yup thanks Nightman.
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Everyone has problem when going to load data into Data warehouse (EDW). They all need to confirm that data quality is good but they don't no how to proceed. Microsoft has provided new task within SSIS 2008 called "Data Profiler Task". It solve th…
In the first part of this tutorial we will cover the prerequisites for installing SQL Server vNext on Linux.
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 different Recovery Models available in SQL Server and explain, as well as show how full, differential and transaction log backups are performed

696 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