About 51 results
Open links in new tab
  1. sql - UPDATE from a SELECT - Stack Overflow

    In SQL Server, it is possible to insert rows into a table with an INSERT.. SELECT statement: INSERT INTO Table (col1, col2, col3) SELECT col1, col2, col3 FROM other_table WHERE sql = 'cool' Is i...

  2. SQL UPDATE WHERE IN (List) or UPDATE each individually?

    Oct 19, 2015 · UPDATE table1 SET somecolumn = 'someVal' WHERE ID IN (SELECT ID FROM @definedTable); In the above, @definedTable is a SQL 'User Defined Table Type', where the data …

  3. sql server - Insert or Update - Stack Overflow

    Jun 30, 2025 · Insert or Update - Understanding difference between SQL statements [duplicate] Asked 7 months ago Modified 5 months ago Viewed 228 times

  4. How can I do an UPDATE statement with JOIN in SQL Server?

    This was an example, but the point is as Eric said in How can I do an UPDATE statement with JOIN in SQL Server?. You need to add an UPDATE statement at first with the full address of all tables to join …

  5. sql - Update statement using with clause - Stack Overflow

    ) update t set SomeColumn = c.ComputedValue from mytable t inner join comp c on t.id = c.id The real thing has quite a few with clauses that all reference each other, so any suggestions actually using …

  6. T-SQL: Using a CASE in an UPDATE statement to update certain …

    T-SQL: Using a CASE in an UPDATE statement to update certain columns depending on a condition Asked 15 years ago Modified 3 years, 8 months ago Viewed 408k times

  7. SQL Server after update trigger - Stack Overflow

    IF UPDATE(Country) BEGIN SET @field = 'Updated Country' END INSERT INTO CustomerLogs VALUES(@Id, @field) // OR -- If you wish to update existing table records. UPDATE YOUR_TABLE …

  8. sql - UPDATE statement with multiple WHERE conditions - Stack …

    Jul 1, 2013 · UPDATE Table1 INNER JOIN tmp ON Table1.[Acct Numb] LIKE tmp.[Acct Numb] SET Table1.Ticker = tmp.NewTicker; Yes, the JOIN part looks strange at first glance, but it's actually …

  9. sql server - Update Query in SQL using Join - Stack Overflow

    Jul 30, 2021 · sql sql-server sql-update inner-join insert-update edited Jun 17, 2025 at 2:18 philipxy 15.2k 6 44 103

  10. sql - Best way to 'Update if exists, or Insert' - Stack Overflow

    Sep 25, 2020 · My SQL Server is Microsoft SQL Server 2014. I have a record that may or may not exist in a table already -- if it exists I want to update it, otherwise I want to insert it.