Icon View Thread

The following is the text of the current message along with any replies.
Messages 1 to 7 of 7 total
Thread Best way to recreate a table if others have it open?
Sun, May 26 2013 6:25 PMPermanent Link

Barry

"If something appears to be simple, then likely you've overlooked something." Smile

I have a table called "DailyData" that gets generated once or twice a day by a Delphi program that imports CSV files and updates other tables. When that is finished it needs to generate the DailyData table which is a readonly table that is used for reporting and queries.

How do I recreate the "DailyData" table (drop and Create it) or delete all of the rows from it and insert all new rows, if someone has the table open in a Tdbgrid or a report? (This table is fairly large and will grow over time.)

The only solution I've come up with is to try and drop the table and if successful I can create it without any problems. If I can't drop the table I will generate a new table with a similar name like "DailyData_2" and store that name in a table so future queries/reports will use that table name instead of "DailyData". I will have to do the same thing if I have a view based on the "DailyData" table. I don't think I can alter a view like "ViewDailyData" to point to "DailyData_2" instead of "DailyData" if someone is using the view. So it looks like I'll have to auto-create both the table "DailyData_x" and "ViewDailyData_x" each day (and of course recycle the old table names).

Whenever the user wants to view the current daily data table, the program will have to do a lookup into a central table to get the current DailyData_x table name and ViewDailyData_x view name.

Is this the best way to handle it?

TIA
Barry
Mon, May 27 2013 3:31 AMPermanent Link

Roy Lambert

NLH Associates

Team Elevate Team Elevate

Barry


use EMPTY TABLE xxx

It seems to work - I 've just tried it with two instances of EDBManager with the table open in one, and with it being edited. The only problem I can see is that a user may die from a heart attack when he tries to scroll the table he's viewing and it vanishes - may not necessarily be a bad thing Smiley

Roy Lambert [Team Elevate]
Mon, May 27 2013 10:43 AMPermanent Link

Barry

>The only problem I can see is that a user may die from a heart attack when he tries to scroll the table he's viewing and it vanishes - may not necessarily be a bad thing Smiley<

Ah, so you finally admit working for Microsoft! Wink

Barry

Thanks btw.
Mon, May 27 2013 11:30 AMPermanent Link

Roy Lambert

NLH Associates

Team Elevate Team Elevate

Barry

>>The only problem I can see is that a user may die from a heart attack when he tries to scroll the table he's viewing and it vanishes - may not necessarily be a bad thing Smiley<
>
>Ah, so you finally admit working for Microsoft! Wink

Nope. Just thinking of some of the users I have known.

Roy
Mon, May 27 2013 12:33 PMPermanent Link

Fernando Dias

Team Elevate Team Elevate

Barry,

Users are the main problem of any developer, they shouldn't exist Smiley

--
Fernando Dias
[Team Elevate]
Mon, May 27 2013 1:11 PMPermanent Link

Roy Lambert

NLH Associates

Team Elevate Team Elevate

Fernando

>Users are the main problem of any developer, they shouldn't exist Smiley

Hmm. Its reasonable to say that all of us on these newsgroups are both developers and users. I'm willing to follow in your footsteps when you cease to exist <vbg>

Roy

ps

always assuming I can find them and that they haven't ceased to exist as well!
Mon, May 27 2013 4:36 PMPermanent Link

Fernando Dias

Team Elevate Team Elevate

Roy,

<<I'm willing to follow in your footsteps when you cease to exist <vbg>>>

Thanks for the solidarity feelings but really, there is no need because ...

I'm gonna live forever
I'm gonna learn how to fly (High)
I feel it coming together
People will see me and cry (Fame)

Smiley

--
Fernando Dias
[Team Elevate]
Image