Unpredicted behaviour i IN clause
Database
1
Posts
1
Posters
0
Views
1
Watching
-
Please see my problem below: Table structure: tmpItemPrice(ItemPriceID bigint not null , Thickness varchar(255)) Row1 ItemPriceID: 1 Thickness: xyz Select ItemPriceID From tmpItemPrice Where IsNumeric(Thickness) = 1 and Cast(Thickness as float) <= 0 When above query runs it give my type conversion error which is logical as Thickness is not numeric. But when we use this query in IN clause as shown below it works fine. select * from tmpItemPrice Where ItemPriceID in ( Select ItemPriceID From tmpItemPrice Where IsNumeric(Thickness) = 1 and Cast(Thickness as float) <= 0 ) So my question are: - what is the reason behind it? - Is it right to use it in this way? Thanks