Skip to content
Advertisement

Apply if only on one column on result

This are sample template

If Isshow is false, show entire price else hide second -fourth digit.(Price is 5 digits)

Query :

I don’t want to use case, isnull or any user created functions because that works row by row. Here @Isshow is either false or true, not specific to each record, it is the same for all records.

Apart from dynamic sql or writing same query twice with if else.. is there any other way to achieve where don’t have to write same query twice? Because a few queries are bigger in size.

Advertisement

Answer

User contributions licensed under: CC BY-SA
4 People found this is helpful
Advertisement