We help IT Professionals succeed at work.

select where  image data type  is null

Last Modified: 2010-03-19
What's the syntax for testing for image data type of null in a select where statement ?

When i execute a query in sql server it has 0x00 , which i believe is binary zero,

complete novice so you might need a bit of patience with me


Watch Question

if myVar is null
  print 'myVar is null'

ntext, text, and image data types will be removed in a future version of Microsoft SQL Server. Avoid using these data types in new development work, and plan to modify applications that currently use them. Use nvarchar(max), varchar(max), and varbinary(max) instead. For more information, see Using Large-Value Data Types on sql server books online.

ah, a 'select where' statement, then

select ID from myTable where myImage is null

Steve JebsonDeveloper


Except that doesn't return anything !

when i run a query that selects all and see the results in the results pane there's an 0x00 in the column, how do i test for that 'cos it appears that's not a Null but is it Binasry zero ?? if so how do i test against that ? when i select id where myImage=0 it gives me an error saying it can't test umage against tinyint
Unlock this solution and get a sample of our free trial.
(No credit card required)

after converting,

select count(*) from myTable where ImageColumn = cast(0 as varbinary(max))
Steve JebsonDeveloper


thanks, id di it the other way roun...Where Cast( [SignatureOfClient] as varbinary(max)) = 0

and thanks for other info, unfortuantely it's a db i've inherited so i can't go changing formats just yet.

thanks again.

Gain unlimited access to on-demand training courses with an Experts Exchange subscription.

Get Access
Why Experts Exchange?

Experts Exchange always has the answer, or at the least points me in the correct direction! It is like having another employee that is extremely experienced.

Jim Murphy
Programmer at Smart IT Solutions

When asked, what has been your best career decision?

Deciding to stick with EE.

Mohamed Asif
Technical Department Head

Being involved with EE helped me to grow personally and professionally.

Carl Webster
CTP, Sr Infrastructure Consultant
Empower Your Career
Did You Know?

We've partnered with two important charities to provide clean water and computer science education to those who need it most. READ MORE

Ask ANY Question

Connect with Certified Experts to gain insight and support on specific technology challenges including:

  • Troubleshooting
  • Research
  • Professional Opinions
Unlock the solution to this question.
Thanks for using Experts Exchange.

Please provide your email to receive a sample view!

*This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.


Please enter a first name

Please enter a last name

8+ characters (letters, numbers, and a symbol)

By clicking, you agree to the Terms of Use and Privacy Policy.