Inserting "NULL" as a string literal into a non-nullable column works. It
even works if you append from a file containing strings with or without
quotes. This illustrates the behaviour:
CLOSE DATABASES ALL
LOCAL c, c1
c = SET("Safety")
SET SAFETY OFF
CREATE CURSOR tmp (f1 I AUTOINC NOT NULL, f2 V(10) NOT NULL)
INSERT INTO tmp (f2) VALUES ("NULL")
*!* copy and append
COPY TO tmp.csv FIELDS f2 TYPE CSV
COPY TO tmp.txt FIELDS f2 TYPE DELIMITED
APPEND FROM tmp.csv FIELDS f2 TYPE CSV
APPEND FROM tmp.txt FIELDS f2 TYPE DELIMITED
*!* Now get rid of the quotes
c1 = STRTRAN(FILETOSTR("tmp.csv"),["])
STRTOFILE(c1, "tmp.csv")
c1 = STRTRAN(FILETOSTR("tmp.txt"),["])
STRTOFILE(c1, "tmp.txt")
*!* and redo the append
APPEND FROM tmp.csv FIELDS f2 TYPE CSV
APPEND FROM tmp.txt FIELDS f2 TYPE DELIMITED
SET SAFETY &c
BROWSE NORMAL IN SCREEN

Laurie

On 17 April 2015 at 18:26, Gene Wirchenko <[email protected]> wrote:

> At 09:05 2015-04-17, Paul Hill <[email protected]> wrote:
>
> [snip]
>
>  I read this today:
>>
>>
>> http://stackoverflow.com/questions/4456438/how-do-i-correctly-pass-the-string-null-an-employees-proper-surname-to-a-so
>>
>> "We have an employee whose last name is Null. He kills our employee
>> lookup application when his last name is used as the search term
>> (which happens to be quite often now)."
>>
>
> Dear Mr. Null, ah, Hill:
>
>      Sad but amusing.  Schadenfreude, anyone?
>
>      I have sent E-mail about it to Fabian Pascal of DBDebunk.
>
>      As well as why not to use null, it also shows the danger of using
> in-band values as special values.  (In-band values are those that can be
> legitimate data values.  For example, someone could (and does) have a
> lastname of "Null".)
>
> Sincerely,
>
> Gene Wirchenko
>
>
[excessive quoting removed by server]

_______________________________________________
Post Messages to: [email protected]
Subscription Maintenance: http://mail.leafe.com/mailman/listinfo/profox
OT-free version of this list: http://mail.leafe.com/mailman/listinfo/profoxtech
Searchable Archive: http://leafe.com/archives/search/profox
This message: 
http://leafe.com/archives/byMID/profox/CAMvTR9fgXx1P8bqW28x7CvcQk3A9=JLjHWf_f=ktksxaz3z...@mail.gmail.com
** All postings, unless explicitly stated otherwise, are the opinions of the 
author, and do not constitute legal or medical advice. This statement is added 
to the messages for those lawyers who are too stupid to see the obvious.

Reply via email to