hamid-nic
جمعه 25 تیر 1389, 20:30 عصر
سلام دوستان ، وقتتان بخیر
در یک SP ساده مثل زیر :
set ANSI_NULLS ON
set QUOTED_IDENTIFIER ON
go
ALTER Procedure [dbo].[sp_check_code]
@code varchar(10)
As
IF Exists (SELECT * FROM dbo.Personel WHERE Code = @Code)
Begin
Print 'کد وارد شده تکراري است'
Return (1);
End Else
Begin
Return (0);
Print 'کد وارد شده جديد است'
End
نسخه ی استاندارد بدون مشکل آن را اجرا می کند اما در نسخه ی Enterprise که در یک سرور 2003 (Enterprise) نصب شده از آن خطای زیر را می گیرد .
Msg 137, Level 15, State 2, Procedure sp_check_code, Line 6
Must declare the scalar variable "@Code".
Msg 156, Level 15, State 1, Procedure sp_check_code, Line 10
Incorrect syntax near the keyword 'Else'.
به نظر شما علت چی می تونه باشه ؟ و کد صحیح اون برای اجرا شدن در نسخه ی سرور باید به چی تغییر کنه ؟
ممنون
در یک SP ساده مثل زیر :
set ANSI_NULLS ON
set QUOTED_IDENTIFIER ON
go
ALTER Procedure [dbo].[sp_check_code]
@code varchar(10)
As
IF Exists (SELECT * FROM dbo.Personel WHERE Code = @Code)
Begin
Print 'کد وارد شده تکراري است'
Return (1);
End Else
Begin
Return (0);
Print 'کد وارد شده جديد است'
End
نسخه ی استاندارد بدون مشکل آن را اجرا می کند اما در نسخه ی Enterprise که در یک سرور 2003 (Enterprise) نصب شده از آن خطای زیر را می گیرد .
Msg 137, Level 15, State 2, Procedure sp_check_code, Line 6
Must declare the scalar variable "@Code".
Msg 156, Level 15, State 1, Procedure sp_check_code, Line 10
Incorrect syntax near the keyword 'Else'.
به نظر شما علت چی می تونه باشه ؟ و کد صحیح اون برای اجرا شدن در نسخه ی سرور باید به چی تغییر کنه ؟
ممنون