Skip to main content

Simple Cursor Example in SQL

    DECLARE @Pram int

    DECLARE aCursor CURSOR
    FOR
        SELECT
            *
           
        FROM
            TableName
           
    OPEN aCursor
   
           
    FETCH NEXT FROM aCursor INTO
        @Pram
       
    WHILE @@FETCH_STATUS = 0
        BEGIN
            --'what you want to do hear'
            FETCH NEXT FROM aCursor INTO
                @Pram
        END
    CLOSE aCursor
    DEALLOCATE aCursor

Comments

Popular posts from this blog

Tata Punch: A Compact SUV That Packs a Punch

Message Helper for MVC Application

Message Helper for MVC Application public static class MessageExtensions { public enum MessageType { Success = 0, Info = 1, Warning = 2, Error = 3 } public static void ShowMessage( this Controller controller, MessageType messageType, string message, bool showAfterRedirect = false ) { string messageTypeKey = messageType.ToString(); if (showAfterRedirect) { controller.TempData[messageTypeKey] = message; } else { controller.ViewData[messageTypeKey] = message; } } public static HtmlString RenderMessages( this HtmlHelper htmlHelper, bool clearMessage = true ) { string messages = String .Empty; foreach ( string messageType in Enum .GetNames( t...

Postback Page using Javascript in ASP.net

Postback Page using Javascript in ASP.net For Calling Function: __doPostBack('__Page', ''); Function: function __doPostBack(eventTarget, eventArgument) {         if (!theForm.onsubmit || (theForm.onsubmit() != false)) {             theForm.__EVENTTARGET.value = eventTarget;             theForm.__EVENTARGUMENT.value = eventArgument;             theForm.submit();         }     }