3

Looking for explanations for an error in a db insert, or update, I was told the problem is a customer name like:"BOB NULL-Creations".

What I have read about NULL doesn't allow me to accept that explanation so easily.

However I have been wrong about other things before.

Is it ever possible for the string 'NULL' to ever be interpreted as a NULL value in a situation where it is part of a string?

A little more information The data is being ultimately viewed on an iPad so I am told the NULL breaks on the iPad deserilization

I would like to better understand that if someone has a link related this possibility.

datatoo
  • 1,919
  • 2
  • 20
  • 26
  • Since there is a space there it is possible the system would think it to be the keyword NULL if you ever have issues with quotations around the string. Otherwise, it's very unlikely you will run into NULL-related issues from this. – David Starkey Mar 04 '13 at 23:51
  • Depends on the situation, programming language, etc. Can you give us more info on your situation? – Aehmlo Mar 04 '13 at 23:51
  • I don't think you'll ever run into that problem, though, as long as things are quoted properly. – Aehmlo Mar 04 '13 at 23:52
  • "The data is being ultimately viewed on an iPad so I am told the NULL breaks on the iPad deserilization" I suspect the problem is the iPad client then, and you should investigate that :) – Patashu Mar 05 '13 at 00:12
  • 1
    No, the word "NULL" properly quoted in a string should never be interpreted as a NULL value. However, when asking DBMS-related questions, you *really* should add the tag for the specific DBMS you're using, as syntax and features vary between them (sometimes in major ways). – Ken White Mar 05 '13 at 00:17
  • 1
    To me it looks like a massive hole for SQL injection... – rodrigo Jun 29 '13 at 23:40
  • I agree with @rodrigo - if you have an application that is recognizing `'NULL'` as `NULL`, it'll probably also recognize `';DROP TABLE USERS;'` in a not-very-funny way. –  Jun 29 '13 at 23:42

1 Answers1

1

No, the string 'NULL' or "NULL" can never be mistaken for NULL. All programming languages will read 'NULL' or "NULL" as a series of characters.

Dan Bray
  • 5,616
  • 3
  • 43
  • 51