Home Dashboard Directory Help
Search

Mis-matched table var column matches anything by AndrewMc


Status: 

Closed
 as Won't Fix Help for as Won't Fix


1
1
Sign in
to vote
Type: Bug
ID: 786085
Opened: 5/2/2013 12:44:03 AM
Access Restriction: Public
0
Workaround(s)
view
0
User(s) can reproduce this bug

Description

I wrote an sp to delete data using a one field table variable to hold values to be deleted.
Only 3 values were put in to the table var, but when compared to a Product table, all rows were matched and deleted. I had miss-named the table var field in the sp delete statements.
The design-time compiler let the mistake through, and apparently the run-time engine said "can't find ProductID in table var" I know I'll match Product.ProductId with itself.
So everything was deleted instead of getting an error.
Happens in 2008 and 2012
Details
Sign in to post a comment.
Posted by Microsoft on 7/18/2013 at 2:24 PM
Hello,

Thank you for submitting this feedback. After carefully evaluating all of the bugs in our pipeline, we are closing bugs that we will not fix in the current or future versions of SQL Server.

Sincerely,
Manbeen
Posted by Vladimir Moldovanenko on 5/6/2013 at 7:36 AM
You need to code properly, using table aliases and then it will be no problem.
select * from dbo.ProductsInColours p where p.ProductID in (select t.ProductID from @ProdsToDel t) --10500 rows
Sign in to post a workaround.