Category "sql-server"

Connecting to an Azure database using SQLAlchemy in Python

I am trying to connect to an Azure database using SQLAlchemy in Python. My code is the following: engine_azure = \ create_engine('mssql+pyodbc://{Server admin

Time Flow Chart in SSRS (2016)?

I am trying to create a report table in SSRS 2016 but I am not sure how to go about it or if it is possible. I am trying to recreate something similar to that

Using 0 as Primary Key

I use lookup tables commonly and sometimes I have some default record in the Lookup table and I think for this record I can use 0 as Primary Key a as shown belo

Dynamic SQL Query in C#

I'm trying to create a query with a variable number of parameters, giving to the program the name of the table and an Array for the names of parameters and anot

Laravel MSSQL Server Connection not working

Laravel version:7.13, SqlServer:2019 SQLSTATE[08001]: [Microsoft][ODBC Driver 17 for SQL Server]TCP Provider: An existing connection was forcibly closed by

C# EFCore.BulkExtensions The MERGE statement conflicted with the FOREIGN KEY constraint

Parent: public class Currency { [DatabaseGenerated(DatabaseGeneratedOption.Identity)] public int Id { get; set; } public string? Name { get; set; }

SQL How To Display Month Difference Between Return And Purchase Date

I need help with writing the query that will say month difference between return and purchase dates, see the example below. Product PurchaseDate (dd/mm/yy) Ret

Write a query identifying the type of each record in the TRIANGLES table using its three side lengths

Write a query identifying the type of each record in the TRIANGLES table using its three side lengths. Output one of the following statements for each record in

EF Core - generic way to merge child records based on current db state and equality

I have a scenario where during an Update request of a parent entity, I have a collection of children entities in my dto, and want to merge them in the DB so tha

more VARBINARY columns in result set fo SQL Server R sript

In my R script for MS SQL Server I try to return one column VARBINARY() and one VARCHAR(). However, server allow only one column when VARBINARY is returned: T

Schema compare - Unexpected exception caught during population of source model: Object reference not set to instance object

I've been running a schema compare in a database project in Visual Studio 2017, when I do this I get the following message in the Error List tab: Unexpected

EF Core 3, optimize lots of Include/ThenInclude

I have a query like this return await _ctx.Activities .Include(a => a.Attributes) .Include(a => a.Roles) .Include(a =

ERROR: Unsupported PIVOT column type: text

I'm trying to perform a PIVOT but getting an error. I'm trying to see which patients have more than one Interval session. The column is a text type. I attempted

How do I add an error message to my stored procedure when 0 rows are affected?

I am trying to learn how to use transactions and error handling. Got stuck with custom error messages. The stored procedure generates badges for AdventureWorks

Could SSMS shows actual execution plan in Azure Synapse?

I'm studying of Azure Synapse. In dedicated SQL pool database, 'actual execution plan' of SSMS was disabled. In serverless pool database, SSMS says 'set statist

What is the most effective way to exclude blank records in a SQL Server query

I am trying to run a query to return all rows that are not null. But, I am not able to get that done. How is this possible? Please assist.

Select item that is different in each of group by a column

I have this sample table +--------+-------------+ | DBName | Description | +--------+-------------+ | A | Car | | A | Boat | | B

OUTPUT $action in SQL server, casing the updated rows output for a specific column

I am making merge upserts to my data warehouse. I don't need to keep the history on this particular object, so I'm using a type i slowly changing dimension. I'm

How to deal with SQL server error: The database cannot be opened because it is version 904. This server supports version 852 and earlier [closed]

While connecting to SQL Server database by attaching to an MDF file, the following error is returned: The database cannot be opened because it

Smarter SQL UPDATE between two tables (bill and bill rows)

I have these two SQL tables: Bills (BillId, Folio, Date, ProductId) BillsRows (BillRowId, BillId, ProductId, Lot, Quantity, Price) ProductId is optional in Bil