About your code, it is correct, though such spells usually are implicit. Meaning you have to use 13 not 17. Then again you have to also check the specific effects that you want to limit. And best way to check this is a tool called SpellWork.
Something like this, though this would limit only effect 0 = 1. Usually spells that are not explicit or opposite give console error on start up in condition table. This spell has chain icon which usually is connected with implicit effects.
INSERT INTO conditions VALUES (13,0,80351,0,0,31,0,3,42900,0,0,0,“”,“Target only creature 42900”);