-
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
-
-
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
-
Forum Rules
|
|