Hi I want to create a simple stored proecudre which does the following:
Psudocode
@tempSelect = "SELECT * FROM Table"
if (@Param is NULL) then
exec @tempSelect
else
exec @tempSelect + ' WHERE id = ' + @Param + '
Is this method efficent? Thank you.
Try
select *
from table
where id=isnull(@param, id)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With