In stored procedure, i am using query that fetches 2 columns record but single row. i have used cursor to fetch single record.
is there any way to fetch the record and put it in variable declared without using cursor , or any syntax .
As cursor is better to fetch multiple records, but here record fetched is single row record, but the problem i am facing is how to put this value in variable. if there was a single column then it is easy to put record directly in variable. but how to deal with multiple columns in select query.
Expand|Select|Wrap|Line Numbers
- SET NOCOUNT ON
- Set @Grpdtls = CURSOR FAST_FORWARD
- for
- select vchgrouprec_id,chrGroup_Charge from mllgroup_details where intgroup_id= @lastgrpid
- Open @Grpdtls
- Fetch from @Grpdtls into @Groupcounts,@chrSubGrpCharge
- CLOSE @Grpdtls
- DEALLOCATE @Grpdtls
"D"