Few days ago, I found a very strange thing with SQL SERVER 2005 and I strongly feel that this is a bug in Sql Server which actually can create lots of data discrepancy.
Let's go through the script.
Initally I thought that this is a bug but actaully it's not. The inner query first tries to find the column in the current table (inner query's table) and if it does not found then it will look for the outer query table. It is the best practice to use the tableName.ColumnName in the inner query.
UPDATE tblProduct SET IsDamaged = 1
WHERE ProductID IN
(SELECT tblCategory.ProductID FROM tblCategory WHERE CategoryID = 1)
Now this inner query will throw an error. So next time be careful whenever you are working with inner queries.
You need to be a premium member to use this feature. To access it, you'll have to upgrade your membership.
Become a sharper developer and jumpstart your career.
$0
$
. 00
monthly
For Basic members:
$20
For Premium members:
$45
For Elite members: