February 17, 2009 at 7:49 am
I am developing a application in .net with sql back end.
What I am looking to do is after the insertion of record into 2 seperate tables and then make a request into another table.
How do I write a stored procedure to take the next available record from either 1 of the 2 tables or a record from each of the table depending what the requestee requires?
Any help would be great.
Mick
February 17, 2009 at 8:06 am
First the question is not so clear. So the answer might be a bit distorted. From what I understood, the last part what you want to do is a Conditional Select. If a parameter is 1 then select data from table1, if parameter = 2 then select from table2 and if parameter is 3 you want to select from both the tables. If that is the case, then you can look at Dynamic SQL.
But be very very careful when using Dynamic SQL. This could be one of your potential DB risk. SQL Injection is something you will need to worry about.
-Roy
February 17, 2009 at 2:27 pm
HI
Are you using any stored procedure to do it?? or directly have these SQLs in Application code.??
Thanks
Vijaya Kadiyala
February 18, 2009 at 4:05 am
I want to use Stored Procedures but not really sure how to write them to do what I want!
Mick
February 18, 2009 at 4:15 am
Your question is not clear. Pls give more details.
"Keep Trying"
February 18, 2009 at 4:36 am
Sorry that it is not clear I will try to explian now!
Firstly there are 2 inserts into 2 seperate tables.
A user can make a request into a 3rd table to obtain a record from either of the tables or from the both of them.
What I mean is that when i want to allocate a user request I want a Stored Procedure to work out the next avaible record from either of the table or both of the tables and asign it to the requestee.
Is this any clearer?
Mick
February 18, 2009 at 11:17 pm
Hi
Do you mean to say that user requests are stored in the 3rd table? If so What sort of info is stored in the table.
What do you mean by the next available record?
"Keep Trying"
Viewing 7 posts - 1 through 6 (of 6 total)
You must be logged in to reply to this topic. Login to reply