Updating multiple tables in mssql

There’s probably an article from 20 years covering this.Anybody asking such a question needs to read a manual and feel lucky they exist.Let me know if this solution satisfies the need of updating two tables in a single statement.If not, I would love to know the reason, you want to update two more tables in a single statement. SQLAuthority.com)I’m stunned that this needs discussing in 2017.

In any case I did cahnge @unit with '71054' and scratched the declare. Worked perfectly Tried to update the t_cmnf and got an error. One way to deal with this is to create an INSTEAD OF UPDATE trigger on view which updates the base tables instead of updating the view directly. Post.aspx? Card Gunner I didn't put all the tables in the code. I'll have to see if '71054' can be called as a parameter in VS 2003. Can you do this type of statement when creating a view? Card Gunner Originally posted by jimf 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 BOriginally posted by cardgunner I was afraid of that.Card Gunner create view tmp_mfg_unit_2 as select t_cmnf, t_clot from ttscfg200120 --objects where t_clot='23332' union all select t_cmnf, t_clot from terext401120 --rental contract lines where t_clot='23332' update tmp_mfg_unit_2 set t_cmnf='OTH' Server: Msg 4416, Level 16, State 5, Line 1 UNION ALL view 'tmp_mfg_unit_2' is not updatable because the definition contains a disallowed construct.create view tmp_mfg_unit_2 as select t_cmnf, t_clot from ttscfg200120 --objects union all select t_cmnf, t_clot from terext401120 --rental contract lines update tmp_mfg_unit_2 set t_cmnf='OTH' where t_clot='23332' Server: Msg 4440, Level 16, State 9, Line 1 UNION ALL view 'tmp_mfg_unit_2' is not updatable because a primary key was not found on table '[ttscfg200120]'.

updating multiple tables in mssql-56updating multiple tables in mssql-11updating multiple tables in mssql-83

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.

Join our conversation (28 Comments).
Click Here To Leave Your Comment Updating multiple tables in mssql.

Comments:

  1. 1
    Steve

    Men and women in your town, local to you as well as all over the UK UK Sex Meet offers adult chat and adult sex dating opportunities with consenting men and women throughout the UK.

  2. 1
    Steve

    As it went on, Steve came to dominate the show, and more and more episodes revolved around him and his wacky sci-fi inventions.

  3. 1
    Steve

    When you enter jaw-dropping Stripper Lingerie Free Sex for the first time, you can hardly believe that the choice you see there with your own thrilled eyes is really possible to access!

  4. 1
    Steve

    The 85009 ZIP code is from 19th Avenue to 43rd Avenue and from Thomas Road just past Lower Buckeye Road.

Leave a Reply

Your email address will not be published. Required fields are marked *