Help With Stored Procedure

This is a discussion on Help With Stored Procedure within the MySQL Database forums, part of the Database Forums category; Hello everyone. I am new to mySQL, so I am hoping someone might be able to help me. We have ...


Go Back   Usenet Forums > Database Forums > MySQL Database

FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 10-15-2007
Smitty
 
Posts: n/a
Default Help With Stored Procedure

Hello everyone. I am new to mySQL, so I am hoping someone might be
able to help me. We have a table in our database, which has a table
Ticket Priorities, which only contains 3 columns...User_ID, Ticket_ID
and Priority. This table basically houses all support personnel and
the support tickets assigned to each, and the priority of each
ticket. Example:

USER_ID Ticket_ID Priority
12345 006234 1
12345 006266 5
12345 006523 2
12345 006258 3
..
..
..
The application has a Priority screen, displaying the tickets for each
user in a list, ordered by priority. Our manager can log into the
tool, and reorganize the priority's by moving the ticket number up or
down using an up/down arrow. Every time the priority is moved, I need
a stored procedure to change the Priority number in the database. For
example, if a ticket with priority 5 is moved up 2 places in the list,
I need the procedure to change the 5 to a 3, and shift the rest of the
numbers down. Not sure if I explained this properly or not. Any
ideas? Thanks everyone

Reply With Quote
  #2 (permalink)  
Old 10-16-2007
lark
 
Posts: n/a
Default Re: Help With Stored Procedure

== Quote from Smitty (marksmithy69@hotmail.com)'s article
> Hello everyone. I am new to mySQL, so I am hoping someone might be
> able to help me. We have a table in our database, which has a table
> Ticket Priorities, which only contains 3 columns...User_ID, Ticket_ID
> and Priority. This table basically houses all support personnel and
> the support tickets assigned to each, and the priority of each
> ticket. Example:
> USER_ID Ticket_ID Priority
> 12345 006234 1
> 12345 006266 5
> 12345 006523 2
> 12345 006258 3
> .
> .
> .
> The application has a Priority screen, displaying the tickets for each
> user in a list, ordered by priority. Our manager can log into the
> tool, and reorganize the priority's by moving the ticket number up or
> down using an up/down arrow. Every time the priority is moved, I need
> a stored procedure to change the Priority number in the database. For
> example, if a ticket with priority 5 is moved up 2 places in the list,
> I need the procedure to change the 5 to a 3, and shift the rest of the
> numbers down. Not sure if I explained this properly or not. Any
> ideas? Thanks everyone


you explained it ok.

you need an sp that takes in as input parameters 3 values:
user_id
ticket_id
changed_priority_orig
changed_priority_new

you can lookup the basics of stored procedures on mysql's website; however, this
is what it should do
1-it takes the values mentioned above
2-it updates the record that has changed to changed_priority_new based on
changed_priority_orig
3-if the new priority is already existing in the dataset for that user_id, it then
needs to be updated to changed_priority_orig

i believe this should do it.
--
POST BY: lark with PHP News Reader
Reply With Quote
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are Off
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT +1. The time now is 09:11 AM.


Powered by vBulletin® Version 3.7.3
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO 3.0.0