Stephen Russell wrote:
> Cursors are very heavy in SQL processing and should only be used when there
> is NO OTHER possible way.
>   

I've heard that, but I'm not sure that something else can work here.  I 
was going to create a cursor which basically is "SELECT iid FROM 
LOCATION" and then cycle through that record set and insert records into 
the Inventory table. 

> I would use GUIDs instead of ints as keys.  Sure they are big and ugly but
> they work really well!
>   

I know GUIDs are unique and allow for much easier "mixing" of data, but 
I never felt as comfortable with them, as they give me a headache to 
look at when inspecting data visually.  Yeah, I know...lame answer.  
Plus there's some purist part of me that felt better with a shorter type 
and some old rumor about integers processing faster.  Probably not true 
any more (if ever) but that's the rumor stuck in my head.

> Secondly I would never mix up the keys in the 44/3 manner.  Why should you
> need the reference for the product in the location?  You already have that
> in the Inventory.
>   

No, I didn't mean to represent that as literally "44/3"...there will be 
2 fields...one for iProductID and one for iLocationID.

> You need a pair of insert statements with your Product insert.
>
> <http://dev.mysql.com/doc/refman/5.0/en/using-triggers.html>
>
> Looks like a straight shot to do them in mySQL.  syntax is very similar in
> SQL Server.
>   

Yes, I've been there and am using the triggers.  The task at hand though 
is to create an inventory record for iProductID and iLocationID.  These 
are a unique (candidate) key for the Inventory table.

> I would use the After insert instead of Before insert in case your schema
> has a dependency on an existing "product"
>
>   

Yes, all triggers are using the AFTER instead of the BEFORE.

Thanks,
--Michael



_______________________________________________
Post Messages to: [email protected]
Subscription Maintenance: http://leafe.com/mailman/listinfo/profox
OT-free version of this list: http://leafe.com/mailman/listinfo/profoxtech
Searchable Archive: http://leafe.com/archives/search/profox
This message: http://leafe.com/archives/byMID/profox/[EMAIL PROTECTED]
** All postings, unless explicitly stated otherwise, are the opinions of the 
author, and do not constitute legal or medical advice. This statement is added 
to the messages for those lawyers who are too stupid to see the obvious.

Reply via email to