I got it

cyt (会飞的鹿)
When I try to simplify the question :

DECLARE @empId VARCHAR

SET @empId ='RD11'

SELECT report_number FROM navsys.personal_exp_report_table
WHERE employee_id = 'RD11' order by report_number

select @empID

SELECT report_number FROM navsys.personal_exp_report_table
WHERE employee_id = @empId order by report_number

I got :

report_number
-------------
8
9
10
11
12
13
14
15
16

(9 row(s) affected)


----
R

(1 row(s) affected)

report_number
-------------

(0 row(s) affected)

So What I need to do is to re-declare
DECLARE @empId VARCHAR(30)

Thanks for all your attention anyway.
(#263688@0)
2001-11-16 -05:00

回到话题: Is there anybody who has the experience with SQL Server's Stored Procedure and cousor? Please come in.

回到论坛: HOME枫下论坛枫下论坛主坛工作学习IT技术讨论

URL:   
http://www.rolia.net/zh/post.php?f=0&p=263688