| Author |
Topic |
|
aakcse
Aged Yak Warrior
570 Posts |
Posted - 2010-02-16 : 10:05:14
|
Can you plz help me in priting the values received from a cursor, the cursor select stm has a big list, I want to display the cursor results for the below proc.Regards,aakCREATE PROCEDURE dbo.uspCurrencyCursor @CurrencyCursor CURSOR VARYING OUTPUTAS SET NOCOUNT ON; SET @CurrencyCursor = CURSOR FORWARD_ONLY STATIC FOR SELECT CurrencyCode, Name, ....... FROM Sales.Currency; OPEN @CurrencyCursor;GODECLARE @MyCursor CURSOR;EXEC dbo.uspCurrencyCursor @CurrencyCursor = @MyCursor OUTPUT;WHILE (@@FETCH_STATUS = 0)BEGIN; FETCH NEXT FROM @MyCursor; --here I want to print the records ---fetch by the cursorEND;CLOSE @MyCursor;DEALLOCATE @MyCursor; |
|
|
vijayisonly
Master Smack Fu Yak Hacker
1836 Posts |
Posted - 2010-02-16 : 10:06:49
|
| And the reason you are using a cursor for this? |
 |
|
|
aakcse
Aged Yak Warrior
570 Posts |
Posted - 2010-02-16 : 10:20:42
|
| Actually I have a situation where the out parameter is cursor in a SProc with 2 in parametera select query returns result set, which I want to catch and display.( I am trying to implement a ref cursor(of oralce) in sqlserver ) I got it rightly but I am not aware of how to display the result and see.I am able to catch but not display as above.Regards,aak |
 |
|
|
aakcse
Aged Yak Warrior
570 Posts |
Posted - 2010-02-16 : 10:36:08
|
| [code]DECLARE @MyCursor CURSOR;declare a@ varchar(1000),@b varchar(1000)EXEC dbo.uspCurrencyCursor @CurrencyCursor = @MyCursor OUTPUT;WHILE (@@FETCH_STATUS = 0)BEGIN; FETCH NEXT FROM @MyCursor into @a,@b...; --here I want to print the records ---fetch by the cursor PRINT @a + @b ..-- I tried taking all the values in the cur into a variable and then print it executing but not printing?END;CLOSE @MyCursor;DEALLOCATE @MyCursor;[/code] |
 |
|
|
X002548
Not Just a Number
15586 Posts |
|
|
madhivanan
Premature Yak Congratulator
22864 Posts |
Posted - 2010-02-17 : 01:48:12
|
| <<I am trying to implement a ref cursor(of oralce) in sqlserver >>In ORACLE you need cursor. In SQL Server you dont need for this caseMadhivananFailing to plan is Planning to fail |
 |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2010-02-17 : 01:51:33
|
quote: Originally posted by madhivanan <<I am trying to implement a ref cursor(of oralce) in sqlserver >>In ORACLE you need cursor. In SQL Server you dont need for this caseMadhivananFailing to plan is Planning to fail
Wow! Another instance of 'ORACLE effect' ------------------------------------------------------------------------------------------------------SQL Server MVPhttp://visakhm.blogspot.com/ |
 |
|
|
madhivanan
Premature Yak Congratulator
22864 Posts |
Posted - 2010-02-17 : 01:57:10
|
quote: Originally posted by visakh16
quote: Originally posted by madhivanan <<I am trying to implement a ref cursor(of oralce) in sqlserver >>In ORACLE you need cursor. In SQL Server you dont need for this caseMadhivananFailing to plan is Planning to fail
Wow! Another instance of 'ORACLE effect' ------------------------------------------------------------------------------------------------------SQL Server MVPhttp://visakhm.blogspot.com/
Yes MadhivananFailing to plan is Planning to fail |
 |
|
|
|