Skip to content
Advertisement

Tag: math

Trying to do basic subtraction from a database table

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

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

Advertisement