Stack Exchange Network

Stack Exchange network consists of 175 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, since it is often relevant to the question.

1
vote
1answer
20 views

How to prevent concurrency issues in a ssis package?

Have a SQL Server 2017 Server. Have several SQL Server jobs that call a single SSIS package using the SYNCHRONIZED flag. In the package there is a data flow that runs a stored proc (please see below)...
4
votes
1answer
63 views

Update Intersect hangs

We have this really weird behavior we just started experiencing with our update intersect statements. These were working fine, but now we are ingesting a pretty wide data source in terms of columns ...
1
vote
2answers
189 views

My database got in to suspect mode, I repaired it using dbcc, but I want to know cause

Following is the out put of dbcc checkdb. Msg 5282, Level 16, State 2, Line 1 Table error: Object ID 683941979, index ID 1, partition ID 72057608853127168, alloc unit ID 72057610800988160 (type ...
0
votes
0answers
13 views

Cannot find slow (frozen) running query in Query Store

I have huge issues with a stored procedure that has not finished the last week. It seem slike it stops at around 140 000ms of CPU time and freezing there, while the elapsed time increases. This makes ...
4
votes
2answers
83 views

Very similar queries, vastly different performance

I have two very similar queries First query: SELECT count(*) FROM Audits a JOIN AuditRelatedIds ari ON a.Id = ari.AuditId WHERE ari.RelatedId = '1DD87CF1-286B-409A-8C60-3FFEC394FDB1' ...
5
votes
2answers
58 views

How can we trim bad data and output clean trimmed data using DQS or MDS?

Until now, we have used stored procedures for data massaging and cleansing but we have now decided to move to using Data Quality Services (DQS) and Master Data Management (MDS) in our data warehouse ...
0
votes
1answer
285 views

Communition Link Failure

I want to make a DNS to a sql database by SQL Driver. so I do it as it should be done. I have over hundred Clients with Windows 7 OS. All of them can connect to the database easily just a few of them ...
3
votes
2answers
353 views

Why do nonclustered Indexes use clustered indexes instead of the table data pages directly?

From a Microsoft Course (presented by a third party) I learned that when a table has a clustered index even non-clustered indexes hit the clustered index. When there is not a clustered index (Heap) ...
0
votes
0answers
12 views

non cluster index store the cluster key instead of RID [duplicate]

I was reading a textbook which says: "Remember that the clustered index defines the actual physical ordering of the data rows on the disk. If a row is updated such that its cluster key changes, that ...
0
votes
0answers
14 views

What will this nonclustered index's root and non-leaf level look like? [duplicate]

Let's say we have an Employee table with columns EmpID, FirstName...etc. and EmpID is the primary key. Say there is no clustered index, and we create a nonclustered index on FirstName. I know leaf ...
0
votes
0answers
4 views

Migrating AWS RDS SQL Server to a smaller RDS instance

I am in the process of migrating an AWS RDS SQL Server to another instance of AWS RDS SQL Server with lesser storage. AWS folks suggested using the native backup/restore option instead of DMS. Steps ...
2
votes
2answers
3k views

What are the names of SQL Server database statuses 24, 1024 and 65544?

using the following query: SELECT Name, Status FROM dbo.sysdatabases WHERE name IN ( 'db_name' ) I get in some cases status = 24, other times 1024 and other times 65544 I see that even when status ...
3
votes
1answer
8k views

Permanent count of waiting tasks (2) in Activity monitor

Now I'm observing in Activity Monitor permanent count of waiting tasks: and at "Resource waits" tab I see next: so, my question is: How to find and resolve this wait tasks? I suspect that it ...
0
votes
2answers
406 views

Appending a Unique “transaction id” to Audit table with Audit trigger

So I have a working audit trigger that tracks inserts, updates and deleted as well as the PK of the table and it's value. My problem is, since our apps use app accounts use an app ID, it's difficult ...
0
votes
1answer
28 views

How do I get more control over backup file retention using Ola Hallengren's DatabaseBackup solution?

I've noticed some unexpected behavior using the database backup job in Ola's Maintenance Solution. On the test instance I'm working on, I have the user database backup job scheduled to run at 2:00am ...
-2
votes
1answer
27 views

How to find out NOT NULL attributes in tables

I need a query that returns a list of attributes in a table that cannot be null.
1
vote
0answers
13 views

Can CyberArk Manage SQL Credentials To Synchronize Password Changes?

My organization utilizes CyberArk to force expiration & reset of administrator & service account passwords on the domain. When it comes to SQL Server-related assets, I'm hitting an impasse ...
2
votes
0answers
19 views

Is it possible to setup a CREATE_LOGON trigger that treats AD Groups differently from users?

Just started in a DBA role with a new organization and they gave me a bit of a head-scratcher. We've got a trigger on CREATE_LOGON that DENYs VIEW ANY DEFINITION & VIEW ANY DATABASE. This was ...
8
votes
1answer
58 views

initdata: No memory for kernel buffers

I recently upgraded my SQL Server 2017 Developer Edition on RedHat Enterprise Linux 7.6 to SQL Server 2019 CTP 3.0. The mssql-server service will no longer start. /var/opt/mssql/log/errorlog shows ...
12
votes
4answers
25k views

Only one administrator can connect at this time (MS SQL Server error 18461)

I was experimenting the effect of giving SQL Server a small amount of memory I thought it was going to recover. I configured SQL Server to use 200MB of memory now it does not want to start, I did ...
1
vote
0answers
13 views

SQL Server Database auditing not working

I'm setting up auditing on a SQL Server Managed Instance in Azure (Version = Microsoft SQL Azure (RTM) - 12.0.2000.8). Following the instructions in the link, everything worked for server-level ...
0
votes
0answers
25 views

Striped SQL Backup - Benefits [duplicate]

We have a 3TB database, and current backup schedule is - Weekly Full Backup, Daily Diff and hourly transaction log from maintenance plans. All these backups are performed using Backup command and ...
2
votes
2answers
32 views

Job Information - When querying [msdb].[dbo].SYSJOBS_VIEW through linked server

I am trying to build a report to query all my sql server jobs and thier status from the previous night's run. In an effort to have just one report instead of a separate report for each server, I am ...
5
votes
3answers
130 views

DBCC checkdb on tempdb

Is it recommended to run DBCC CheckDB on tempdb? If yes, can someone please list out the reasons to do so? This could be on any SQL Server version. The one I have is SQL Server 2017.
0
votes
1answer
280 views

Cannot start sql server in antergos linux: Unit mssql-server.service has a bad unit file setting

I can no longer start sql-server on antergos linux. This is what I tried so far (following this link): $ sudo systemctl status mssql-server.service ● mssql-server.service Loaded: bad-setting (...
6
votes
1answer
66 views

Cannot insert duplicate key row on a non-unique index?

We've been encountering this strange error 3x the past few days after being error free for 8 weeks and I'm stumped. This is the error message: Executing the query "EXEC dbo.MergeTransactions" ...
1
vote
1answer
19 views

SQL sort by sum of two different where clauses in a join

table1 ID | Name 1 ID1 2 ID2 3 ID3 table2 ID | table1ID | Values 1 1 3 2 2 3 3 3 2 4 1 3 5 2 1 6 3 2 7 1 ...
2
votes
2answers
195 views

SQL Server - Basic Availability Groups used for Publisher, Distributor and Subscriber databases?

I see recently support has been added so that the Distributer can be hosted with AlwaysOn AG. https://blogs.msdn.microsoft.com/sql_server_team/replication-enhancement-distribution-database-in-...
-1
votes
1answer
54 views

Truncate multiple tables after finding those tables using a select query

I want to truncate tables I find, all in 1 script. I have the select criteria now I need to truncate these tables. 1 problem I have is it can be different tables every time I run the query. SET ...
4
votes
1answer
1k views

Increase memory limit when server is stopped

There was a local SQL Server 2012 instance. Once memory has decreased to critical 128 MB and then has stopped by me. I can not start it (idea: not enough memory). Is it possible to increase this ...
2
votes
1answer
175 views

Error when trying to start Microsoft SQL Server 2008 instance from SQL Server Configuration Manager

I get this error when I try to start Microsoft SQL Server 2008 instance from SQL Server configuration manager. SQL Server configuration manager : The request failed or the service did not respond ...
0
votes
2answers
115 views

MSSQL Instance Alias - how does it work

Ok I'm trying to understand how a MSSQL Alias works but documentation is lacking to say the best. Most blogs/videos/documents I can find state that all you need to do is go to SQL Server ...
0
votes
0answers
13 views

display data from database query in Java Jtable [on hold]

I've created a database using MSSQL and connected it to my Java application using gui of netbeans (services>database>new connection.....). Now i'm trying to show data from database using some examples ...
0
votes
0answers
25 views

Allocating Hours From Operations Table to Available Hours in Availability Table

I have a scheduling problem… The database is SQL Server 2017. The data comes from one Table and one View… Operations_TBL Operation_ID Resource_ID_Link Operation_Start_By_Date ...
0
votes
1answer
21 views

Problems with Listener in AlwaysOn AG in AWS

I have a 2 node AlwaysOn AG cluster with a single database being replicated between the 2 nodes. Windows Failover Clustering Services are installed on each node. The AG is configured to allow ...
-2
votes
1answer
38 views

Query syntax error [on hold]

I tried a lot but can't find what is wrong with this query, It gave me this error: Incorrect syntax near ')' WITH cte AS ( SELECT * FROM ( ...
1
vote
0answers
17 views

DCM page in Filestream_Data_Filegroup

I'm doing some research about the DCM (Differential Change Map) page in SQL Server 2016. This is what I discovered so far: page type: 16 each DCM page covers a GAM interval each data file has a DCM ...
-3
votes
0answers
23 views

how to remove the same value in SequenceNO column [on hold]

declare @projectid int=1 SELECT * FROM (SELECT ROW_NUMBER() OVER (ORDER BY Branch.id) AS SequenceNo, 1 AS FilterD, Installation.name AS Installation, Installation.anum AS ...
5
votes
5answers
9k views

Why might Sql Server Agent's Next Run Time value not be what I expect? And is this definitely the next time my job will run?

At times, I'm seeing some inconsistencies with sql server agent's value in the sysjobschedules.next_run_date and time fields. I have a web interface that interacts with the sql scheduling system. I'...
0
votes
2answers
43 views

Multi-site Failover Cluster Instance for HA and DR to alwaysON Availability Groups

In my company we have chosen to implement Multi-site SQL Server Failover cluster. Basically Data center A has 2 nodes (Active/Passive) and Data Center B geographically located acts as the DR. I ...
0
votes
2answers
80 views

Background Index Creation on SQL Server

I have no maintenance plans yet I see indexes being created in the background (low spid). I have no idea what indexes are being created or why. Using Standard SQL Server 2017 - a VM on Azure with SQL ...
4
votes
1answer
47 views

sp_whoisactive @get_locks parameter xml error

I often receive this error when running the following command sp_whoisactive @get_locks = 1 Msg 6841, Level 16, State 1, Procedure sp_WhoIsActive, Line 4287 FOR XML could not serialize the data ...
1
vote
1answer
28 views

SQL Server Replication and Recovery Model

In SQL Server for Replication when recovery model is not very important then how it saves the transactions and also keeps the secondary instance in sync? I tried to check on MSDN and found the ...
2
votes
1answer
55 views

Unexplainable DBCC CHECKDB Command Output

Microsoft SQL Server 2017 (RTM-CU14-GDR) (KB4494352) - 14.0.3103.1 (X64) Mar 22 2019 22:33:11 Copyright (C) 2017 Microsoft Corporation Developer Edition (64-bit) on Windows Server 2016 Datacenter ...
1
vote
1answer
345 views

SQL Server 2012 Import Wizard appending new data only

I am using SQL Server 2012's Import wizard to import data from DatabaseA to DatabaseB. Source: DatabaseA table A Destination: DatabaseB table B I have written a source query that does the job fine, ...
1
vote
1answer
21 views

PIVOT function Says Invalid Column

I'm trying to teach myself to use the SQL Server 2012 PIVOT function, using the old example pubs database from Microsoft, I have written this code.. SELECT [au_lname], [CA], [OR], [IN] FROM (...
0
votes
2answers
60 views

How to merge records in SQL

I have a table with multiple records for each ID. For example, there may be three or more records for one Class ID): one record with a status of "approved" and two more records with status NULL, or ...
-4
votes
0answers
37 views

Merging multiple records into single record [duplicate]

Here is my question via an example: Now, I want a single record with column T approved and COLUMN W,X WITH 12 VALUE EXAMPLE:
1
vote
2answers
1k views

Powershell to dump database schema to text file

I want to be able to dump a database schema to a sql text file using Powershell. I want this because our DBAs want to be able to do a diff on the file that is committed to SVN. They won't execute it ...
1
vote
1answer
137 views

“CREATE INDEX” Background process in SQL Server [duplicate]

While analyzing our environment, I've noticed a recurrent blocking that usually happens around the same time, our monitoring tool says the blocked process is a "CREATE INDEX", however, the index ...