Skip to content

Tag: sql-server

AVG in SQL Server

I am learning SQL Server, and I have a sample database which I got from my co-worker. I created a stored procedure previously which works fine. Now I am trying to show average of the column which I am struggling at the moment. Your supports means a lot and I will learn from this. So here is my query: And

Why is DbUpdateConcurrencyException thrown?

I am using an SQL server and I have a table whose purpose is to hold a tree-like structure: The “Path” column value is generated by INSTEAD OF INSERT, UPDATE trigger. I am using EFCore 3.1 and each time I try to add a record into the table, I get DbUpdateConcurrencyException thrown. What am I miss…

inserting a variable into openquery

I’m trying to insert a variable into the openquery expression, but unfortunately I get an error, does anyone know where I got this error? Arithmetic overflow error when converting expression data to int data type. Answer OPENQUERY requires a literal string, you can’t put variables into it. As such…

Table, Row valued UDFs in SQL Server

SQL Server (and some other databases) support a Table-value function. Is there a such thing as a Row-valued function — where based on a set of input values, a specific row would be returned, or is that type of function type not supported. If not, why isn’t it supported? The example SQL Server give…

Why ROW_NUMBER is defined as window function?

I would like to understand better the meaning of window function. The definition says: A window function performs a calculation across a set of table rows (the window) that are somehow related to the current row Let’s consider ROW_NUMBER() (the same could be applied for RANK() or DENSE_RANK()). The func…