SQL Server Performance

How to Update using OPENROWSET

Discussion in 'General Developer Questions' started by rajeev_id, May 12, 2004.

  1. rajeev_id New Member

    [?]How to do Update using OPENROWSET.


    This Query work fine.
    SELECT *
    FROM OPENROWSET('SQLOLEDB','ServerName';'UserName';'Pwd',
    'select * from TableName')


    why update is not working.
    update OPENROWSET('SQLOLEDB','ServerName';'UserName';'Pwd',
    'select * from TableName') set col_Name='1'


    so how to use Update with OPENROWSET.


    Rajeev Kumar Srivastava
    --ALWAYS BE POSITIVE!--
  2. satya Moderator

  3. Chappy New Member

    Ive not used OPENROWSET much but BOL states it can be used in the FROM clause of an UPDATE query.

    Try this

    update t set t.col_Name='1' FROM OPENROWSET('SQLOLEDB','ServerName';'UserName';'Pwd','select * from TableName') t
  4. Chappy New Member

    Also ensure the user you are logging in as has permissions to update that table!

Share This Page