07-25-2005 01:31 PM
07-25-2005 04:04 PM
Ok;
You can't insert and select data at the same time. I have a lot of experience with databases and there is always a way to get things done. What is the nature of the "data collisions" that you are wanting to avoid? Multiple systems inserting into the same table?
Mike...
07-26-2005 05:52 AM
07-26-2005 07:40 AM
Yes, a stored procedure will certainly do what you need but it has the disadvantage of making you dependent upon support from IT if the SP doesn't work or needs to change. I can think of two simplier approaches:
In general, I prefer solutions that are not dependent upon any particular vendor's tools or features--like auto generated keys. Make your SQL as non-DBMS specific as you can and in the long run you'll have a lot fewer problems.
Alternately, you could move all your lower-level database access into an application server. In brief, an application server functions as an intermediate layer between your applications and the database. It's function is to hide from your code the specifics of exactly how the database communications takes place, and so isolate your code from changes in the database platform, structure or location. Such a structure benefits applications from a lot of different directions but is probibly beyond the scope of this answer. If you're interested contact me directly and I can fill you in on the details.
Mike...
07-26-2005 09:29 AM
Thanks Mike! I wasn't even thinking of Transactions. I tested it out and it works great. I agree about generating the value and sending it to the DB, but we can't change at this point. We are still planning on setting up a stored procedure at some point but this gives me some breathing room until that time.
Tim