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
3answers
91 views

char or smallint for a column with numeric codes?

I have columns in my application that have values ​​that always have 4 digits, e.g. '0100' or '1230'. One of examples could be Merchant Category Code. For the time being, I have set the type of this ...
0
votes
2answers
63 views

How to plan bring down the space used by databases to as low as possible

Per our security breaks and guidelines when a database grow too big that it cant meet the requirements where it cannot be restored under a given RTO we need to plan on achieving same:- Based on your ...
2
votes
4answers
95 views

SQL Server memory

It's regarding the SQL Server memory. When the server is running out of memory, we recommend adding additional memory to the hardware to overcome CPU utilization issues. But before proceeding to the ...
0
votes
1answer
11 views

Can I just restore the .diff file over full backup to speed up restore?

I'm doing a server migration, and i'm looking at ways to speed up restore. I have a 1TB full backup file which takes about 2 hours to restore RESTORE DATABASE [MyDb] FROM DISK = N'C:\db\202010152000....
0
votes
4answers
76 views

Using an index when leading column is not in the predicate

Are there any circumstances when an index could be used when not all the index columns are included in the predicate? In my case the leading column in the index is unique and is part of the unique ...
2
votes
1answer
34 views

Can we change Log Shipping backup file naming convention

Seems the Log Shipping backup files naming convention (especially the date-time stamp in the name) is followed by UTC time, i believe that is default and standard. I would like to clarify on ...
0
votes
2answers
217 views

Connecting to local database on Azure VM

Using DBforge to try and connect to a local MSSQL database on an Azure Ubuntu 18 VM, I am getting this error: A network-related or instance-specific error occurred while establishing a connection to ...
0
votes
1answer
181 views

Windows Managed account to report subscription file share

Is it possible to used a Windows Managed account to access a file share in a Report subscription? When creating a Windows file share report subscription, on Step 4 - Create a data-driven subscription,...
3
votes
2answers
136 views

SQL Server 2017 Distributed Availability Groups

My Environment is SQL Server 2017 Distributed Availability Groups, details as follows: Configured SQL Distributed AG from DC1 to DC2. DC1 (Production): TEMPDB1 AND TEMPDB2 (HOSTED ON WSFC1) DC2 (DR)...
1
vote
1answer
721 views

Cannot run a job to update table on a linked server

I am running SQL Server 2012 on a server (server 1) and have set up a job to run a stored procedure which will summarize data from a series of tables and update a table on a linked server (server 2) ...
-1
votes
2answers
94 views

Omiting schema names to manage access to SQL Server databases more flexibly

When applications hardcode a schema name, dbo.TABLE, it reduces the DBA's ability to migrate the data as needed. Is it safe and more flexible for applications to omit schema names? I know you will ...
1
vote
1answer
26 views

SSMS Template Browser Add-In development

Okay, I’m trying to do something that I just can’t seem to get accomplished and I haven’t found anything online to address this request. In the “Template Browser” I want to add another category of ...
4
votes
4answers
421 views

Migrating or exporting a database from azure to SQL Server 2016

I am playing around with SQL Azure and in my learning curve. I Have migrated a database from my on premises instance to the Azure server. Now my question is, how do I move a database from Azure to on ...
7
votes
1answer
194 views

Changing collation of SQL Database in Production environment to minimize downtime

We have a scenario in which we want to change the collation of our production database (including columns) from SQL_Scandinavian_Pref_CP850_CI_AS to Finnish_Swedish_CI_AS. We have developed scripts to ...
1
vote
1answer
26 views

Excluding log shipped DB from current database maintenance plan (Ola's solution)

The Senior DBA and I were discussing our most recent rollout of log shipping to 25+ servers and one of the issues we had ran into during our pilot was the log chain breaking randomly. We narrowed down ...
1
vote
1answer
34 views

Does SQL Server Support Parallel Bulk Inserts From Multiple Connections?

Does SQL Server support parallel bulk inserts into the same database table? Some clarifications for my particular use case: The table has a clustered index composed of two distinct index keys, and ...
1
vote
1answer
32 views

Why is a Shared lock blocking on an IX lock when Read Committed Snapshot is enabled?

Our system has randomly started deadlocking in areas where it previously had not, and an analysis of the deadlock graph looks like it should not even be happening to begin with. Here is a screenshot ...
1
vote
0answers
32 views

Sql error number: 1236. Error Message: A transport-level error has occurred when receiving results from the server

I'm getting a SQL Server error: Execution fail against sql server. Sql error number: 1236. Error Message: A transport-level error has occurred when receiving results from the server. (provider: TCP ...
5
votes
1answer
362 views

Should Full Text Filter Daemon Service be a cluster resource?

Our newly installed and configured SQL Server Always On Availability Failover Cluster with SQL Server 2016 Enterprise Edition runs with four instances and six nodes. It includes the DB Engine Service ...
0
votes
0answers
17 views

Compare a document against millions of other documents to find similar documents [closed]

I am trying to implement a feature to compare a document against millions of other documents to find if the input document is similar to any of the existing documents I already have in the SQL Server ...
-2
votes
0answers
24 views

How to Replicate SQL Database to another SQL on Different network? [closed]

I need to Replicate Database to another SQL Server which is on different Network . Please Help me how can I do that ? TIA
2
votes
1answer
59 views

Trigger to prevent update if existing value is higher than inserted value

I need a trigger that will prevent from updating the price if the existing value is higher than the inserted value. If such operation transaction appears, the trigger should prevent value update but ...
1
vote
1answer
64 views

PowerBI Service Account granting duplicate execute permissions on stored procedure almost constantly

I have PowerBi Server (Jan 2019) installed on my server. I can see from the default trace that that the PowerBi Service account NT SERVICE\PowerBIReportServer is granting execute permissions on a ...
4
votes
1answer
395 views

Handling 'Variable not found' in a tokenised job step

I have an Agent job which is usually triggered by a WMI event. The job has a token within it, which automatically takes a value from the WMI event and substitutes it into the step's Powershell code, ...
2
votes
3answers
302 views

Query to categorize rows based on a “time” column without using a CASE expression

There is a ProductTT table as you can see below: [dbo].[ProductTT] (ID int , Product Varchar(50) , Time Int) ...which contains the following rows: 1 XX 0030 2 UY 0354 3 YY 0517 4 ZZ ...
3
votes
1answer
445 views

Memory usage grows on SQL Server Analysis Services 2012 until cubes fail to process

We have a 64-bit SQL Server 2012 SP4 Enterprise Edition instance with Analysis Services (Analysis Services is running on the same VM as the SQL Server database engine) where the memory usage of the ...
2
votes
1answer
320 views

Does T-SQL have a Schema search path?

In T-Sql, a user has a single default schema. Is there a concept of schema search path similar to a postgres search_path? The question behind the question is, if I use schemas as namespaces for ...
1
vote
3answers
140 views

Parameterized Dynamic TSQL - Dynamic Parameters

We have a situation where effectively the same report is requested by different customers but they: Don't want all the columns Want the columns in a different order than we naturally have them Want ...
0
votes
1answer
44 views

Problem with IF / BEGIN / ELSE

I'm trying to run a select IF there's something inside a folder: INSERT INTO #tb (SubDirectory, Depth, [File]) EXEC master..xp_dirtree 'C:\folder\', 10, 1 This will populate a table with the ...
1
vote
2answers
418 views

Copy a database to a new schema in an existing database

Just curious if there is a way to create a new schema that is based on an existing database. Assuming the existing database has dbo schema only. I will be taking an entire database and moving it to an ...
1
vote
1answer
2k views

exporting a sql view to a csv file

Whilst I can just about script to pull data via queries, I'm finding it very difficult to figure out how to export the results of a query to a .csv file and save in a network storage location (novice ...
1
vote
1answer
326 views

Conditional MS SQL replication

I have an issue that I want to do conditional replication to one of my enterprise level client databases. This database is very large: approximately 300 GB MDF file and a 160 GB LDF file because of ...
2
votes
1answer
46 views

Issue patching SQL Server 2016 to SP2 CU 15

Trying to update all our SQL 2016 servers to SP2 CU 15, but am running into: The version of SQL Server instance MSSQLSERVER does not match the version expected by the SQL Server update. The installed ...
11
votes
4answers
14k views

Slot Time Challenge - Doctor Appointment database schema

I am trying to make a doctor appointment system where patient online will have two options: First time visit (this visit should be 20 mins) Follow up visit (this visit should be 10 mins) Constraints:...
8
votes
1answer
115 views

SQL server 2019 adaptive join poor performance

I upgrade SQL Server from 2016 to 2019, the query plan of my query changed and it used adaptive join, but unfortunately the duration of query increase to 1 minute from 1 second, I changed the join ...
1
vote
1answer
580 views

Service Broker Error - The conversation handle is not found

A new third party application using Service Broker on SQL Server 2017 is causing the error log to report numerous failed query delivery notifications due to conversation handle not found. I've ensured ...
-3
votes
1answer
41 views

SQL query to filter values with NULL [closed]

I want my select statement to filter by null and further by and/or operator. Below is my script... I want to know which values has null values and then filter those with and /or operator. When I only ...
4
votes
0answers
119 views

After Upgrade/Migration to SQL Server 2019 Databases Periodically Gets Stuck In a Inaccessible State

I have a bit of a unique challenge, I have a series of test databases I use for CI type database testing, generally with each release I will restore (overwrite) these databases from a backup, update ...
0
votes
0answers
33 views

Job waiting for resources - is it better to kill it or let it wait

Our server is very busy sometimes and I can see my jobs are waiting for resources. Is it better to kill it and start it after e.g. one hour or let it wait until it finishes? Right now there is a rule ...
8
votes
2answers
188 views

SQL Server experiencing THREADPOOL waits while still having plenty of available workers

I recently took a look at my production SQL Server's cumulative threadpool waits, and it's literally days worth of waits. So I started doing some digging. I'm on a 32 core, 64 bit server (running on ...
0
votes
0answers
32 views

Counting Grouped records, using start date and end date with NULLs

Here is my issue, Source DB is Azure MSSQL - I have a table that lists all the subscriptions sold. The Relevant columns are: Account Number, Subscription Group, Purchase Date, Cancellation Date ...
0
votes
1answer
418 views

Generate Script for Event Notification

I need to migrate my Event Notifications from current server to another one. I would like to generate that code, but I couldn't find an way to do that. Try 1 I have tried reverse engineering from ...
2
votes
0answers
36 views

Configure SQL server to force encryption programmatically

I'd like to enable the ForceEncryption flag for SQL server programmatically. I tried: Set-ItemProperty ` -Path "Registry::HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\MSSQLServer\MSSQLServer\...
4
votes
4answers
483 views

Error converting VARCHAR(MAX) to XML due to “UTF-8” attribute

I need to dig into a logs table with a schema similar to this: CREATE TABLE t ( id int PRIMARY KEY, data varchar(max) ); Column data stores a XML text received from a web service in this format: ...
5
votes
1answer
973 views

Performance of Polybase

We've been experimenting with Polybase on a SQL Server 2019 (CU2) box, using SQL Server external data sources and the performance has not been good - in most cases a 1400% increase. In each case all ...
2
votes
1answer
72 views

Date time cast preferred method

What would be the preferred method for speed and less database stress using a between or less than? SELECT LogId FROM [Master].[dbo].log mlog WHERE cast(LogDate as Date) BETWEEN '2019-01-01' AND '2019-...
9
votes
2answers
3k views

Dodgy T-SQL Query Execution driving me crazy

SQL Server 2019. Here's a link to a gist with the xml plan. Hello, I am having a heck of a time understanding why this query is taking 0.02 seconds to execute when it can't find a record with one of ...
3
votes
1answer
24k views

how to insert a list of varchar values, into a single column table?

In SQL Server 2005: CREATE TABLE __RADHE ( itemNo varchar(10) not null primary key clustered ); GO INSERT INTO __RADHE ??? '34926840', '34927020', '34927202', '34927384', '34927566', '34927830',...
6
votes
1answer
3k views

SQL Server on SAN, same LUN: one logical drive vs multiple

First, let me start by saying that I did notice there are multiple similar questions to this, but neither of them is exactly what I want to ask, and not one of them has a definite answer. Second, let ...
3
votes
1answer
462 views

Sql Server - Build a json array of integer from an aggregate

I want to use an aggregate to build a simple single-dimensional JSON array of scalar values, like the LuckyNumbers array in the example below: [{ "id": 1, "name": "...

1
2 3 4 5
579