> On 13 Aug 2011, at 7:58am, matthew (matthew.jsoft) white wrote:
> 
>> I was just wondering if sq3 has some kind of mechanism to parse blank 
>> records as null instead of empty strings.

One way to do this is to import into a view and use a trigger to convert the 
rows how you like.

For example:

create table Person
(  ID integer primary key not null
,  Name text collate nocase
,  Email text collate nocase
)
;
create view Import
as
select Name, Email
from Person
;
create trigger "Import insert"
instead of insert
on Import
begin
insert into Person (Name, Email)
select
  case when Name = '' then null else Name end
, case when Email = '' then null else Email end
;
end
;

Then just import into the "Import" view instead of the table.

Tom

Tom Brodhurst-Hill
BareFeetWare

Sent from my iPhone
_______________________________________________
sqlite-users mailing list
[email protected]
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to