Results 1 to 3 of 3

Thread: Help in coverting from Oracle to SQL Server

  1. #1
    Join Date
    Oct 2005
    Posts
    3

    Help in coverting from Oracle to SQL Server

    Hi All

    Can any one help me in converting this from WHICH IN ORACLE to MS SQL SERVER




    sqlplus -s $UserId/$PassWord@$DataBase <<EOSQL> $LogFile (This is the Connection String)

    set serveroutput on
    Declare
    tempCnt Number:=0;
    totDelCnt Number:=0;
    Begin
    Loop
    $DelStmt
    tempCnt := tempCnt+ SQL%ROWCOUNT ;
    totDelcnt := totDelCnt+ SQL%ROWCOUNT ;

    If SQL%NOTFOUND Then
    Exit;
    End if;

    If tempCnt >= 50000 Then
    Commit ;
    tempCnt:=0 ;
    End if ;

    End Loop;
    Commit ;
    dbms_output.put_line('No of Recs Deleted From $TableName: '|| totDelcnt);
    End;
    /
    exit
    EOSQL

  2. #2
    Join Date
    Oct 2005
    Posts
    2,557
    Ummm, what which?

  3. #3
    Join Date
    Nov 2002
    Location
    New Jersey, USA
    Posts
    3,932
    What's your delete statment?

    In SQL Server there is a SET command that limits the effect of any SQL command to given number of rows, for example if you want to delete 50000 at a time then you can do

    SET ROWCOUNT 50000

    WHILE ---check if any row exists
    BEGIN
    delete table
    END

    SET ROWCOUNT 0

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •