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.
88,894
questions with no upvoted or accepted answers
31
votes
2
answers
1k
views
SSDT Schema Compare add blank lines to the schema files
I am using Schema Compare feature in Visual Studio 2017 to compare a database with database project (.sqlproj).
If I apply some changes to the project it also adds blank lines to some of the schema ...
17
votes
1
answer
14k
views
Connect to sql server from linux environment using putty private key, sqlalchemy and pyodbc
Hi I am trying to read a dataframe from sql server from a linux(ubuntu server).
The file(gscm.ppk) has the admin keys in it
I have used the following format to connect to sql server:
import urllib....
16
votes
2
answers
2k
views
TClientDataset Widestring field doubles in size after reading NVARCHAR from database
I'm converting one of our Delphi 7 projects to Delphi X3 because we want to support Unicode. We're using MS SQL Server 2008/R2 as our database server. After changing some database fields from VARCHAR ...
15
votes
0
answers
3k
views
Table Partitions with Entity Framework Core
I have a large database that will use partitioned column-store tables in a redesign. Is it possible to specify the partition in the generated sql with Entity Framework Core 2.2?
This is for an Azure ...
15
votes
2
answers
1k
views
Calling SSIS with SSISDB implementation from SQL Server Service broker
The requirement is to call a web service through SSIS and calling the SSIS from a SQL Server Service Broker activated stored procedure.
Here is what I have currently doing:
Queue
CREATE QUEUE [...
15
votes
4
answers
2k
views
How to use DbModelBuilder with Database First Approach to implement Soft Delete
I'm trying to implement a soft delete in our EF 6 project. We are using the database first approach and I noticed that you cannot override OnModelCreating.
When using the Code-First approach it's ...
14
votes
2
answers
6k
views
JDBC getUpdateCount is returning 0, but 1 row is updated, in SQL Server
Anyone ever seen this? I'm using MS SQL Server 2008, and I've tried it with two different JDBC drivers (jtds, and Microsoft's). I run a simple statement to update a row, and it does update it, but ...
13
votes
2
answers
1k
views
EF won't migrate after database restore
I'm going crazy... I've been trying to write integration tests that restore a database. In the process of writing these tests, I've been playing with my SQL Server User Settings. In the end, I pulled ...
12
votes
0
answers
387
views
C# .NET 6 - simple SQL query to read one single (large) record takes forever when run is K8S pod, instantaneous when run in IIS
I have a simple table in SQL Server:
CREATE TABLE [dbo].[MyTable]
(
[Ticket] [uniqueidentifier] NOT NULL,
[UserID] [int] NOT NULL,
[Progress] [int] NOT NULL,
[Created] [datetime2](7) ...
12
votes
2
answers
2k
views
How to make SSAS Dimension attribute data type as Numeric in Excel
I need to your help to change the dimension attribute data type in Excel sheet when connecting cube via excel and I have defined a column as "FLOAT" in Data warehouse and "DOUBLE" in Cube,but that ...
12
votes
2
answers
2k
views
Recent Failures on Delphi TADOStoredProc / D6 and RAD Studio XE2
Thanks to any that can provide some assistance...
Background:
I have an application coded and still supported in Borland Delphi v6. Very recently I have had issues with the TADOStoredProc class ...
11
votes
1
answer
1k
views
SSDT Schema Compare always adding objects, which are "Build = None" in Solution
In my Visual Studio Database Solution, I have some objects, which I had to set Build action = None, due to several reasons (Problems in build caused by OPENQUERY,...).
Unfortunately the Schema ...
11
votes
2
answers
215
views
Azure Recovery Services and SQL 2014 Managed Backups not playing well together
I started using Managed Backups on my SQL server. It has been working well for over a year. It seems to backup the dbs once a week, and take incrementals every 2 hours.
A month ago, we changed our VM ...
11
votes
2
answers
6k
views
System.Data.Entity.Infrastructure.CommitFailedException: C# Multithreading & SQL Server 2012
We have a C# multi threaded (100 threads) program which reads the records from the DB and each thread picks up one record (one Entity Framework connection per thread) and update the a single DB table. ...
11
votes
3
answers
16k
views
Connect to SQL Server instance using pymssql
I'm attempting to connect to a SQL Server instance from a Windows box using pymssql (version 2.0.0b1-dev-20111019 with Python 2.7.1). I've tried the most basic approach from the console:
import ...
11
votes
2
answers
3k
views
Is it possible to change the user account of the localdb instance in SQL Server?
Is it possible to change the user account of the localdb instance in SQL Server? We changed our domain and it is using my old domain account so I can no longer login anymore. Also, I don't believe ...
11
votes
1
answer
14k
views
CHAR(64) or BINARY(32) To Store SHA256 Hash in SQL SERVER
I am debating which datatype to use when storing a SHA256 hash in SQL Server. Should it be CHAR(64) or BINARY(32) ... The column will be part of a unique clustered index. I know that I'm probably ...
10
votes
2
answers
1k
views
Why does a merge into a temporal table with a nonclustered index in the history table throw an error
I get the following error when I try to merge under a few conditions. Is someone able to explain why? Seems like it's a problem with SQL Server itself, but I wanted to post it here to confirm.
...
10
votes
1
answer
32k
views
How to fix "The target principal name is incorrect error" with Microsoft.Data.SqlClient Version=4.0.0
After upgrading to Microsoft.Data.SqlClient Version=4.0.0 got the error:
A connection was successfully established with the server, but then an
error occurred during the login process. (provider: SSL ...
10
votes
1
answer
2k
views
Applying EF Core migrations per tenant schema
I'm working with .NET Core 3.1 and EntityFramework Core 3.1.3.
I'm trying to implement tenant data separation using DB schemas. I've read this. I'm aware it's a little bit outdated, so I've adjusted.
...
10
votes
1
answer
2k
views
Hibernate duplicate primary key on restart using GenerationType.TABLE
We're running into an issue where we have Event subclasses that use GenerationType.TABLE to generate the primary key, and when we restart the servers we are getting duplicate primary key errors.
We'...
9
votes
0
answers
2k
views
Typeorm leftJoinAndSelect with subQuery
I have quite an issue here. I have three tables:
@Entity()
Vessel {
@OneToMany()
workOrders: WorkOrder[];
}
@Entity()
WorkOrder {
@ManyToOne()
vessel: Vessel;
@OneToOne()
order: Order;
}
...
9
votes
1
answer
276
views
Running tSQLt project from sources fails on the due to the Public Token mismatch
I'm trying to do some improvements for tSQLt framework and I'm mostly finish, but can't do that as few tests related to the certificate I wasn't touching are still failing:
[exec] |18|[...
9
votes
1
answer
830
views
Could not synchronize database state with session org.hibernate.exception.ConstraintViolationException because of Duplicate GUID
I use hibernate to insert data in a table using autogenerated GUID, but insertion fails sometimes with duplicate GUID exception.
For Example:
From Logs , insertion fails for the first 2 attempts by ...
9
votes
0
answers
604
views
How to fix: 'After MS SQL Server restart alipne .net core 2.2.5 container which use it has one CLOSE_WAIT tcp connection - CPU of dotnet rise'
I have problem with App that is hosted on official asp-dotnet-core-alipne container and SQL Server on other server. After restart server on which we have SQL, containers gets high CPU and some ...
9
votes
0
answers
204
views
SSIS – How can I fetch custom log entries with my custom log provider?
I try to understand how the SSIS logging behavior works. I create an SSIS package that has a Data Flow Task. The Data Flow Task contains some custom data flow components.
One of them overrides the ...
9
votes
0
answers
4k
views
Why is (Dapper) async IO extremely slow?
I'm using load-tests to analyze the "ball park" performance of Dapper accessing SQL Server. My laptop is simultaneously the load-generator and the test target. My laptop has 2 cores, 16GB RAM, and ...
9
votes
1
answer
745
views
SQL Server : running Sum() Over Partition
I am working on a MS Access frontend with a SQL Server 2017 as backend storing tables and views.
I want to calculate (on the SQL Server side) the quantity of stock (Bestand), remaining stock (...
9
votes
5
answers
7k
views
Sql LIKE in Arabic?
Consider this sample:
CREATE TABLE #tempTable
(name nvarchar(MAX))
INSERT INTO #tempTable VALUES (N'إِبْرَاهِيمُ'), (N'إبراهيم')
SELECT * FROM #tempTable WHERE name = N'إبراهيم'
SELECT * FROM #...
9
votes
1
answer
1k
views
How to map CONTAINSTABLE function in Entity Framework (code-first)?
Thanks to https://codefirstfunctions.codeplex.com/, it is now possible to map functions in Entity Framework (code-first). I am trying to map CONTAINSTABLE function. How can pass the table argument?
...
8
votes
0
answers
4k
views
View to Table Relationship in EF Core 3.1
Using SQL Server with Entity Framework Core 3.1. I have a view that I need to join to a table. This obviously works fine within SQL Server. But I can't get the relationship correctly defined in EF. ...
8
votes
0
answers
4k
views
How can SQL Server client get information on TLS certificate being used?
If a client connects to SQL Server, and a certificate is used to power TLS encryption, how can i get information about that certificate?
Ideally i want all the details, but i'd be happy with
Issuer: ...
8
votes
0
answers
2k
views
How to use glue_data_sql to write safe parameterized queries on an SQL server database?
The problem
I want to write a wrapper around some DBI functions that allows safe execution of parameterized queries. I've found the this resource that explains how to use the glue package to insert ...
8
votes
3
answers
1k
views
Python Hash MD5 not equal to SQL Server
I'm trying to generate the same MD5 codes from Python 3 and SQL but I get always a different result.
With this Unique Identifier f033b004-eb80-412d-9773-f4f06bb994c1
SELECT HASHBYTES('MD5', '...
8
votes
0
answers
866
views
Neo4j with Entity Framework
I need your help to the knowledge on Neo4j with .net, I am trying to integrate Neo4j along with .net application and want to perform CRUD operations on that data. My primary question would be ,
Is ...
8
votes
1
answer
3k
views
SQL Server 2017: Feature Pack Missing File
I use Visual Studio 2015 and Microsoft SQL Server 2017 for a ASP.NET MVC project.
I get an error when I try to connect to the database:
Could not load file or assembly. 'microsoft.sqlserver....
8
votes
0
answers
3k
views
How to determine the currently installed version of sqlPackage
We have an installation process that as part of the installation calls SqlPackage to compare a dacpac file against the database for that particular client, and updates any data changes.
The problem ...
8
votes
1
answer
1k
views
SSIS Connection Manager - Azure SQL Database intermittent failure
We have an SSIS job that connects to a hosted SQL Database in Azure.
Occasionally we get error messages when the connection manager is unable to acquire a connection.
Example error messages:
SSIS ...
8
votes
0
answers
1k
views
DacServices ExportBacpac Exception with Windows Users
I'm using the Data-tier Application Framework (DACFx) in an attempt to export schema and data from a subset of the tables in my database.
var dacServices = new DacServices(connectionString);
...
8
votes
3
answers
6k
views
Getting COUNT and SKIP TAKE in one operation with Linq to Entities
I have a data call in a Linq to Entities powered data access layer that is designed to make paged calls.
In doing so, I need to select a subset of the data, say 50 rows, but also get the count of all ...
8
votes
2
answers
3k
views
Connect to MSSQL server via PHP PDO over SSL
I have a working connection to an MSSQL server via PHP PDO.
$mssql = new PDO('dblib:host=1.2.3.4;dbname=databasename', 'username', 'password');
I now need this connection to be secure, sending all ...
8
votes
2
answers
878
views
Transactional Replication with LocalDB
I searched everywhere but couldn't find an answer. I know LocalDB cannot be a subscriber to merge replication. But what about transactional replication?
I've tried both the SQL Server Management ...
8
votes
1
answer
1k
views
Hide relationship from a SQL Server database diagram
I am using SQL Server 2005 database with SQL Server Management Studio.
Is there a way to hide a relationship between two tables in the diagram without actually deleting the relationship from the ...
8
votes
5
answers
30k
views
What can cause the SQL Server JDBC error 'The value is not set for the parameter number 0' for an output parameter access?
I have some Java code that accesses SQL Server 2005 which looks something like this:
CallableStatement cstmt = ...;
... // Set input parameters
cstmt.registerOutParameter(11, Types.INTEGER);
cstmt....
8
votes
3
answers
12k
views
SQL Error "uncommittable transaction is detected at the end of batch" without transactions on db
I'm facing the following problem at different points of my code.
An SqlException is returned from DB (SQL Server) with message "Uncommitable Transaction is detected at the end of the batch. ...
8
votes
4
answers
15k
views
Mirroring - server network address cannot be reached or does not exist
I have read a number of articles on how to configure mirroring on SQL Server 2012. I went through the steps and everything worked until hitting the final step, which didn't work.
When I run this on ...
8
votes
2
answers
4k
views
How to Set value dynamically in setvar variable SQL
I am using SQLCMD mode. I want to set setvar variable value.
How should I set value in :setvar?
My Code are look like this :
DECLARE @DatabaseName AS nvarchar(180)
set @DatabaseName = '$(dbName)'
...
7
votes
0
answers
709
views
SQLAlchemy ORM not sending prepared statements to SQL Server
We use SQL Server with SQLAlchemy in this case. When looking at our plan cache we noticed tens of thousands of single use adhoc compiled plans. As you know this takes up a ton of memory, and every ...
7
votes
0
answers
1k
views
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:
Registering converter from class microsoft.sql....
7
votes
0
answers
404
views
AWS Fargate, .NET Core app with SQL Server fails to connect to failover partner following database failover
We are experiencing an issue with a simple .NET Core (3.1) console app connected to a SQL Server database and deployed in a container on AWS Fargate (ECS). SQL Server is a mirrored setup (principal/...