About 306,000 results
Open links in new tab
  1. How do I UPDATE from a SELECT in SQL Server? - Stack Overflow

    Feb 25, 2010 · 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. How can I do an UPDATE statement with JOIN in SQL Server?

    To perform an UPDATE statement with a JOIN in SQL Server, you can use the JOIN syntax in combination with the UPDATE statement. Here's an example query that should update the ud table based on the corresponding values from the sale table:

  3. 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 inside comes through to a stored procedure as (in C#) type SqlDbType.Structured

  4. sql - Update a table with data from another table - Stack Overflow

    In oracle SQL, how do I run an sql update query that can update Table 1 with Table 2's name and desc using the same id? So the end result I would get is Table 1: id name desc ----------------------- 1 x 123 2 y 345 3 c adf Question is taken from update one table with data from another, but specifically for oracle SQL.

  5. if condition in sql server update query - Stack Overflow

    May 21, 2017 · I have a SQL server table in which there are 2 columns that I want to update either of their values according to a flag sent to the stored procedure along with the new value, something like: UPDAT...

  6. How to rename a table in SQL Server? - Stack Overflow

    The SQL query that I have used is : ALTER TABLE oldtable RENAME TO newtable; But, it gives me an error. Server: Msg 156, Level 15, State 1, Line 1 Incorrect syntax ...

  7. How to update Identity Column in SQL Server? - Stack Overflow

    Oct 3, 2013 · You can not update identity column. SQL Server does not allow to update the identity column unlike what you can do with other columns with an update statement. Although there are some alternatives to achieve a similar kind of requirement. When Identity column value needs to be updated for new records Use DBCC CHECKIDENT which checks the current identity value for the table and if it's needed ...

  8. UPDATE statement with multiple WHERE conditions - Stack Overflow

    Jul 1, 2013 · Update all values in Table1 with this single query: 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 possible to join with LIKE. You can delete the temporary table again when you're finished.

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

    Dec 21, 2022 · If anyone comes here after me, this is the answer that worked for me. NOTE: please make to read the comments before using this, this not complete. The best advice for update queries I can give is to switch to SqlServer ;) update mytable t set z = ( with comp as ( select b.*, 42 as computed from mytable t where bs_id = 1 ) select c.computed from ...

  10. Remove Trailing Spaces and Update in Columns in SQL Server

    I have trailing spaces in a column in a SQL Server table called Company Name. All data in this column has trailing spaces. I want to remove all those, and I want to have the data without any trai...

Refresh