Monday, September 26, 2016

There is no need to do a casting to match two differing types in a join in T-SQL.

It will just work. :) In an app I'm working on there is a table that more or less manages key value pairs with a different column for the key and the value. The value column is of nvarchar(50) but if an "int" is kept there and then matched against an int that is the primary key on another table in a join in a select, it's will work alright. Yay!

Maybe I spoke too soon, one of my coworkers, J.D. Gonzalez, tweets to me: that is true it will be at the expense of an implicit cast. That can cause performance problems on large datasets.

No comments:

Post a Comment