Skip to content

Tag: sql-server

Counter Number of Times in State

I want to add a column which tells me the iteration count of how many times we’ve been in a state, ordered by date. We see we’re in state 1 for the first time, state 2 for the first time, then BACK to state 1 (iteration is now 2), the Iteration stays the same until we change state. I’d like

Could a SELECT inside of a transaction lock the table?

I would like to know if it’s possible that a select is blocking a table if it’s inside a transaction. It’s something like this: It’s a dummy example, but if there’s a lot of records in that table, and an API is receiving a lot of requests and calling this stored procedure, could …

How to create a view using data from two tables

I have two tables ITEM id (int), model (varchar), weight (float), fk_type (int) TYPE id (int), name (varchar) And I want to create a view with TypeName (for every type name) –> varchar NumberOfItems (total number of ITEMS for TypeName) —> int NumberOfModels (total number of MODELS for TypeNa…

Add multiplicity as rows

I use Sparx EA to build a relationship database (MS SQL Server). The tool has a function to create charts. I use the query: SELECT system.Name AS Series, systemElement.Name AS GroupName FROM t_object …

Scope_identity is giving null values? [closed]

Closed. This question needs details or clarity. It is not currently accepting answers. Want to improve this question? Add details and clarify the problem by editing this post. Closed last year. Improve this question I have stored procedure in which I use scope_identity() Error I get: cannot insert null into i…