Just got to give some feedback: Your screen casts are superb! Keep on rocking. Your approach is very easy to follow and straight forward. Thanks from Sweden!
The last cool trick you described is really helpful, but I guess that can decrease performance when you deal with huge table and little more complicated calculation, in such case I prefer Trigger (FOR INSERT/UPDATE) conjunction with UDF, than store calculated value in a field, so you don't need to calculate it for each query.
delimiter | create function if_report(@idname INT, @reportsto INT) returns bit as begin declate @result as bit if exists(select * from employees where employeeNumber = @id_name and reportsTo = @reports_to) set @result = 1 else set @result = 0 return @result end | what is wrong with this code..please answer
Just got to give some feedback: Your screen casts are superb! Keep on rocking. Your approach is very easy to follow and straight forward. Thanks from Sweden!
After looking at videos for 3 days straight I finally understand Scalar Functions, thank you sir your video made it much easier to understand.
Hi Michael, thx for posting this...really helpful and easy to understand....plz keep on posting similar ones
Thanks Mike. This was very helpful.
The last cool trick you described is really helpful, but I guess that can decrease performance when you deal with huge table and little more complicated calculation, in such case I prefer Trigger (FOR INSERT/UPDATE) conjunction with UDF, than store calculated value in a field, so you don't need to calculate it for each query.
@cachwahed very true. In large scale databases with more than a couple 100K rows I would not do this trick.
thank you , Michael!!
What error message are you getting?
delimiter |
create function if_report(@idname INT, @reportsto INT)
returns bit as
begin
declate @result as bit
if exists(select * from employees where employeeNumber = @id_name and reportsTo = @reports_to)
set @result = 1
else set @result = 0
return @result
end |
what is wrong with this code..please answer