On 21-Oct-2011 09:31 , Mike Wills wrote:
<<SNIP>> I am doing an insert into a daily file I create in the same
process (TRANYYMMDD). So each day has a new file name. Can I create a
stored procedure where the table name is dynamic? How would I do
that?


While I personally would not choose to create a new object, instead just new data being tracked to the day, I can still offer an example showing one possibility to effect the daily TABLE creation:

<code>

create procedure newdailypf
language sql
set option dbgview=*LIST
begin
declare stmttext char(2000);
set stmttext =
'create table TRAN'
concat right( replace( char(current date, ISO), '-', ''), 6)
concat '( a int not null '
concat ', b char(38) '
concat '/* ... */ '
concat ', paymenttime for paytime TIME '
concat ', q varchar(20) '
concat ', s int '
concat ')' ;
execute immediate stmttext ;
end

</code>

Regards, Chuck

As an Amazon Associate we earn from qualifying purchases.

This thread ...

Replies:

Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].

Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.