Is there a way to check for the existence of a row for the purpose of doing an insert only once without resorting to Java code? In TSQL I would do something like: if not exists (select * from FinancialCalculatedNumberTypes where Description = 'Other Payables') insert into FinancialCalculatedNumberTypes (FinancialCalculatedNumberTypeID, Description) Values (32, 'Other Payables') GO
I realize the H2 merge statement can do something similar. However, many of my tables have identity on the primary key and I can't get merge to work without specifying the primary key identity value before hand, which defeats the convenience of identity. On Tue, Mar 3, 2009 at 2:42 PM, Thomas Mueller <[email protected] > wrote: > > Hi, > > > Does H2 SQL support a general if-else construct? I see that it does > > support if in the context of table create/drop, but I need something > > generally available to conditionally execute any H2 sql. > > Sorry, this is not supported. You could create a Java function that > executes a SQL statement (see CREATE ALIAS in the documentation). > > Regards, > Thomas > - Show quoted text - > > > > --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
