sql >> Base de Datos >  >> RDS >> Sqlserver

Si la variable está en blanco, entonces no hay cláusula de dónde

usar O:

select * from yourTable
where @test = '' OR Agent = @test

si @test viene con valor nulo (en lugar de '' ), debe utilizar:

select * from yourTable
where @test is null OR Agent = @test