Forum Discussion
bussk
Nov 18, 2022Copper Contributor
Need help with sql update query
Very much a newbie... Trying to update a field in one table based on a parameter from another table in the same database in SSMS. Could some one take a look at what I have come up with so far and lea...
SnowMan55
Nov 20, 2022Bronze Contributor
bussk You may have the correct syntax, except... Notice that at the start of the INNER JOIN clause you have practice.acr.sb..., which apparently should be practice_acr.sb...
As you have a USE statement in the batch, the database prefixes (practice_acr.) are not needed, and are visual clutter.
And while 1/1/2018 is fortunately not ambiguous, if you will have to deal with the execution of queries in other countries, other dates might be ambiguous; e.g., 03/11/2018 could mean March 11 or could mean November 3. So a syntax of 2018-01-01 (yyyy-mm-dd) is preferred; IIRC, '2018-01-01T12:00:00' is the best.