Hi, You can for example use autocalcualted fields to do that. Like that
CREATE TABLE Test5(STRINGFIELD VARCHAR(10) AS COALESCE(STRINGFIELD, 'Blank'),..... regards, Sergi On 24 ноя, 00:23, Lizard Lizard <[email protected]> wrote: > Is there a relatively straightforward way to specify "if this column > is null when doing an insert, use the column default value instead"? > > I have code that looks like this: > > CREATE TABLE Test5(STRINGFIELD VARCHAR(10) DEFAULT 'Blank',INTFIELD > INT DEFAULT 99, ROW_ID IDENTITY )AS SELECT STRINGFIELD,INTFIELD,NULL > from CSVREAD (C:\VARisk Cases\H2 Version Testing\Singlefield.csv) > > The entire statement is dynamically created when the user specified > field types and default values. Hard-coded triggers, etc, would be > problematic. > > For my test data, I have a CSV that looks like this: > StringField,Intfield > bob,1 > Joe,2 > Dave,4 > ,6 > Sam, > Fred,12 > , > Mary,56 > Daniel, > > I want to see "99" where there's a blank infield and "Blank" where > there's a blank StringField, but I keep getting null instead. > > Any suggestions? > -- > ======================= > Personal Blog:http://www.xanga.com/lizard_sf > Facebook:http://www.facebook.com/lizard_sf > Earth Delta:http://www.mrlizard.com/rules/54-earth-adLizard's game > of mutant mayhem using the 4e engine, no collectible cards required! -- You received this message because you are subscribed to the Google Groups "H2 Database" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/h2-database?hl=en.
