Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                

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
0 votes
0 answers
4 views

What are administrative shares in a FCI? And should sql server service account also be a cluster administrator?

Link: https://learn.microsoft.com/en-us/sql/sql-server/failover-clusters/windows/failover-cluster-instance-administration-and-maintenance?view=sql-server-ver15#changing-service-accounts If the ...
  • 2,814
0 votes
1 answer
15 views

How to work around sp_blitzwho lock timeout?

Running sp_blitzwho @GetLiveQueryPlan = 1 on SQL2019 to monitor a big index rebuild operation but running into the following error: Lock request time out period exceeded. Anything I can do to avoid ...
0 votes
0 answers
11 views

Does data file instant initialization has anything to do with backup speed?

While I was reading my SQL Server notes, I found this info. How to speed up the backup of VLDBs? ------------------------------------ Choose a proper time (database is not under heavy load) Backup ...
-1 votes
0 answers
6 views

What is an example of system, resource and query processing errors in FCI?

I'm learning about the FailureConditionLevel setting. Link: https://learn.microsoft.com/en-us/sql/sql-server/failover-clusters/windows/failover-policy-for-failover-cluster-instances?view=sql-server-...
  • 2,814
1 vote
1 answer
16 views

Is this valid SQL Server Update syntax?

Today I was reading some of my database notes that were taken long time ago. And I saw this query: UPDATE Sales.Orders SET (shipcountry, shipregion, shipcity)= (SELECT country, region, city FROM Sales....
0 votes
1 answer
16 views

What does `same WSFC cluster can run multiple FCIs (multiple resource groups)` mean?

Link: https://learn.microsoft.com/en-us/sql/sql-server/failover-clusters/windows/always-on-failover-cluster-instances-sql-server?view=sql-server-ver15#FCIelements the same WSFC cluster can run ...
  • 2,814
1 vote
0 answers
14 views

Does sql config manager changes (example: service account) on 1 FCI node auto update it onto the other node?

Link: https://learn.microsoft.com/en-us/sql/sql-server/failover-clusters/windows/always-on-failover-cluster-instances-sql-server?view=sql-server-ver15#FCIelements Each node in the resource group ...
  • 2,814
1 vote
0 answers
12 views

What is the approach to handle failover and compatibility issues when patching FCI nodes?

I have FCI with 2 nodes. Following is steps to patch the nodes: Remove node from Possible owners Patch the inactive node Add the node to the Possible owners Failover to inactive node Leave it running ...
  • 2,814
0 votes
1 answer
25 views

How to optimize SQL Server query that might be doing parameter sniffing

This simplified query on SQL 2017 takes 40+ sec to complete, I suspect its parameter sniffing issue, but not 100% sure. exec sp_executesql N' SELECT T.[TicketRecId] , T.[Title] FROM dbo.Ticket ...
  • 532
0 votes
1 answer
12 views

How to add Azure AD user to a Database role

Question: What may be a cause of the error shown below. The user running the code below is a member of db_securityadmin database role: ALTER SERVER ROLE db_ddladmin ADD MEMBER [myDomainName.com\Juan] ...
  • 123
1 vote
1 answer
15 views

sql server max memory ideal value best practice

Microsoft SQL Server database is running on the live server and the max memory value is 2147483647 by default. There is no problem in this way, but how far can I lower this value to be more ideal and ...
-1 votes
0 answers
28 views

SQL Server 2014: Why is Clustered Index Rebuild MUCH faster than initial index creation?

I have a table where rows consist of a few GUID ids and then a huge byte array of data. There is a partitioned clustered index on this table, which orders data by the GUIDs. The table is large, ...
  • 9
1 vote
0 answers
23 views

Clustered Index being used over non-clustered with same key

I have a table that has a clustered index (CI) on the field filename. It also has a non-clustered index (NCI) - With the key column of filename and 5 other columns in the includes. (There are ...
  • 19
-1 votes
0 answers
9 views

Dynamic Table Name versus Index Column

Many companies I've worked for, mostly those using MySQL, have created patterns where they have one "Type", but multiple Table Names to discriminate some detail. For example: - TableName: ...
  • 99
3 votes
1 answer
26 views

Creating a new view or table from the last record

I have 2 tables DraftProducts and Products. The only difference between the 2 tables is the "phase" field. I have productCode varchar(20), phase(tinyint), Name, Price, SpecialCells.... etc ...
  • 33
1 vote
2 answers
21 views

Pull Column data values from sys.columns from a database having same table structure

I am dealing with the situation in sql server where a database contains the multiple tables with similar table name (ex total_0122, total_0622) and same column. I wanted to calculate the percentage ...
  • 11
1 vote
1 answer
18 views

What is the extended events equivalent of the default sys trace security audit events?

I am exploring the default sys trace and it contains various records for the security changes on the SQL server (event record examples are shown in screenshot below). Since the trace feature can be ...
  • 2,814
0 votes
1 answer
18 views

Why does fn_trace_gettable with the DEFAULT parameter not roll over all trace log files?

These are my SQL default trace files: To review the trace logs I run the following query: SELECT min(tf.StartTime) MIN_STARTTIME, max(tf.StartTime) MAX_STARTTIME FROM ::fn_trace_gettable(CONVERT(...
  • 2,814
3 votes
2 answers
30 views

Find duplicated rows between multiple same tables

I have two tables with the same schema: dbo.orders_1 | user_id | order_id | create_time | |---------|----------|-------------------------| | 1 | 5 | 2018-05-04 02:26:03.808 | |...
  • 131
0 votes
1 answer
14 views

How to view the trace_id of the default trace files?

Sql server automatically creates the default trace into multiple files. These can be seen in the LOGS directory of sql server installation path. The sys.fn_trace_getinfo has a trace_id parameter which ...
  • 2,814
1 vote
1 answer
37 views

Insert rows into a table from another table row?

I've got a table Schedule Id unserId Sunday Monday Tuesday Wednesday Thursday Friday Saturday 0 10 0 1 1 1 1 0 0 1 20 1 0 0 0 0 0 0 I need to insert lines from one row in table Schedule into seven ...
-1 votes
0 answers
54 views

2 almost identical queries (with a TVF) produce wildly different performance!

Came across a very 'simple' scenario which I can't explain. I have a Table_valued_function. I can perform a SELECT from it and it returns 12 rows, of 5 columns in a second. So is a small result set. ...
-1 votes
0 answers
53 views

SQL Server Stored Procedure performance slows from 30min to 22 hours overnight

We are running SQL Server 2019 web edition on AWS RDS (t3.xlarge which is 4vcpu x 16gb). We have been running a SQL Job Agent scheduled job that executes approx 50 Stored Procedures for flattening ...
6 votes
3 answers
684 views

How does this piece of TSQL work?

Why the following batch doesn't work as expected? DROP TABLE IF EXISTS #test1; IF 1 = 1 SELECT * INTO #test1 FROM sys.databases WHERE database_id <= 5; ELSE SELECT * INTO #...
8 votes
2 answers
436 views

MS SQL Server DB Transaction Log Growth Rate

I have a busy database, it has been busy for years and I've seen a transaction log size of approx a few GB a day. In the last few weeks, that transaction log size has increased to 40-50 GB every 6 ...
  • 183
0 votes
1 answer
26 views

Most generic filter class model

I'm designing an application that retrieves data from a (currently simple) .csv file and stores it's raw content. The application is intended to offer the user the possibility to define filters on the ...
3 votes
2 answers
86 views

Unique Constraint on 2 columns or single column and null exists

Within a multi-tenant database we have a table that contains some system values and some tenant values defined as follows. CREATE TABLE [dbo].[ItemTypes] ( [Id] INT IDENTITY ...
  • 135
4 votes
4 answers
323 views

How to update table records in reverse order?

I've a table Student Id Name Mark 1 Medi 10 2 Ibra 15 3 Simo 20 and I want to update it, where I want to reverse it in descending order only Name and Mark and keep Id in its order: ...
0 votes
0 answers
19 views

Very weird backup/restore... Like it isn't happening

I have a couple of SQL Servers, and I run a backup on one of them, and on that server, if I do: select version from table1 Then I get a value of 3 If I go to the sql server that I want to restore it ...
2 votes
1 answer
52 views

Install SQL Server 2016 SP2 on SP3 - Windows Updates says that?

Currently our server is on Microsoft SQL Server 2016 (SP3) (KB5003279) - 13.0.6300.2 (X64) Aug 7 2021 01:20:37 Copyright (c) Microsoft Corporation Enterprise Edition (64-bit) on Windows Server ...
  • 340
1 vote
1 answer
34 views

Understanding of database master key in SQL Server

Let's say I have a production server and I have a database master key ##MS_DatabaseMasterKey## (master_key1) on it. I created a certificate c1, which is encrypted by master_key1 by default. Then I ...
-2 votes
0 answers
14 views

Getting an Cannot generate SSPI context when trying to connect [closed]

Trying to log onto a SQL Server and getting the error message "Cannot generate SSPI context" error. There are two other instances of SQL server running with no issue.
  • 1
0 votes
1 answer
11 views

message 'The Distributor has not been installed correctly'

I get the message The Distributor has not been installed correctly Could not enable database for publishing when trying to execute sp_replicationdboption. The publisher (which is on separate server ...
-3 votes
0 answers
28 views

Can telnet but cannot connect the SQL instance by SSMS [duplicate]

I can telnet the SQL server from my SSRS server, but it failed when I used the SSMS. Any thoughts to narrow down the root cause? Many thanks, Hi there, Thank you for supporting this and I added the ...
0 votes
1 answer
52 views

Routinely deleting data from tables using stored procedure

I've created a maintenance stored procedure to delete data older than 30 days on events table. What are the best practices for deleting data? I've encased the procedure with error handling, i.e. TRY......
  • 11
0 votes
1 answer
34 views

SQL Server compressed backup firstly huge?

Is this a default/normal behavior? When we start a backup it create a file of 316gb and only after backup finishing it shrink to 131gb. Don't make sense because in this case we need a disk of 316gb or ...
  • 566
0 votes
0 answers
19 views

Exception during GRANT CONNECT ON ENDPOINT to group managed service account

Did somebody happen to make a GRANT CONNECT ON ENDPOINT:: operation to a group managed service account work? Personally, I can't. I am always facing the so-called self-explaining exception: Msg 15151, ...
  • 1
0 votes
1 answer
25 views

Exception code: 0xc0000374 constant failover

I have two clusters setup for failover. However, from some time ago, I keep getting error Exception code: 0xc0000374 Then SQL SERVER failover happens. When failover happens, sometimes the secondary ...
  • 9
1 vote
1 answer
50 views

HOLDLOCK required in MERGE with UPDATE

Within a .NET 6 application the EntityFramework is used to keep track of entities and to update related fields. To improve bulk updates, the EfCore.BulkExtensions package has been added. During a ....
  • 123
-1 votes
0 answers
30 views

What is the way to handle corruption in db having simple recovery model?

A database in simple recovery model cannot have log backups. In this situation what is the way to handle corruptions reported by dbcc checkdb without data loss? The documentation says: Use the REPAIR ...
  • 2,814
0 votes
0 answers
5 views

Exporting/Importing maintenance plan dstx with correct server connection

I'm trying to improve what is currently a manual process to create a bunch of maintenance plans with a new SQL server instance (identical database). I'm importing/exporting with dtutil since these ...
  • 155
0 votes
1 answer
27 views

Find columns where change happens

I am pretty basic in my sql code, but I am trying to find a way to decide when a change occurs in a set of data. I have a 3 columns where column 1 (AgreementNr) can have many records. Each of these ...
  • 11
0 votes
1 answer
41 views

Can I install SQL Server Management Studio offline without internet access and create databases locally on my pc?

I need to create a database offline with no internet access preferably. I've used SQL Server Management studio online plenty however I haven't done it locally without internet access. And can it be ...
  • 1
-1 votes
1 answer
29 views

What is the purpose of indirect checkpoint when the default checkpoint time (when recovery time is 0) does a 1 minute checkpoint?

Indirect checkpoint is performed when the target recovery time is configured. When the value is 0, then it will do checkpoints such that default recovery time is 1 minute. Where as if the value is ...
  • 2,814
0 votes
0 answers
40 views

The Trustworthy option should be disabled but what is an alternative?

I run vulnerability assessment report in SQL Server 2016 and I received this issue VA1102 The Trustworthy bit should be disabled on all databases except MSDB The reason of setting Trustworthy to ...
  • 873
0 votes
0 answers
25 views

Can SQL AG be used across 2 sites over the internet to create replica readonly db on remote server?

I have SQLSVR1 having multiple dbs located in Scotland. One of these dbs is used in an ETL process running on SQLSVR2 located in a remote data center located in London via linked server. The ETL ...
  • 2,814
-1 votes
1 answer
42 views

queries with significant difference of estimated and actual number of rows - skew data - in the query plan

I am using dbcc show_statistics looking for skew data in my histogram and improving the quality of my statistics. OPTIMIZE FOR UNKNOWN doesn't use a value - instead, it uses the density vector. If ...
0 votes
0 answers
21 views

How to import Mixed data types excel to sql server [closed]

How to import Mixed data types excel to sql server (without loosing the data).using direct query in sql.
0 votes
1 answer
30 views

Most efficient way to move huge amounts of data between MySQL and SQL Server Databases

I'm looking for an efficient way to move more or less 300GB of data between a MySQL Database and a new SQL Server Database. Any suggestions?
0 votes
1 answer
53 views

How to replace repeating characters in a string with a single instance of the same character?

I have a column of urls with some of the urls like www.google.com/// Need them to be www.google.com/ instead.

1
2 3 4 5
647