Converting from Oracle to SQL Server

  • Hello. I'm new to SQL Server and need some assistance, if any of you kind people can help. I need to translate the following from Oracle to SQL Server:

    SET VERIFY OFF

    ACCEPT oldlocal PROMPT "Enter the Set ID to change: ";

    ACCEPT newlocal PROMPT "Enter the new value: ";

    update bank set local_acc_no = '&newlocal' where local_acc_no = '&oldlocal';

    Thanks in advance

    Dave

  • SET VERIFY OFF - Not available SQL Server

    Rest it is not possible to get user inputs by prompting in T-SQL Query Analyzer. You may need a seperate Application to do that.

    I would some thing like this

    update bank set local_acc_no = 'You New Value' where local_acc_no = 'Your Old Value'

    OR for multiple updates

    DECLARE @Alters TABLE

    (

    newlocal Varchar(100),

    oldlocal VarChar(100)

    )

    INSERT @Alters

    SELECT 'Your Old Val 1', 'Your New Val 1' UNION

    SELECT 'Your Old Val 2', 'Your New Val 2' UNION

    SELECT 'Your Old Val 3', 'Your New Val 3' UNION

    SELECT 'Your Old Val 100', 'Your New Val 100'

    UPDATE A

    SET

     local_acc_no = newlocal

    FROM

     bank A

    JOIN

     @Alters B

    ON

     A.local_acc_no = B.oldlocal

    Regards,
    gova

  • You can try with SQLCMD

Viewing 3 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic. Login to reply