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

I need to update this table in SQL Server with data from its ‘parent’ table, see below: Table: sale id (int) udid (int) assid (int) Table: ud id (int) assid (int) sale.assid contains the correct value to update ud.assid. What query will do this? I’m thinking of a join but I’m not sure if it’s … Read more

Insert results of a stored procedure into a temporary table

How do I do a SELECT * INTO [temp table] FROM [stored procedure]? Not FROM [Table] and without defining [temp table]? Select all data from BusinessLine into tmpBusLine works fine. select * into tmpBusLine from BusinessLine I am trying the same, but using a stored procedure that returns data, is not quite the same. select … Read more

Inserting multiple rows in a single SQL query? [duplicate]

This question already has answers here: Insert multiple rows WITHOUT repeating the “INSERT INTO …” part of the statement? (16 answers) Closed 8 years ago. I have multiple set of data to insert at once, say 4 rows. My table has three columns: Person, Id and Office. INSERT INTO MyTable VALUES (“John”, 123, “Lloyds Office”); … Read more