All Questions
Tagged with sql-server sql-server-2016
2,212
questions
-2
votes
0
answers
27
views
SQL Server: Two MERGE statements are blocking each other on a large partitioned table
Have a large table partitioned on an INT column. When I run two different MERGE statements on two different partitions of this table, they seem to be blocking each other.
Example:
-- Large table ...
0
votes
2
answers
79
views
create_date and modify_date for sys.objects in MSSQL shows same date
I am trying to figure out when is the create date of a user defined object in the database.
but when I ran a select query on sys.sysobjects, it seems create_date is the same as modify_date.
Is this by ...
1
vote
2
answers
106
views
error when re-applying the permissions script into the original database - sql server
when I run the following script:
-- ——— SCRIPT GRANTS for Object Privileges—————
IF OBJECT_ID('[sys].[sysrowsets]') IS NOT NULL GRANT CONTROL on [sys].[sysrowsets] to [db_myrole_BA]
I get this ...
0
votes
3
answers
54
views
Alter table - add a new column as the first column in the table - sql server
Before doing a restore of a database I check how much space I have in each drive on the destination server.
I use this script:
IF OBJECT_ID ('tempdb..#FREE_SPACE_DRIVES','u') IS NOT NULL
BEGIN
DROP ...
0
votes
0
answers
49
views
Extracting a special text from a given text in sql server
I have a text like this :
1XXXXXXXX/ZZZZZMR-A2
.L/TY7R7
.R/DOCS HK1/P/IRQ/A11111111/IRQ/27AUG66/M/25SEP32/XXXXXXXX/ZZZZZ
.R/TKNE HK1 2222222222222/1
1QQQQQQ/WWWWWWMS-B4
.L/TY7HZ
.R/DOCS HK1/P/IRN/...
0
votes
0
answers
66
views
SQL Server - connecting to wrong instance?
So, I've ... inherited a SQL server environment. With LanSweeper, I see this particular server has two instances installed: sql001AK and sql001M5. LanSweeper tells me they have similar databases, ...
0
votes
0
answers
79
views
SQL Server 2016 upgrade
We need to upgrade our SQL Server 2016 to SQL Server 2019. We are also using replication for our test and production environments.
What my question is: what are the downfalls of upgrading from SQL ...
9
votes
1
answer
691
views
Extra NESTED LOOP / INNER JOIN causing NO JOIN PREDICATE warning
I have the following tables in my database.
LastNames Table
CREATE TABLE [dbo].[LastNames](
[LastNameID] [int] IDENTITY(1,1) NOT NULL,
[LastName] [varchar](50) NOT NULL
) ON [PRIMARY]
GO
...
0
votes
0
answers
97
views
In SQL Server database mail is not working
Database mail is not working:
Below Error while sending a test mail
Mail not queued. Database Mail is stopped. Use sysmail_start_sp to start Database Mail. (Microsoft SQL Server, Error: 14641)
Checked ...
0
votes
0
answers
24
views
Reduce primary DATAFILE size for an SQL Server Database 2016
In an AG always on configuration (primary) I have a database with 10TB datafile, 50% of the datafile is a free space. Then, I want to reduce this DATAFILE from 10TB to 8TB. How to proceed for that ...
0
votes
1
answer
48
views
snapshot to apply just the schema changes - not the data
I am restoring databases to each side of my transactional and merge replications.
Basically the publication and the subscriber are the same database initially.
I still need to run the snapshot agent ...
1
vote
1
answer
91
views
ApplicationIntent = ReadOnly and Writes queries
I'm confused about behavior of connection string that specifies ApplicationIntent = ReadOnly and write queries in SQL Server 2016 Enterprise Edition.
Let's say, Availability Group has a primary - X1 ...
0
votes
2
answers
71
views
Trying to renumber a field in order grouping by another
So I have a table that has a column labeled 'sequence', it is not in fact a sequence data type, just a numeric field that translates in the object model to show items in a certain order. In a handful ...
0
votes
0
answers
48
views
Intermittent Error On SQLServer Hourly Database Backup Maintenance Plan
Some of our SQLServer machines' hourly maintenance plan with Back Up Database Tasks are failing intermittently, around once or twice per week. The next hourly execution runs without any issue. Each ...
0
votes
0
answers
35
views
Data Loss and data redeundancy when forced failed over to secondary replica on DR Data Center in SQL Server 2016
We are using SQL Server 2016 Enterprise edition and planning to have 2 datacenters primary and the remote Disaster recovery(DR). We have 2 replicas (primary replica and secondary replica) in the ...