Solved

nText field pulling blank records when I use Is Not Null

Posted on 2006-11-17
16
666 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
Revamp Your Training Process

Drastically shorten your training time with WalkMe's advanced online training solution that Guides your trainees to action.

 
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

Instantly Create Instructional Tutorials

Contextual Guidance at the moment of need helps your employees adopt to new software or processes instantly. Boost knowledge retention and employee engagement step-by-step with one easy solution.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
push and Pull replication 31 48
SQL Syntax 6 41
Access 2010 - Issue Viewing Records Added to a Linked SQL Table 13 50
Need to replicate a Log table 4 10
When you hear the word proxy, you may become apprehensive. This article will help you to understand Proxy and when it is useful. Let's talk Proxy for SQL Server. (Not in terms of Internet access.) Typically, you'll run into this type of problem w…
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…
This videos aims to give the viewer a basic demonstration of how a user can query current session information by using the SYS_CONTEXT function
Via a live example, show how to set up a backup for SQL Server using a Maintenance Plan and how to schedule the job into SQL Server Agent.

733 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