Updating multiple tables in sql

I am trying like:update tablename1 t1,tablename2 t2 set t1.fieldname1 = t2.fieldname1 = 'value' where condition;orupdate tablename1 t1,tablename2 t2 set t1.fieldname1 = 'value' t2.fieldname1 = value where condition; Plzzzzzz help me. I'll have to see if '71054' can be called as a parameter in VS 2003.

So I can create a report that asks for the unit to be updated and then the value we are updating to.

Section 3.3, “How My SQL Handles Invalid Data Values,” discusses the SQL mode values that affect handling of erroneous or missing values during data entry.

We've got lots of great SQL Server experts to answer whatever question you can come up with. Hello All, I want to update multiple tables using single query and fields name are same of tables. USE Northwind GO CREATE TABLE my Table99 (Col1 int PRIMARY KEY CHECK (Col1 BETWEEN 1 AND 10), Col2 varchar(50)) CREATE TABLE my Table98 (Col1 int PRIMARY KEY CHECK (Col1 BETWEEN 11 AND 20), Col2 varchar(50)) GO INSERT INTO my Table99(Col1, Col2) SELECT 1, 'x' UNION ALL SELECT 2, 'y' UNION ALL SELECT 3, 'z' INSERT INTO my Table98(Col1, Col2) SELECT 11, 'x' UNION ALL SELECT 12, 'y' UNION ALL SELECT 13, 'z' GO CREATE VIEW my View99 AS SELECT Col1, Col2 FROM my Table99 UNION ALL SELECT Col1, Col2 FROM my Table98 GO SELECT * FROM my View99 UPDATE my View99 SET Col2 = 'x002548' WHERE Col2 = 'z' SELECT * FROM my View99 /* DROP VIEW my View99 DROP TABLE my Table99, my Table98 */ Found this trivia on the net a while ago DECLARE @Table A TABLE (i INT)DECLARE @Table B TABLE (i INT)SELECT * FROM @Table ASELECT * FROM @Table BINSERT @Table AOUTPUT inserted.i INTO @Table BSELECT 1 UNION ALLSELECT 2 UNION ALLSELECT 3SELECT * FROM @Table ASELECT * FROM @Table BJim create view temp_mfg_unit_view as Declare @unit varchar(16) set @unit='71054' select t_cmnf, t_clot from ttscfg200100 --objects where [email protected] union all select t_cmnf, t_clot from terext401100 --rental contract lines where [email protected] I didn't put all the tables in the code. Post ID=2669779&Site ID=1Originally posted by cardgunner I was afraid of that.--Insert records in Invoice table for a given Order Number INSERT INTO dbo. Invoice (Order Id, Item Count, Item Total Amount) SELECT dbo.[Order]. On clause specifies columns names to find matching rows between both tables using Inner Join.In the example above, Rows with Id (1,2,3) are deleted from table T2 because it matches with Table1 (Id) Column with Inner join.

Leave a Reply