|
Subject:
|
In Cursor set and execute statement related proble
|
|
Posted By:
|
param99
|
Post Date:
|
12/15/2006 1:55:09 AM
|
Hi friends
I want to execute the procedure which is as shown below '''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''' CREATE procedure xyz(@refno as varchar(25),@Type as varchar(15)) as set nocount on Create Table #tbl_xyz ( 'some fileds )
Set @Tempcode=0 Declare xyz_cursor Cursor for Set @sql1 = 'Select a,b c and d like ''' + @labrefno + ''' order by e ' + @Type
exec sp_executesql @sql1
Open xyz_cursor
Fetch next from xyz_cursor into some values While @@Fetch_status=0 BEGIN ''''''''' BEGIN END
'''''''''''''' '''''''''''''' '''''''''''''' Close xyz_cursor Deallocate xyz_cursor select * from #tbl_xyz
''''''''''''''''''''''''''''''''''''''''''''' In the execution of above procedure , it won't allow me to set any value under the cursor declaration and even if execute under the cusor and i want to perform this procedure by passing the '@refno' and '@Type' dynamically as a parameter .
Is there any solution regarding this , then please guide me.
Thanks Param
|
|