24
Views
2
Comments
Solved
SQL query
Question

I have a SQL query to bring the amount according to the status. So far so good. 

I need to receive an input parameter that will be filled in according to the survey that the user filled out on the screen, which in the example is the ID of the manager. 

However, at the moment, if the user does not select the management he wants to consult on the screen, that is, if the input parameter is NullIdentifier, the query must bring the result of all the managements. 

The way I'm doing it, when it's Null after everything is zeroed. 

How can I resolve this situation? 


Sem título.png
Champion
Solution

Hi João,

In your where clause you should have:

WHERE ({Estudo_Gerencia}.[GerenciaId] = @Gerencia OR @Gerencia = 0)


Let me know if it helps,

Paulo

Champion

Hi João,

Did my answer help you in any way? If yes, mark it as solution so other people with same issue can refer back to this.


Cheers,

Paulo

Community GuidelinesBe kind and respectful, give credit to the original source of content, and search for duplicates before posting.