I’m trying to subtract data based on user input, for example: UPDATE table SET quantity=quantity – * some input value* This is easy if I’m subtracting field by field, where id=1…2…3, but I want to subtract values automatically when I input quantity, so if input is 60, and there is 50 in the first field, remainder would be subtracted from
Tag: math
Sql arithmetic overflow
I have this query: Insert into Course(name,age,id,facebookuser) Values(‘Example’,25,204813,blalbla@walla.com), (‘Exmnumtwo’,35,504813,email@walla.com) Which gives me the error 8115: “arithmetic …
Numbers of weekdays in a date range in TSQL
This is harder than it looks. I need a function that calculates the numbers of a given weekday in a date range. I don’t want any loops or recursive SQL. There are millions of examples doing just that. I need a fast function for calculation. Input of the function will be weekday, fromdata, todate Expected result: Answer @Mikael Eriksson has
Calculate business hours between two dates
How can I calculate business hours between two dates? For example we have two dates; 01/01/2010 15:00 and 04/01/2010 12:00 And we have working hours 09:00 to 17:00 in weekdays How can I calculate …