Is it possible through T-SQL to Select a non nullable column and make it nullable?
-
Friday, December 28, 2012 3:07 PM
I have this Oracle syntax which seems to make a <blank> column <NULL> and I am wondering if there's anyway to do the same kind of thing in Microsoft SQL Server. Here's the Oracle Syntax...
SELECT *
FROM ADDRESS
WHERE ADDRTYPE_WHO = '123456789 '
AND LTRIM(RTRIM(VOID)) IS NULLthis produces the same result set in Oracle...
SELECT *
FROM ADDRESS
WHERE ADDRTYPE_WHO = '123456789 '
AND VOID = ' ' (That's 1 <blank> space)I have NEVER seen anything like this and actually find it kind of obscure. But I'm forced to re-engineer an Oracle Query into SQL Server and don't know what to do in this case besides the obvious of course.
Any suggestions?
Thanks in advance for your review and am hopeful for a reply.
PSULionRP
All Replies
-
Friday, December 28, 2012 3:20 PMModerator
Check function NULLIF or CASE expression in BOL.
...
and NULLIF(VOID, ' ') IS NULL;AMB
-
Friday, December 28, 2012 3:20 PM
try
SELECT *
FROM ADDRESS
WHERE ADDRTYPE_WHO = '123456789 '
AND nullif(ltrim(rtrim(Void)),'') is null
Please mark as 'Answer', if the solution solves your problem.
-
Friday, December 28, 2012 3:27 PM
Perfect!
Thank You Much!

