Stack Exchange Network

Stack Exchange network consists of 174 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange

Questions tagged [sql-server]

All versions of Microsoft SQL Server (not MySQL). Please also add a version-specific tag like sql-server-2016 if that is relevant to the question.

7
votes
1answer
261 views

Why is the auto created statistic on this column empty?

Info My question relates to a moderately big table (~40GB data space) that is a heap (Unfortunately, I am not allowed to add a clustered index to the table by the application owners) An auto created ...
0
votes
2answers
29 views

How to find tempdb reside in drive location with drive size and tempdb usage details in single query in sql server?

How to find tempdb reside in drive location with drive size and tempdb used details in single query in sql server?
-2
votes
2answers
31 views

Does each node of SQL traditional cluster have separate master database

In SQL server traditional cluster, does each node of cluster has their our own master database? I am sure physically they don't...but logically might be?? Also as we know that the method of applying ...
1
vote
1answer
28 views

AlwaysEncrypted error when inserting via stored proc

lets start with the error first: Encryption scheme mismatch for columns/variables . The encryption scheme for the columns/variables is (encryption_type = 'PLAINTEXT') and the expression near line '3' ...
0
votes
0answers
20 views

Convert Access '97 .mdb plus C++ executable 32 bit to SQL Server and ODBC

I am designer of a legacy app running Access '97 3.5 Jet .mdb plus C++ executable. Uses CDaoDatabase structure. Only runs on 32 bit Win OS. Will open .mdb under WOW64 but gets no further. I need to ...
0
votes
0answers
24 views

Enabling EFS on FileStream Folders

Please help me on below: Below is my Environment: Windows Server 2012 R2 Standard SQL Server 2014 SP2 GDR Availability Groups 2014 with 3 Node (2 Sync and 1 BCP async) I have 7 Databases with ...
-1
votes
1answer
19 views

fill months in a Group By

so im using this query: SELECT count(ID) AS Count, enrolMonth FROM Accounts GROUP BY enrolMonth. The problem is i dont have any records in January and March, so obviously, with that query i receive ...
0
votes
1answer
22 views

Change SQL backup location

We need to change the SQL backup location from one network share to another network share. The new share name is different from the old share name. I am thinking to update the "command" column and "...
0
votes
2answers
42 views

Fill Factor for OLTP database

I am setting up a new OLTP database and expect to write to the database about 70% of the time and read from it around 30% of the time. Given this criteria, I'm wondering what would be good practice ...
0
votes
0answers
56 views

Is it possible to audit query results in SQL Server?

I want to find out if it is possible to audit the results of any query that gets executed on an instance of SQL Server. We currently have C2 auditing enabled, but this only showed what query was ...
2
votes
1answer
59 views

Multiple applications accessing SQL Server [closed]

This is my first post and am very new to MS SQL Server. We have MS SQL Server running on an existing server. We have a software application that is utilizing the SQL Server as its back-end. We are ...
5
votes
3answers
412 views

How to inspect global temp table from outside the transaction it is created in

To help debugging a batch of SQL (that is run inside a transaction), inside the transaction I dump some data into a global temporary table. The global temporary table is created inside the transaction ...
1
vote
1answer
27 views

Limit LAG function to a subset

I'm having a difficult time wrapping my head around this issue. I need to get the previous status of our finished customers. I learned about the LAG function and it almost does what I need, but the ...
0
votes
0answers
19 views

Make ER diagram of DataBase

DataBase colom Demo Date | Name| WorkType(1,2) | TowerType1 | TowerType2 | TowerType3 I want to make ER diagram and make relation of 1 to many or many to many of Fiber Company in which WorkType will ...
2
votes
1answer
64 views

How to Deny permissions for newly created user in DDL Trigger?

I'm having trouble with a SQL DDL trigger for Create_User and I'm wondering if there is an issue with my syntax or something else I'm not seeing? I have some tables in my database which are only ...
4
votes
2answers
404 views

Why does an index rebuild requires a Sch-M lock?

I don't see why an index rebuild would require a Sch-M lock on the given index.
1
vote
0answers
38 views

SQL Server The operating system returned error 21 (The device is not ready.) - can I recover without restarting the server?

So I have found the related questions and answers about how to avoid having a disk not ready issue when SQL Server starts, which appears to be the cause of the OS error 21 (Device not ready) error ...
0
votes
1answer
14 views

Contained User within a Non-Contained Azure SQL Database

While granting access to Azure SQL databases I have been creating Contained Users directly in the SQL database like so:- CREATE USER [email@domain.com] FROM EXTERNAL PROVIDER; As this has been ...
6
votes
1answer
228 views

Execution plan doesn't show memory grant

I installed SQL Server 2019 on a VM on Azure (DS11). I am trying to illustrate adaptive query processing using this post here. The issue is that when I hit CTRL+L in SQL Server Management Studio to ...
2
votes
1answer
71 views

Reading 300% rows - Problematic execution plan

Whole queryplan and query: https://www.brentozar.com/pastetheplan/?id=BkgbANxN4 I am struggling with a query that uses a lot of time. The obvious reason for this is wrong estimates of amount of rows....
2
votes
1answer
148 views

Merge/Intersection between table and dataset - How to achieve?

Consider the following table: Id Hash ----------- ---------------------------------- 1 0x31F777F0804D301936411E3ECD760859 2 0xD64A593F3E9ACC972158D522A4289EA0 (Id is an ...
0
votes
1answer
52 views

SQL Server indexes Work Sometimes [duplicate]

So I have the following indexes on my table: CREATE NONCLUSTERED INDEX [$5] ON [dbo].[Record Link] ( [Company] ASC, [Record ID] ASC )WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, ...
0
votes
2answers
25 views

Query to insert data into columns and check for pre-existing values for those columns data

I have table t1 and t2 with same column names in both tables, column a and b. I want to enter data of column a and b from t2 into t1 at the same time check weather any data pre exist in t1. If data ...
0
votes
1answer
52 views

Bad query plan only on first execution, not in SSMS

We have a very customizable report query system where the user can pick and chose which columns to include in the results as well as a lot of filters. I'll be mapping what we're doing onto an example ...
0
votes
2answers
28 views

SQL Server Transactional Replication - what is sp_MSreleasesnapshotdeliverysessionlock?

Occasionally when creating and finishing a snapshot to re-sync data, some of the subscribers seem to hang about for several hours afterwards before they start to take the snapshot. There's no blocking ...
3
votes
1answer
71 views

SQL Server 2016 with high tempdb usage and low RAM usage

I've got a small instance of SQL Server Standard that I'm running HammerDB TPC-H (1 GB) benchmarks on. It's got some configuration issue though where it's writing everything into tempdb on disk, and ...
1
vote
1answer
30 views

Unable to revoke permissions for 'NT AUTHORITY\SYSTEM' on SQL Server 2016

I have tried everything I know to do and spent several hours Googling without success. I want to revoke the SHUTDOWN and CONTROL SERVER permissions for the login NT AUTHORITY\SYSTEM. When I run this ...
6
votes
5answers
397 views

How to get Current Shift?

Question How can I retrieve the current shift record based on getdate() and which lies between the existing ShiftStartTime and ShiftEndTime as per the defined table and data? It is possible get ...
0
votes
1answer
28 views

How to trace security_error_ring_buffer_recorded errors in SQL Server 2014 Express

Just so everyone doesn't have a high expectation of my level of knowledge on this topic, I'm not a DBA; I'm a .NET developer who has to try and figure this out by virtue of being "the one most likely ...
-2
votes
1answer
56 views

Centralized Logs (error, deadlocks, slow queries) For SQL Servers

I want to establish a centralized log for many SQL Servers, similar to the products Graylog or elk stack. What is the best and performant way to send these kind of logs to a log collector? I ...
0
votes
1answer
20 views

Where does Attunity's CDC services write error data?

We use Attunity's CDC services to move data from Oracle to SQL Server. Using the Oracle CDC Designer snap-in tool, I can see the current status of the service and an error message if a problem has ...
1
vote
1answer
28 views

How to Convert List of values datatype in oracle to equivalent or valid datatype in sql server?

I want to recreate the table below in SQL server I have tried using SSIS but it does not know how to handle the lOV Data type how can I recreate this table in SQL server and migrate the data to it. ...
2
votes
0answers
50 views

Recommendations around managing large amounts of data that needs to be aggregated (SUM)

I am looking for alternatives to redesign a part of our system that needs to perform cumulative SUMs over large data sets of rows based on user and dates. How the system works We are running a web (...
0
votes
2answers
67 views

Create SQL login to multiple instances at once

I have a AD group that needs to be added to multiple SQL instances, I am wondering is there a quicker way of adding this group at once rather than having to login to each server and creating a login ...
0
votes
1answer
39 views

What is the SQL Server cost, in terms of performance, of sharing physical disks?

I am an application user in Health Care. The application relies on communication with a large database, including image data and other large numeric arrays. We add approximately 15GB per day to the ...
1
vote
0answers
44 views

A transport-level error has occurred when receiving results from the server [duplicate]

Our application is made from asp.net webforms using framework 4.5. And since migrating to Amazon AWS from an inhouse server. We've been flooded by this error through out our system. On the software ...
4
votes
1answer
209 views

Covering Index Changes Execution Plan but is not used

I have the following occasionally slow running query: SELECT C.CustomerID FROM dbo.Customers C WITH (NOLOCK) WHERE C.Forename = @Forename AND C.Surname = @Surname OPTION (RECOMPILE) CustomerID ...
2
votes
2answers
31 views

How to grant user rights to create stored procedures in a custom schema

I'm trying to grant SQL Server login rights to create stored procedures and bind them to a custom schema. In this case I've created a schema called IC. A service account will then be added to the ...
-1
votes
1answer
78 views

Index vs Statistics [duplicate]

In SQL Server, when to create statistics only on a table column instead of index and when create to index (which creates statistics as well automatically)? I mean both improve query performance then ...
-1
votes
0answers
20 views

Splitting comma separated values into rows [duplicate]

SELECT A.substance, Split.A.value('.', 'VARCHAR(2000)') AS String FROM (SELECT substance, ID, CAST ('<M>' + REPLACE(substance, ',', '</M><M>') + '</M>' AS XML) ...
0
votes
1answer
51 views

Raid 1 or Raid 1+0 for SQL Server Architecture

We are looking at new servers. Today our SQL Servers are built as follows: C/D on RAID 1 , E : Tempdb on RAID 1, F:log files on RAID 1 , G : Catalog data on RAID 1 , H: model data on RAID 1 , ...
1
vote
1answer
53 views

Tempdb ndf files on different drives

So I inherited a server that has serious write latency issues according to a script provided by glen berry, I also noticed that the tempdb files are spread across multiple drives. What could be the ...
2
votes
1answer
26 views

Monitoring CDC (Change Data Capture) performance

We currently have in place CDC, DW team is reading data, everyone happy. Then we needed to add couple new columns. Easy peasy following this answer... well, actually we had some hiccups but that's ...
0
votes
2answers
70 views

Using Ola Hallengren's full backup but database option is for simple?

Each database on the server is set for simple recovery. I'm using Ola's script with 'full' in the script. I tried looking on Google, but it seems backup and recovery are almost synonymous. Is there ...
-2
votes
3answers
56 views

Determine which data a SQL login account has access to?

I am a new DBA and am trying to do some documentation on the SQL estate that I am responsible for. Currently I have no documentation on anything so this is all from scratch. I am hoping to find out if ...
1
vote
1answer
30 views

2 tables with foreign keys to 3rd table with primary key

This might be a silly question. But can you have the following: 1 Table with Primary Key, 2 different tables each with a foreign key referencing the first table Primary key? I know its possible to ...
1
vote
1answer
71 views

Where/When is the use of RBAR buffering related to ASYNC_NETWORK_IO waits negotiated between the Client/SQL Server [closed]

Where/When is the use of RBAR buffering related to ASYNC_NETWORK_IO waits negotiated between the Client/SQL Server, or Is it always utilized as in that is just how SQL Server spools data to the client?...
1
vote
1answer
59 views

Can I query from two databases if my web application is connected to one database?

I have a local database, DB1, that I created and is connected to my web application. My web application takes in stored procedures from DB1 and queries them. My application connects to SQL Server ...
3
votes
1answer
35 views

When I run mssql-cli, I get “No module named mssqlcli”

I just installed mssql-cli with pip, pip3 install mssql-cli Then I try to run mssql-cli and I get $ mssql-cli /usr/bin/python: No module named mssqlcli
2
votes
2answers
83 views

Slow query that includes a WHERE clause with SUBSTRING

I have the following query in SQL Server 2016, as there is no code for the "enter code here" column, I had to do a search with SUBSTRING. But as expected it is slow, the query ends in 00:03:37. with ...