لدي إجراء مخزن استخدم فيه CURSOR كالتالي
DECLARE Product_Id_Cursor CURSOR FOR SELECT Product_Id FROM Product open Product_Id_Cursor -- FETCH NEXT FROM Product_Id_Cursor into @Product_Id WHILE @@FETCH_STATUS = 0 BEGIN select * from emplyee where id=@Product_Id FETCH NEXT FROM Product_Id_Cursor into @Product_Id END -- CLOSE Product_Id_Cursor DEALLOCATE Product_Id_Cursor
أردت الأن في جملة
SELECT Product_Id FROM Product
أن أضيف شرط ولكن هذا الشرط متغيير حيث أقوم بإرسالة من البرنامج في المتغيير
@str
ويحمل قيمة مثلا
where Product_Id in(1,2,3)
كيف يمكن أن أضيف هذا الشرط المتغيير لجملة select في CURSOR ???
شكرا