cursors....
Below is a successfully tested example script that should run in your environment.DECLARE @ACCOUNTID INT;DECLARE GETACCOUNTID CURSOR LOCAL STATIC FOR SELECT ACCOUNT_ID FROM dbo.BILLS;OPEN...
View Articlecursors....
iam new to sql. so, i tried simple example by using cursors but it doesnt executing...
View Articlecursors....
Try @@FETCH_STATUS instead of @@FETCHSTATUS. However, I see no need for a cursor here. It is best to avoid cursors in cases where set-based processing is an option.Dan Guzman, SQL Server MVP,...
View Articlecursors....
Can you do this without a cursor? Cursors are very bad for performance and you're not doing anything useful in your code at all, as I see.Premature optimization is the root of all evil in programming....
View Articlecursors....
What is your SQL Server version and compatibility level of the database?Compare your code with the http://msdn.microsoft.com/en-us/library/ms180169.aspxPremature optimization is the root of all evil in...
View Articlecursors....
i tried this..but it showing again some errors:Msg 156, Level 15, State 1, Line 2Incorrect syntax near the keyword 'FOR'.Msg 137, Level 15, State 2, Line 7Must declare the scalar variable...
View Articlecursors....
Your DECLARE CURSOR command is wrong. What exactly is the purpose of this exercise? It can be done with just one simple select statement.Premature optimization is the root of all evil in programming....
View Articlecursors....
try this.DECLARE @ACCOUNTID INTDECLARE GETACCOUNTID CURSOR FOR SELECT ACCOUNT_ID FROM BILLSOPEN GETACCOUNTIDWHILE @@FETCH_STATUS=0 BEGIN FETCH NEXT FROM GETACCOUNTID INTO @ACCOUNTID PRINT...
View Articlecursors....
DECLARE @ACCOUNTID INTDECLARE @GETACCOUNTID CURSORSET @GETACCOUNTID=CURSOR FOR SELECT ACCOUNT_ID FROM BILLSOPEN @GETACCOUNTIDFETCH NEXTFROM @GETACCOUNTID INTO @ACCOUNTIDWHILE @@FETCHSTATUS=0BEGINPRINT...
View Article
More Pages to Explore .....