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.

Filter by
Sorted by
Tagged with
-4
votes
0answers
15 views

any one can help me for this SQL Server question? [on hold]

I cannot answer questions 3.i, 3ii, 3iii and 4. If possible please help me and solve these questions I really appreciate it I wrote some query and build my database I can not attach my database to ...
1
vote
0answers
12 views

How can I run SQL Server Vulnerability Assessment from a SQL Job?

I want to run SQL Server Vulnerability Assessment from a SQL Server Agent Job. Currently, I am attempting a job with a PowerShell script and am running a command like the one below. Invoke-...
0
votes
0answers
14 views

SSIS Slow Data Transfer between Oracle and SQL Server 2016

I am currently assigned the task to translate a process that transfers data from an Oracle source towards an SQL Server 2000 with a Linked Server to an SSIS package that directly accesses Oracle. I ...
4
votes
0answers
83 views

Why can't SQL Server optimizer use foreign key

I have the following tables: ToBeTransferredTemp (ID varchar(100),type varchar(100) NOT NULL, other...) CODES(IDSTRING varchar(100), other...) I have the following query: SELECT * FROM ...
1
vote
1answer
29 views

Is there a way to group the output of a query based on two rows

I'm not sure my question is asking the right question, so i will be as specific as possible in here. I have the following data which i have changed the values of. Below is the code I am using to ...
0
votes
0answers
46 views

SQL stored procedure returning 0x000000000

I have a stored procedure that executes a number of selects for variable setting ,update and delete queries etc. The stored procedure executes manually without error but in the messages shows ...
0
votes
1answer
22 views

declare table variable inside function

In my stored procedure, I have table variable with a lot of columns. Because I want to simplify the stored procedure I thought i could declare table variable in function like CREATE FUNCTION [dbo].[...
0
votes
0answers
39 views

A Procedure Causes Some Blockings In SQL Server [on hold]

There is a stored procedure in my sql server database and it causes so much blockings for itself. Here is the code. How to solve this issue? USE [FATURA] GO /****** Object: StoredProcedure [dbo]....
-1
votes
0answers
25 views

SQL Server crash? [on hold]

My Application on .Net framework using entity framework. I am using stored procedures also sometimes SQL server crash and need to restart server.how to trace why this problem occur?
2
votes
1answer
30 views

Restore stuck in ASYNC_IO_COMPLETION

Very frequently when I restore databases the restore operation gets stuck and the wait type is ASYNC_IO_COMPLETION. It can be in such state for 10-20-30 minutes untill it proceeds to ...
0
votes
0answers
17 views

Data Loss issue while migrating data from Source(Oracle) to Data Warehouse Staging Database(SQL Server)

Project Overview Loading data from Oracle Database to Datawarehouse Staging Database(SQL Server). Using ETL process we are loading data from Oracle to SQL Server. Staging Database in SQL server is an ...
0
votes
1answer
25 views

SQL Server - Log file not shrinking in AlwaysOn group

We have three-node AO setup in SQL Server. Primary node, one secondary node in Sync mode and another secondary node in Async mode. Main Database on Primary node, log file-size is 434GB, Used 99.91%. ...
-1
votes
1answer
33 views

How can I achieve the below case in marketing cloud without using loop? [on hold]

I have a table like this and in the table you can see 123 losing to 456, 456 losing to 789 and 789 losing to 101112 and in the same fashion for ID's 5 and 6. In this case I want to replace winner ...
-1
votes
0answers
24 views

Insert into select 2 million row takes 1 hour sql server [on hold]

I am trying to insert into a table with select which returns around 2 million rows, this insert takes an hour, the query has just one where clause which is a date. nothing else.The table has 84 ...
2
votes
1answer
45 views

Optimize query that only returns when the number of rows to be returned is less than an amount

I have a query that first counts the number of rows to be returned and, if it's below a limit, it returns those rows, else it returns nothing. For context: I have a map that displays some points ...
0
votes
2answers
37 views

SQL Server Always on Three node Cluster

We have two data centers DC1 and DC2 The distance between two DC's are about 200 miles. DC1 - has two nodes DC2 - has 1 node with SQL 2012 Always-On AG and windows 2008R2 Node majority cluster ...
0
votes
1answer
26 views

Specifying Order of Executing Stored Procedures [on hold]

Issue: The order in which my stored procedures are called produces no errors if run independently, but when run as once, yields the following error: Msg 2627, Level 14, State 1, Procedure ...
3
votes
1answer
30 views

SQL Server Plan Cache and Batch Request ration to Compiles

I am wondering if I am overreacting and need advice from SQL DBAs. I am working with a client who has a DBA. After some research on my part I am seeing 16GB of cache dedicated to single use ad-hoc ...
0
votes
1answer
24 views

Moving SQL server 2016 DB's from mirroring to HA

We have Windows Server 2016 machines with SQL server 2016 standard edition. Currently mirroring is implemented and now are planning to move to HA with 1 listener for each DB. We have multiple DB's ...
8
votes
4answers
800 views

How do I intentionally fragment a SQL Server Index?

I would like to create bad indexes conditions intentionally on a SQL Server 2017 test database I have, just to better understand these maintenance scripts? SQL Server Index and Statistics Maintenance ...
1
vote
1answer
32 views

How to determine CHECK or NO CHECK for foreign Key using SQL Server System Tables

I need to know at a low level whether a foreign key is to be exported as CHECK or NO CHECK but can't find out where to find that information. I am using -- using INFORMATION_SCHEMA to enumerate ...
2
votes
2answers
32 views

composite clustered index with partitioning

I have a table with hundreds of millions of rows. Data is regularly retrieved via various queries and inserted. There is a clustered index on LookupID (int) TypeID (int) Created (datetime) (These ...
3
votes
1answer
123 views

How can I get rid of this Lazy Spool, or otherwise improve this query's performance?

Here is the plan: https://www.brentozar.com/pastetheplan/?id=rkM8d7ONS I am mostly interested in how to get rid of the lazy spool? This is the query: SELECT DISTINCT SM.Security_ID '...
0
votes
1answer
49 views

Microsoft SQL Server Metadata Corruption

we have a bad incident right now. One of our larger SQL databases has broken metadata. unfortunately the warnings were ignored and they worked a week on the broken SQL database. Is it possible to ...
-2
votes
1answer
51 views

SQL Server Multicasting - Will it improve performance? [on hold]

Apologies in advance for the vagueness of this question. We're having a new product installed and it's performing really badly. I don't have access to any diagnostics - for this example, let's ...
1
vote
1answer
36 views

Can Extended Events used instead of Auditing?

In BOL it is mentioned does this mean Extended Events can capture all the events that are traced by auditing? Can we get all the functionalities of auditing just by using XEvents? thanks
0
votes
1answer
21 views

How to Configure Always Encrypted using PowerShell

I just want to ask if there is a way to configure always encrypted columns using power shell? like for example i want to encrypt a column in a table with deterministic using powershell codes?
-3
votes
1answer
62 views

Check BIT Column [on hold]

I have the following table: Id – unique number for every user. There will be no more than 2^63-1 users. (Auto incremented) Username – unique identifier of the user will be no more than 30 characters (...
1
vote
1answer
38 views

Log shipping always failing with NUL

I have configured a log shipping for our company's primary database to restore on a separate server, with the restored database serving as report database. The problem is that every few days, the log ...
2
votes
2answers
60 views

Log file won't shrink - suggestions?

I have a 225GB DB with a 390GB log file, which has only recently exploded in size. I am trying to shrink it - per these instructions: https://www.brentozar.com/blitz/transaction-log-larger-than-data-...
0
votes
1answer
43 views

Application/MS SQL Server Express Installer

We're developing a small(ish) application that collects and stores data. It's low-throughput, low-volume, but needs to be able to archive and retrieve data from (almost) arbitrarily earlier times, ...
0
votes
1answer
34 views

Disk errors in one of the SQL cluster nodes and SQL patching was failing with a lot of errors related to disk and permission issues

We have two cluster nodes in a SQL cluster and the application use this cluster is Microsoft Identity Manager. Since few month both nodes ( Node 1 and Node2) are throwing disk error and SQL team is ...
4
votes
1answer
89 views

Get the full text of a long request

How to get the full text of the request from the following request: SELECT t.[text] FROM sys.dm_exec_requests AS r CROSS APPLY sys.dm_exec_sql_text(r.sql_handle) AS t Here, with a sufficiently long ...
3
votes
1answer
50 views

What happen with the Log backup if I set the SQL Server clock back?

What happen with the Log backups if I set the SQL Server clock back? In countries with daylight saving this happens at least once a year. Will the point in time restore with the STOPAT option fail? ...
0
votes
1answer
71 views

Multiple mdf, empty one is missing

Hi guys i have a big problem. I know i did such stupid and unforgivable mistake. And know please help me if you can. I wanted to make copy of database. I should make it by backup and then restore as ...
-1
votes
3answers
58 views

SQL Server Always On Availability Group [on hold]

I have problem with MS SQL Always On Availability. Suppose the connection between primary and secondary replica is broken. The client inserts data to the primary database (replication cannot be done ...
4
votes
1answer
76 views

SQL Server query scanning more partitions than expected

So my team has the following select statement in one of our stored procedures SELECT ai.Name ,dc.Component ,SUM(dc.Value) Value FROM Warm.DailyCosts dc JOIN Warm.AccountInfo ai ...
0
votes
3answers
39 views

In-place upgrade vs. new install

My search for this question yielded some similar questions, but none that I could see exactly like this. Question: In your experience, when doing a SQL Server upgrade, say from 2008 to 2017, or from ...
0
votes
0answers
10 views

I'm using Transaction Replication and some commands are deadlocking on the subscriber, do I need to re-initialize replication?

I'm trying to understand the nuts and bolts of transactional replication and I have a few questions: 1) If a subscriber command fails to replicate, where is this logged? 2) How am I notified if a ...
-2
votes
0answers
20 views

What would be the suitable certification for SQL Data protection and privacy? [on hold]

This posting is not related to any specific issue. I couldn't find suitable Certification code related to SQL Data Protection , Privacy , SOX ( Sections 302,404,408, 409 etc..) What would be the ...
1
vote
3answers
102 views

Slow query in production, bad execution plan or bad index?

I've just fixed a production performance issue by dropping an index and recreate it. I suspect dropping the index also dropped executions plans that used it and one of them happen to be bad. ...
0
votes
3answers
42 views

Return rows that meet a condition in two different columns

I have the following table describing the color and smell of an animal. I am trying to filter it to see what animals are the same color and smell. I do not care if multiple animals use the same color ...
4
votes
1answer
36 views

Generating Error when data size is larger then max text repl size

I recently ran into an issue with where an application tried to do an insert with data over the max text repl size. this time the failed insert was captured by the application log, and I was made ...
3
votes
1answer
46 views

Constant Scan joining

In preparation of my previous Constant Scan question I was experimenting with VALUES in various ways and came across the thing regarding joining of VALUES that looks odd to me. Setup is simple ...
-4
votes
0answers
29 views

Resolve key-Key deadlock scenario [on hold]

We are currently facing issues because of deadlock. Due to security reasons i am not able to share the deadlock graphs or queries related to it. Can someone guide on how should i proceed to check on ...
1
vote
2answers
44 views

Need to move TempDB to another drive. But its files cannot be dropped or shrunk

Today I had a task to move all TempDB files to a new, smaller drive (RAMdisk). I analysed TempDB files space usage - not all the space inside of its files was used so I decided that new drive is ok. ...
0
votes
0answers
34 views

Deleting records does not affect unused space in data file [duplicate]

I have a SQL Server 2014 database where one table had around 485 million records. After deleting around 120 million records, the amount of free space in the data file did not change. I figured I ...
0
votes
1answer
40 views

insert results from store procedure with parameters into table

I have a stored procedure that I want to insert into a table, the stored procedure however has parameters I have to pass, how can I do this? DECLARE @RC int DECLARE @startweek varchar(20) DECLARE @...
-3
votes
0answers
36 views

Executing a script every 2-3 days on the server [on hold]

I want my server to run a particular script every 2nd day. Is it possible?
-2
votes
1answer
41 views

How to fetch transaction details for Logs Table in SQL Server

I want to create a tracking table for changes made to the database. A tracking table called Logs must be created into which all changes (insert and delete) that are made in the database will be ...