MuNiRs

Just another WordPress.com weblog

Archive for the 'SqlServer' Category


Sqlserver Cursors

Posted by Irfan Munir on March 4, 2008

DECLARE @ExpressionValue varchar(max)

DECLARE @GetExpressionValue CURSOR SET @GetExpressionValue = CURSOR  FOR SELECT  Expression FROM Expression 

OPEN @GetExpressionValue

FETCH NEXT FROM @GetExpressionValue INTO @ExpressionValueWHILE @@FETCH_STATUS = 0 BEGIN

            PRINT @ExpressionValue

FETCH NEXT  FROM @GetExpressionValue INTO @ExpressionValue

END

            CLOSE @GetExpressionValue

          DEALLOCATE @GetExpressionValue

Posted in SqlServer | No Comments »