Category "sql-server"

In SQL, how do I filter a parent with its child records if either satisfies a condition

I have the following table as example. I want to retrieve only the records where the ScheduleDate is smaller than 2022-01-03 (Jan 3, 2022) for either the parent

Implement an SQL query in LINQ

I'm trying implement the follow query in LINQ, but I don't find solution: SQL: SELECT COUNT(*) AS AmountMonths FROM (SELECT SUBSTRING(CONVERT(NVARCHAR(12), pay_

SQL Group/Orderby

I have a set of records in a db table like this. The thing that logically links these records is guid1 and guid2 but not all records in the table have a full re

How to store attachment file in an email in a database?

I used this code to store attachment xlsx files from a specific address email in Outlook, but now I would like to store these files in a database in SQL Server,

error :- ProgrammingError: Attempt to use a closed connection

hi all im trying to run a stored procedure using python however im getting an error below is my code import pyodbc import sqlalchemy from urllib.parse import qu

Best way to get Azure and local SQL Server development databases to sync on request

I'm looking for a one click system that doesn't require one to delete the Azure database, publish from the local server, and re-create the user info onto the de

What is the best way to get a decimal or a float result when dividing two numbers in SQL [duplicate]

I declared a variable @avgMis as a decimal(2,2) in SQL Server. Then I tried to divide two integers, expecting a decimal value. Instead my answ

Azure Data Factory Copy Task Creates Gap In IDs

I have an Azure DataFactory copy task set up to copy employee data from a MySQL database to a SQL Server database. The data copies over fine except for the fac

Getting duration is seconds between datetime rows in SSIS

I have an event-based csv file that logs an event along with the time of execution. I need to be able to get the duration between the events by taking the DateT

IIS with SQLLocalDB return null on queries with error in Windows Event viewer error 528

I am developing an ASP.NET website with a SQL Server 2019 LocalDB database. I was working in Windows 10 ver:1903, but after upgrading Windows to the latest vers

Saving Greek characters in varchar column using SQL Server 2019 _UTF8 collations

Background: I'm doing some proofing of SQL Server 2019's _UTF8 collations (ref. https://docs.microsoft.com/en-us/sql/relational-databases/collations/collation-a

How to configure spring.data.convert.CustomConversion for MSSQL date

Recently I noticed that our spring-boot services are logging a warning from org.springframework.data.convert.CustomConversions. The message is this: Registerin

How to connect over sshtunnel to remote sql server with "2 jumps" in python

after days of research and fails with this problem. Context: I need to connect remotely from a python script to a remote database and I have the following restr

SQL Parse Json array to rows

I'm trying to parse the 'custinfo' array to rows, rather than specific columns how I have in my query (there can be none or many values in the array) DECLA

How to properly install pyodbc and drivers on M1 mac

I have a new M1 pro macbook and I'm trying to install pyodbc and relevant drivers on my machine. So far I have installed unixodbc via homebrew and ODBC drivers

How to translate this SQL into LINQ, with correlated subquery single table

The raw SQL uses correlated subquery for single table, any possibility to translate this with single LINQ Query? SELECT * From dbo.Products AS P1 WHERE SalePric

SSIS Power query connection manager error

I install SQL Server Connector for Power Query for SQL server 2017. Create SSDT SSIS package with power query connector. It works perfect in SSDT! But when I de

how to configure replication(read-replica) for MS-SQL in Cloud SQL?

I am exploring Cloud SQL and the various flavours (MySQL, PostgreSQL, MS-SQL). I am able to create read replicas for MySQL and PostgreSQL, but I don't find that

How can I use a SQL Server sp_* stored procedure/function in a if case?

I'd like to check the catalog existence before I create or use it, so there is go. sp_fulltext_catalog 'testcatelog1', 'create'; if not exists (select 1 from s

Get data from a table after having closed the session

In this moment I´m try to get a List of users and checks if the user is in the BD or not I´m using Web API Net 6 and Sql Server This is the code