CREATE PROCEDURE dbo.proFormDropDown
(@FormType As VARCHAR(5))
AS
SET NOCOUNT ON
CREATE TABLE #tbl_hold_menu (
menu_num VARCHAR(2),
menu_name VARCHAR(20),
form_type CHAR(1))
INSERT INTO #tbl_hold_menu(menu_num, menu_name, form_type)
SELECT dept_id, dept_desc,dept_menu_type
FROM tbl_dept
ORDER BY dept_desc
INSERT INTO #tbl_hold_menu(menu_num, menu_name, form_type)
SELECT job_id, job_title, job_menu_type FROM tbl_job
WHERE job_menu_type <>'0'
ORDER BY job_menu_type
INSERT INTO #tbl_hold_menu(menu_num, menu_name, form_type)
SELECT shift_num, shift_name, menu_type
FROM tbl_shift
ORDER BY shift_num
INSERT INTO #tbl_hold_menu(menu_num, menu_name, form_type)
SELECT work_team_id, work_team_name, 'T'
FROM tbl_work_team
ORDER BY work_team_name
SELECT * FROM #tbl_hold_menu
WHERE form_type = @FormType
ORDER BY form_type
DROP TABLE #tbl_hold_menu
(@FormType As VARCHAR(5))
AS
SET NOCOUNT ON
CREATE TABLE #tbl_hold_menu (
menu_num VARCHAR(2),
menu_name VARCHAR(20),
form_type CHAR(1))
INSERT INTO #tbl_hold_menu(menu_num, menu_name, form_type)
SELECT dept_id, dept_desc,dept_menu_type
FROM tbl_dept
ORDER BY dept_desc
INSERT INTO #tbl_hold_menu(menu_num, menu_name, form_type)
SELECT job_id, job_title, job_menu_type FROM tbl_job
WHERE job_menu_type <>'0'
ORDER BY job_menu_type
INSERT INTO #tbl_hold_menu(menu_num, menu_name, form_type)
SELECT shift_num, shift_name, menu_type
FROM tbl_shift
ORDER BY shift_num
INSERT INTO #tbl_hold_menu(menu_num, menu_name, form_type)
SELECT work_team_id, work_team_name, 'T'
FROM tbl_work_team
ORDER BY work_team_name
SELECT * FROM #tbl_hold_menu
WHERE form_type = @FormType
ORDER BY form_type
DROP TABLE #tbl_hold_menu
No comments:
Post a Comment