Updating 2 tables in sql
When you look at this it looks very simple but when we try to think the solution, I have seen developers coming up with many different solutions for example sometime they write cursor, table variables, local variables etc.
This is one of the most interesting questions I keep on getting on this email and I find that not everyone knows about it. Our requirement is that we have Table2 which has two rows where Col1 is 21 and 31.
The user can have 1 character value in the first position of the meter number.
I've modified this code multiple times and pretty much get errors each time.
Every now and then you will get someone asking how to update two tables with one statement in SQL Server. the person then walks away muttering something about how My SQL allows it.
So I decided to try to see if I could update two tables with one statement.