Subject Res: [firebird-support] INSERT Multiple Rows same SQL Statment
Author Luis Carlos Junges
>Well, not exactly asking, just trying to help :)

Well... you and Farias helped a lot... now it worked :) Thanks.




---
Luís Carlos Dill Junges ©

"A realidade de cada lugar e de cada época é uma alucinação coletiva."
Bloom, Howard







----- Mensagem original ----
De: Sasha Matijasic <selectnull@...>
Para: firebird-support@yahoogroups.com
Enviadas: Quarta-feira, 24 de Setembro de 2008 12:16:34
Assunto: RE: [firebird-support] INSERT Multiple Rows same SQL Statment


>
> >Those are constants. Something like this:
>
> >insert into ...
> >select 'foo', 42 from rdb$database ...
>
> You are asking me to do something like this:
>
> SQL> insert into
> tbcurrencyquotes( basecurrency, quotecurrency, currencyquoteyea r,
> price) select 'AUD','USD', 2009,2 from tbcurrencyquotes union all select
> 'BRL','U
> SD',2009,4 from tbcurrencyquotes;
>
> it does not give any error, but also not insert nothing.
>

Well, not exactly asking, just trying to help :)

Notice rdb$database in my example. It's a system table guaranteed to have exactly one row. The columns of that table are not important for this, since you will not be selecting any of them.
So, try this query:

select 'USD', 'EUR', 2008, 0.93 from rdb$database union all
select 'BLR', 'AUD', 2007, 0.93 from rdb$database;

You will get 2 rows with 4 columns. Right?

Now, do this:

insert into tbcurrencyquotes( basecurrency, quotecurrency, currencyquoteyea r,price)
select 'USD', 'EUR', 2008, 0.93 from rdb$database union all
select 'BLR', 'AUD', 2007, 0.93 from rdb$database;

Those 2 rows will be inserted into tbccurrencyquoutes table.

Sasha




Novos endereços, o Yahoo! que você conhece. Crie um email novo com a sua cara @... ou @....
http://br.new.mail.yahoo.com/addresses

[Non-text portions of this message have been removed]