var sidebar_align = 'right';
var content_container_margin = parseInt('290px');
var sidebar_width = parseInt('270px');
Unanswered: Default for an int parameter in SP
I'm using a stored procedure that receives one parameter namely @EmployeeID INT
but when I want to give this parameter a default value, my SP fails.
I did it like with a varchar where it works.
@Employee INT = '%'
Is this correct or did I use a wrong syntac/wildcard?
INT is a numeric datatype only you should use digits to assign defaults.
If not use VARCHAR to assign such special chars.
Isn't there a numeric default that I can use?
actually i use the SP to do the next thing.
If I don't give a parameter I want all recoreds to be returned. When passing through the ID (as parameter tot the SP) I want only that record to be returned. So if I understand correctly you're saying there is no sucth thing as setting a default for an int-type?
Only numerics are allowed as default for int.
Can i define a range then?
like @EmployeeID INT = [0-9]
so that all numbers can be received? or how precisely do I do this?
If no parameter is given I want al records returned.
CREATE PROCEDURE sp_myproc
@emp_id int = 0
select * from my_table
where emp_id =
case @emp_id when 0 then emp_id else @emp_id end
when you call sp_myproc without specifying any parameters then all employees are retrieved.
Is that what you were asking?