dehseth -- Why the heck would you want to do that??? And what does that have to do with SQL Server ?
- Jeff
i need to override divsion operator / because of division by zero. i just wanna put 0 if there's division of zero. an example: @a = @b / @c + 20 if @c is 0 i want to see 20 in @a.
First off, you asked about overriding the + operator, not the division operator.
Secondly, are you asking about .NET or T-SQL?
Third, it is so extremely easy to handle divide by zero errors using either CASE or a simple custom function that I cannot think of any reason why you'd want to globally change the way an operator works, even if you could. Creating a simple UDF (User defined function) would result in code like this:
set @a= dbo.Div(@b,@c)
with a definition of Div as something like:
create function Div(@a int, @b int) returns int as return case when @b=0 then 0 else @a/@b end
That would do the trick and make it very clear that you are using a custom function which can be easily looked at and verified to see what it does.