How could it work? 
Author Message
 How could it work?

Quote:

> Suppose you have tables like this:
>   table_1                tmp_store              tmp_article
> +---------+----------+ +---------+----------+ +---------+----------+
> | name    | type     | | name    | type     | | name    | type     |
> +---------+----------+ +---------+----------+ +---------+----------+
> | dat     | date     | | dat     | date     | | dat     | date     |
> | store   | char     | | article | char     | | store   | char     |
> | article | char     | | price   | money    | | price   | money    |
> | price   | money    | | amount  | smallint | | amount  | smallint |
> | amount  | smallint | +---------+----------+ +---------+----------+
> +---------+----------+

> and an insert like this:
> insert into table_1 values ( '08/04/2002', 'aldi', 'hmilch', 0.57, 3 );

> Is it possible for each insert
> 1. verify if a table exists with the name of the (store|article)
>    if yes
>        a. insert the relevant data
>    if no
>        a. create a table (store|article) like (tmp_store|tmp_article)
>        b. insert the relevant data

> I was reading about triggers and functions, but I havn't found an answer
> how to create tables in triggers or in functions.

Umm, why create tables? Why not have a table with all the stores and a table
with all the articles? I think your database needs a little more design, as
the number of tables should remain almost constant during normal usage.

Besides, lots of small tables is rather in efficient.

HTH,

--

Quote:
> Ignorance continues to thrive when intelligent people choose to do
> nothing.  Speaking out against censorship and ignorance is the imperative
> of all intelligent people.

---------------------------(end of broadcast)---------------------------
TIP 6: Have you searched our list archives?

http://www.***.com/



Sat, 25 Sep 2004 19:04:54 GMT
 
 [ 1 post ] 

 Relevant Pages 

1. SQL Cluster working/MS Cluster not working

2. Insert that works in query does not work as sp

3. Install SQL 7 Eval on Win 95, did work, now no work

4. Named Pipes stops working but TCP/IP works

5. begin works and commit works in

6. Trigger works but doesn't work

7. Formerly WORKING database no longer working - HELP???????

8. Jobs don't work via SQL Agent but work when run ad hoc

9. Why does this code work/Not work?

10. Query works in SQL Query Analyzer but doesn't work in DTS

11. XP_sendmail Does'nt work while normal mailing works

12. JDBC not working with tomcat 4 / works on command line


 
Powered by phpBB® Forum Software