LPS-34920 Fix wrong SQL

Hi Julio,

I'm not sure if this was the idea behind the condition primKey != 0 but that condition is definitely wrong, since primKey is a varchar column...