Questions tagged [sql-server]

Microsoft SQL Server is a relational database management system (RDBMS). Use this tag for all Microsoft SQL Server editions including Compact, Express, Azure, Fast-track, APS (formerly PDW) and Azure SQL DW. Do not use this tag for other types of DBMS (MySQL, PostgreSQL, Oracle, etc.). Do not use this tag for issues on software and mobile development, unless it is directly related to the database.

Filter by
Sorted by
Tagged with
0 votes
0 answers
11 views

I want to create a SQL Server Conditional Constraint but cannot think of a way to do this without something like a trigger

I would like to create a database constraint that would disallow the following condition. To put it another way, for any given Transaction_ID I would like to constrain the database to disallow all ...
Mark H's user avatar
  • 1
0 votes
0 answers
6 views

Rejoining Old Primary Node as Secondary in SQL Server Always On Availability Group Post Forced Failover

Encountering synchronization issues after a forced failover in a three-node SQL Server Always On Availability Group setup. I am facing a challenge in a SQL Server Always On Availability Group setup ...
Neaj Morshad's user avatar
0 votes
1 answer
24 views

Using GROUP BY to consolidate records from a query

The 'data' for this follows -- there may be more or less rows of the source-table: UID_MOTRIP UID_PERSON UID_INSPECTION 413 14 77 411 17 0 407 16 74 I need to have a result that evaluates from ...
John D's user avatar
  • 539
-1 votes
3 answers
69 views

Create a table with the values of 3 strings

In SQL (T-SQL) I have 3 lists of numbers, in the form of strings (I take them from an Excel file): DECLARE @article_list VARCHAR(MAX) = 1060226, 20653, 39986, 1041443, 1060303, 1057353, 1050423, ...
Mauro Ghiglia's user avatar
-2 votes
0 answers
20 views

How to fix error with SQL Server connection (trusted certificate) [duplicate]

Today I tried to make a new connection to a new database, but I get an error. I am using Visual Studio 17.8.1. error when I try to create a connection If I however check the checkbox for Trust Server ...
Florentina's user avatar
0 votes
0 answers
35 views

How do I select tables without certain columns in them by referring to a list in python?

I have my code here: col_list = ['PRCS_DTE', 'EFF_DTE', 'PRCS_RUN_DTE', 'reportDate', 'DateofData', 'InsertDate'] try: source_database=f'{source_database}.dbo' cursor = conn.cursor() ...
Lilcodemuffin's user avatar
-1 votes
1 answer
29 views

Inserting latest data into table coming from another table which is updated by SQL view

I have columns like ID, FirstName, LastName, DOB, Status coming from a SQL view called insert view. Now I have a stored procedure which inserts only latest data into table1 from that view as it ...
dixit gandhi's user avatar
-1 votes
0 answers
17 views

Local C# WPF application with cloud database

I have a c# WPF application which I want to install locally on several computers. I would like to run the database in the cloud on a server from Ionos. Does anyone already have experience with this? ...
stutski's user avatar
1 vote
0 answers
54 views

Pagination from two tables in SQL Server

I have two tables with the following schema: Table A: ColumnA, UserId, ... - rest of the schema omitted for brevity Table B: ColumnB, UserId, ... - rest of the schema omitted for brevity The tables ...
Kaustabh Kakoty's user avatar
0 votes
0 answers
20 views

installing a package on SQL machine learning services with sqlmlutils gives an error

I am trying to install packages in an SQL server instance with ML services installed. I need an updated version of pandas to be able to load api data into a database. The pandas version that is ...
Wietze314's user avatar
  • 5,970
0 votes
0 answers
15 views

MSSQL testcontainer tests stuck in Bitbucket pipeline

I'm trying to run unit and integration tests on Bitbucket CICD. We are using SpringBoot 3.1.5 with Testcontainers 1.19.3. Locally, all tests pass both from IntelliJ and from cmd line. Base integration ...
Milan's user avatar
  • 11
-5 votes
0 answers
33 views

SQL Recursion with incomplete recursion [closed]

Im having hard times trying to figure out my SQL problem. I have price list with items and prices and my goal is to get every price from top price list to bottom one, until I reach one thats actually ...
Naivi's user avatar
  • 25
1 vote
0 answers
38 views

How do you format Microsoft Access' Date/Time Extended to Date/Time when linked to the SQL Server DateTime2(0) datatype?

I am trying to link an Access database to a SQL Server backend that has a DateTime2(0) field. I am currently upsizing the database to SQL Server and would like to use the recommended datatype. I use ...
Elias's user avatar
  • 2,622
0 votes
1 answer
57 views

Show column name along with column value in SQL Server [duplicate]

I have a following table:- declare @tab1 table(Id int identity, address1 varchar(100),city varchar(50), name varchar(50), Phone varchar(10)) insert into @tab1 (address1, city, name, Phone) Values ('C-...
Rahul Aggarwal's user avatar
-2 votes
0 answers
21 views

Power BI using SQL connectivity

I am using Power BI, where i am trying to get the data directly from SQL server. My SQL server is based on windows authentication, where i usually access SSMS using 'Run as Different User'. Is there a ...
SA.'s user avatar
  • 728
-1 votes
0 answers
46 views

Send email every week when a specific criteria is fulfilled [closed]

I want to create a trigger in my database which fires every week on Friday. But I only want to send an email if a certain criterion from a stored procedure is fulfilled. The procedure is returning ...
David's user avatar
  • 9
-1 votes
1 answer
74 views

SQL Server query does not work with newest data

I have a table with ~54,000,000 rows. I have the following query: SELECT tap1.[id], tap1.[Mark], tap1.[Date_Write] FROM [crpt].[dbo].[BI] tap1 JOIN (SELECT mark FROM [crpt]...
Anton Kotikov's user avatar
-1 votes
0 answers
20 views

MassTransit transactional outbox intermittent TCP failure

We're facing a difficult error at work. We have an ASP-NET REST API which enqueues messages on a RabbitMQ instance using MassTransit. We have the transactional outbox feature enabled, and backed by a ...
Kile Kasmir Asmussen's user avatar
0 votes
0 answers
40 views

The ConnectionString property has not been initialized in .NET 8 with EF Core 8 and SQL Server 2022

I am working on a .NET 8 application using Entity Framework Core 8 and targeting SQL Server 2022 (Express Edition). Despite having a correct connection string in my appsettings.json, I am encountering ...
strasouch's user avatar
0 votes
4 answers
67 views

SQL Server is not using my index. How to having it using my index?

My client is using a table to create financial reports per month. I have optimized it as there were around 40 aggregations columns and it was running for around 40 minutes to see the output. I created ...
George B's user avatar
0 votes
0 answers
55 views

Linking transactions to Purchase Order

I'm currently attempting to create an inventory report using data from inventory transactions. I have an inventory table that resembles the one below, and I'm working on generating a report that ...
Kris's user avatar
  • 1
0 votes
0 answers
23 views

SSIS Excel 2021 Import

I'm trying to connect to an Excel Source, my Excel file version is 2021, but the available choices are like below (3.0 4.0 2007-2010 2013 and 2016): enter image description here so whatever the ...
user22998494's user avatar
2 votes
1 answer
77 views

Having a unique record with flag values

SERIAL_NUMBER | BIP_WIDE_AREA_PORT | IP_FAST_REROUTE | GWIP_MULTICAST _____________________________________________________________________ N7608760 YES NO NO ...
Noshin Islam's user avatar
0 votes
0 answers
65 views

Call the stored procedure of through private endpoint using C#.NET

I have created a private endpoint for SQL Server in Azure portal. How to call stored procedure from C#.NET through private endpoint. I have few questions Will the connection string is vary when I ...
prasanthi's user avatar
  • 562
0 votes
1 answer
50 views

Use ExceptBy set operation with list of Keyselectors instead of single selector in C#

I am working on a project where I have an Excel sheet with some data. I am converting it into list and mapping it into another list which is derived from table in a database using entity framework ...
Sapri s's user avatar
  • 57
0 votes
0 answers
20 views

AWS SQL Server RDS (unable to get local issuer certificate)

SQLSTATE[08001]: [Microsoft][ODBC Driver 18 for SQL Server]SSL Provider: [error:1416F086:SSL routines:tls_process_server_certificate:certificate verify failed:unable to get local issuer certificate] ...
James Shakow's user avatar
0 votes
1 answer
31 views

Prevent the query from generating multiple unnecessary columns in SQL?

So I have this so far when trying to find the total time traveled based on the "generation" column: SELECT generation, SUM(CASE WHEN generation = 'Millennials' THEN ...
BigE's user avatar
  • 3
0 votes
0 answers
29 views

Invoke CLR assembly in SQL Server with administrator privileges? [duplicate]

Interprocess communication based on pipe scheme is performed in the CLR assembly code as follows: static void SendMessage(Process process, string message) { try { ...
MrHu's user avatar
  • 1
-1 votes
0 answers
53 views

Return identity ID after insert into SQL Server table linked in an MS Access DB [duplicate]

Is it possible to get/return the id (Primary Key) of a record after an insert (in an elegant way)? I am performing the insert using VBA from a MS Access database into a linked SQL Server table. sql = &...
LennyL's user avatar
  • 243
-1 votes
2 answers
44 views

Multiple Selects to update tblItems - INNER JOIN required? [duplicate]

I need to update the buyersAccountID in tblITEMS with the accountID of a winner who's boxNo in tblEntrants matches 'winner' in tblItems: TBLENTRANTS fileID boxNo accountID TBLITEMS fileID ...
mark davies's user avatar
0 votes
1 answer
64 views

Only return job numbers that contain certain suppliers but return all parts in that job number?

*Edited to include a reproducible query. I've got a list of job numbers that have multiple part numbers per job with different suppliers for each part. I need to return only jobs that contain parts ...
deaver92's user avatar
-1 votes
0 answers
43 views

I can't add new login in my SQL Server Management Studio 2019, how to fix this? [closed]

Create failed for Login 'admin'. (Microsoft.SqlServer.Smo) An exception occurred while executing a Transact-SQL statement or batch. (Microsoft.SqlServer.ConnectionInfo) User does not have ...
JanzHarvey Ortega's user avatar
0 votes
1 answer
48 views

Data to SQL Server "Float"

I'm using Python to grab a generated report, clean the file up, format it, and then send it to the SQL Server for housing and to push to Tableau after. The error is in a FirstName column where I have ...
jarodmwk's user avatar
0 votes
0 answers
34 views

Azure Data Studio seems to be corrupting results for a SELECT query from Notebook

This morning I ran a query against one of my tables and panicked when I got back results that looked like the data had been manipulated or was possibly corrupted. With investigation I found that ...
Steve Hiner's user avatar
  • 2,533
-2 votes
0 answers
78 views

Add working days (without public holidays, weekends) to a date in sql without a function [closed]

I would like to calculate one column from another by adding 3 or 10 days worked. the days worked are declared in a calendar table. Here is an example of data from both tables: Calendar date public ...
zle_bi's user avatar
  • 11
-4 votes
2 answers
70 views

Parse Data from OPENJSON() to extract values

Here is my code: SELECT * FROM OPENJSON ('{"AFN":{"code":"AFN","name":"Afghan Afghani","decimal_digits":0,"name_plural":"...
Russ's user avatar
  • 3
-1 votes
1 answer
60 views

Identify SKU id's that have changed status twice in a historical table

I have a historical table which has id, date and status columns. I am trying to identify all the instances where the id's have changed from status 1(Active) to 0(Inactive) and came back to 1(Active ...
msksantosh's user avatar
0 votes
0 answers
31 views

Valid OPENQUERY fails in BCP dynamic script

Trying to execute SQL through OPENQUERY statement to linked MySQL server as a test Interestingly the following openquery statement works: SELECT * FROM OPENQUERY([MYSQL], 'SELECT REPLACE(description,''...
Declan's user avatar
  • 1
0 votes
0 answers
38 views

Stored procedure with a temp table running multiple times on different SQL task in SSIS

I have a stored procedure which I want to run on multiple SQL tasks inside a SSIS package. The stored procedure contains temp tables. Also, each SQL task will execute the stored procedure with ...
Shayan's user avatar
  • 1
0 votes
3 answers
94 views

Convert date column into week

Normally, I write the weeks of the month in my SQL query as follows but I will prepare a dashboard and this dashboard will be based on 2023. For this reason, I cannot write all months this way. How ...
mehmetturkboga's user avatar
1 vote
0 answers
40 views

SSRS Aggregate Summation by ReportItems

I have the following structure Details contain summation of fields, an inner grouping on zone_desc, and an outer grouping on price type. I am looking to sum the seats field by zone. Currently the ...
Elizabeth's user avatar
  • 737
0 votes
0 answers
28 views

EF Core: Why is one end of my nullable one-to-one relationship always null?

I have a Device model, and a Tid model. Devices and TIDs can exist independently of each other, or can be associated together. If associated, then exactly one device can be associated with exactly one ...
Avrohom Yisroel's user avatar
3 votes
1 answer
64 views

Multiply value from next row to get monthly Index in SQL Server

I have the following data: Date Index MonthlyReturn Group 2023-01-01 10 0 Group 1 2023-02-01 NULL 3 Group 1 2023-03-01 NULL 6 Group 1 2023-01-01 10 0 Group 2 2023-02-01 NULL 4 Group 2 2023-03-...
qudsif's user avatar
  • 81
-1 votes
0 answers
28 views

How to integrate SAP connector core 2? [closed]

How to integrate this to sap and visual studio: https://github.com/metalsimyaci/SapCo2 I also do not understand, where I should insert the commend from the readme file (CMD\PowerShell or in Visual ...
Mattew Green's user avatar
-1 votes
0 answers
18 views

Random APP error - A network-related or instance-specific error occurred while establishing a connection to SQL Server

During operation of a business application, global tasks are performed. A global task includes many small tasks, each of which requires connecting to the sql server, executing and disconnecting. This ...
Orlandis's user avatar
3 votes
2 answers
99 views

Why does our ownership chain break in T-SQL stored procedures?

We have two stored procedures in the same Azure SQL DB, [a].[doA] and [b].[doB] User has SELECT, INSERT, UPDATE, DELETE, EXECUTE on schema [a], and nothing on other schemas. All db schemas have owner [...
Tamás Bárász's user avatar
-1 votes
0 answers
16 views

Uvicorn multiple processes api server keep getting disconnected with sql server every few days

Before when we used only one uvicorn process there wasn't any issue but now we are using Fastapi server with --workers 8 option. Our api server running on AKS and each process connected sql server to ...
chan's user avatar
  • 1
0 votes
2 answers
73 views

sql group by end of the week on Sundays

I have 3 columns in my table: bill_date (daily data), country, revenues How to group by country and get sum of revenues if I want to group my bill_date by the end of every week that fall on Sundays ? ...
Andreabic's user avatar
0 votes
0 answers
64 views

Determining FirstOfferDateTime in a Healthcare Scheduling Scenario using SQL

I am working on an SQL script where I need to accurately calculate the FirstOfferDateTime for patient appointments based on specific criteria. The scenario involves several datetime variables: ...
Michael Seltene's user avatar
0 votes
0 answers
21 views

Pyodbc error with ODBC Driver 18 for SQL Server. Error code 0x2746 (10054) (SQLDriverConnect)

I have a Python application that connects to a SQL Server database using pyodbc and ODBC Driver 18 for SQL Server. The application has been working fine for 4 months until last week, when I started ...
Álvaro Navarro Navarro's user avatar

1
2 3 4 5
6662