Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
| Author |
Topic |
|
gchacko
Starting Member
8 Posts |
Posted - 2002-09-30 : 16:07:22
|
| I have tried simple print statements and it works.Eg:DECLARE @CheckCnt intSELECT @CheckCnt=COUNT(*) FROM Table1print @CheckCntThis prints the count.Now if I try this it doesn't print at all. ????Eg:DECLARE @Record_Identifier char(1)DECLARE Cursor1 CURSOR FOR SELECT Record_Identifier FROM Table1OPEN Cursor1WHILE @@FETCH_STATUS = 0BEGIN FETCH NEXT FROM Cursor1 INTO @Record_Identifier PRINT @Record_IdentifierENDCLOSE Cursor1DEALLOCATE Cursor1 |
|
|
1fred
Posting Yak Master
158 Posts |
Posted - 2002-09-30 : 16:59:43
|
| just try to print something like print 'hello' to see if the problem is in the print function or in the cursor or variable |
 |
|
|
YellowBug
Aged Yak Warrior
616 Posts |
Posted - 2002-09-30 : 17:11:36
|
| Or, maybe move the PRINT statement to before the FETCH NEXT:WHILE @@FETCH_STATUS = 0 BEGIN PRINT @Record_Identifier FETCH NEXT FROM Cursor1 INTO @Record_Identifier END |
 |
|
|
LarsG
Constraint Violating Yak Guru
284 Posts |
Posted - 2002-09-30 : 17:47:50
|
| The value of @@FETCH_STATUS is undefined before any fetches have occurred on the connection. This means that you never enters the while loop. |
 |
|
|
|
|
|