Link to home
Start Free TrialLog in
Avatar of Steve Jebson
Steve JebsonFlag for United Kingdom of Great Britain and Northern Ireland

asked on

select where image data type is null

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

thanks

Steve
Avatar of MrRobot
MrRobot
Flag of Türkiye image

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

=)
Avatar of Steve Jebson

ASKER

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
ASKER CERTIFIED SOLUTION
Avatar of MrRobot
MrRobot
Flag of Türkiye image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
after converting,

select count(*) from myTable where ImageColumn = cast(0 as varbinary(max))
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.