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
1answer
15 views

How to have MS Analysis server setup of both modes: multi dimension and tabular

Ref: Is there a way to install both tabular and multidimensional modes? The answer was .."You answered your own question. You simply install another instance of SSAS.".. My MS SQL 2014 has a ...
0
votes
0answers
25 views

SQL Express Backup and Restore to Different Server

I have been translating an old ADP file format to a more current VB front end using SQL Express Back-end. In order to do this project the owners had me use either VPN or Team-Viewer in to a ...
0
votes
2answers
30 views

Mssql database old bakup restored on production server

I am using mssql server 2016, I have accidentally restored the 24 hours old database backup file on production server, so I have lost the data for today, means I have lost the data of 24 hours, is ...
0
votes
0answers
25 views

More Efficient 3-Period Rolling Average Calculation

I have a table of numeric answers to survey questions. The goal is to call a stored procedure, with a parameter for PeriodType ("Quarter", "Month", or "Year") that returns this output: Year Period ...
0
votes
1answer
28 views

Is this Database Model for university is correct

The education system in our country is a little bit different from other countries. We take subjects all through the year and finish the year with the same subject. We have 4 main exams through the ...
0
votes
1answer
26 views

Find records size in kb/mb/gb for one client from multiple table in one database

I have multiple client using same database, i need to find client wise size utilized.
7
votes
1answer
46 views

Using XQuery to filter out some children, but preserve parents

SET NOCOUNT ON; DECLARE @xml AS Xml = '<a><b>bbb</b><c>ccc</c><d>ddd</d></a>'; SELECT @xml; SELECT @xml.query('/a/*[self::b or self::c]'); SET @xml....
1
vote
2answers
61 views

T-SQL Stored Procedure Returns Before Completing

We are running into a very curious error. We have two production SQL Servers. We call a stored procedure on one (call it Server_A) that calls a stored procedure on the other (Server_B). The stored ...
1
vote
0answers
21 views

SQL Server : Memory pressure,Spiked user connections and CPU usage

I have the below sql server environment. SQL Server 2016 standard edition. 128 GB RAM 96 GB alllocated to SQL Server 8 tempdb's with 1 GB each. Have a major database with 2.5 TB size. Reporting also ...
3
votes
1answer
40 views

Seting MAXDOP for SQLserver 2016 and above

I was going through MS documentation reg: setting MAXDOP starting SQL2016 as that Automatic soft NUMA enabled by default and getting confused on how to make the changes to current SQ2014 and SQL2012 ...
4
votes
2answers
53 views

Fast alter column NVARCHAR(4000) to NVARCHAR(260)

I have a performance problem with very large memory grants handling this table with a couple of NVARCHAR(4000) columns. Thing is these columns are never larger than NVARCHAR(260). Using ALTER TABLE [...
1
vote
1answer
42 views

SERVERPROPERTY('HadrManagerStatus') equating to 1 even if Always On is not configured

We have a SQL Server Enterprise 2017. I would like to get insights as to why our SERVERPROPERTY('HadrManagerStatus')returns 1 even if Always On is not configured in this instance. I have a local ...
1
vote
1answer
38 views

Cannot choose Storage option on a table in SSMS for standard edition

I am looking into partitioning of tables for SQL Server on two different machines. One machine runs Microsoft SQL Server (RTM) 2016 Developer Edition, and the other is running Microsoft SQL Server ...
-1
votes
1answer
29 views

Update Column Based on a Filter of Another Column - Returns NULL [on hold]

I have a table2 which i am inserting head count value based on where condition on table1 and group by. And based on another where condition from table1 in need to update value for another column in ...
4
votes
2answers
107 views

Ms sql MERGE INTO locks whole table for updates

I have a table for statistic values, it holds millions of records, which is defined like this: CREATE TABLE [dbo].[Statistic] ( [Id] [INT] IDENTITY(1, 1) NOT NULL , [EntityId] [INT] NULL , [...
0
votes
1answer
49 views

Can SQL Server be forced to use a cached plan for executing a SP or SQL script?

Can we somehow force SQL Server to use a cached plan for executing a SP or sql query? We have a parallel plan in prod which estimates data size in GB's and estimates number of rows to rows equal to ...
41
votes
8answers
4k views

Asked to Not Use Transactions and to Use A Workaround to Simulate One

I've been developing T-SQL for several years and am always digging in further, continuing to learn all I can about all aspects of the language. I recently started working at a new company and have ...
1
vote
1answer
48 views

Restore ALL databases with sqlcmd in SQL Server (Express, Docker, 2017)

These documentation articles https://docs.microsoft.com/en-us/sql/linux/tutorial-restore-backup-in-sql-server-container?view=sql-server-2017 and https://docs.microsoft.com/en-us/sql/linux/sql-...
0
votes
1answer
24 views

User guest does not have permission to run DBCC checkprimaryfile (SMSS)

I am trying to attach an mdf file to a sql server using SMSS, and I got a message that says: User guest does not have permission to run DBCC checkprimaryfile Any clues about how can I solve that ...
1
vote
1answer
59 views

Why is my auto-restore procedure not dropping the databases when I expect it to?

I wrote a stored procedure to loop through my databases in a cursor, restore the most recent backup, run checkdb, drop the restored database, then move on to the next one. I have found that during the ...
-2
votes
1answer
47 views

Is there any possible way to modify the database state from within the scope of a CTE? [on hold]

For example: -- Directly with a DML Statement WITH CTE_DML AS ( UPDATE Table1 SET Column1 = 'Value1' FROM Table1 ) -- Indirectly by executing a procedure WITH CTE_SP AS ( EXEC ...
0
votes
2answers
43 views

Does restoring a database in Microsoft SQL Server add objects to Resource Database?

As far as I know the resource database contains information on all objects in its server instance, so I would think it's only natural that when you restore a database from a backup file, part of the ...
1
vote
1answer
44 views

attaching locally stored mdf to SSMS

Sorry if this question does not make sense, I have no experience with databases, I just stumbled upon this task. I need to attach an mdf to a database. I have the mdf file stored in my local computer....
0
votes
1answer
25 views

Connection between Salesforce and SQL Server to pull/push data [on hold]

Looking for connectors that can help pull/push data from Salesforce to/from SQL Server. Any pointers would really be appreciable.
0
votes
2answers
45 views

Is it safe to move GPT formatted mdf file to MBR formatted disk?

From our current SQL Server, I've copied a .mdf file to another disk (GPT to MBR). It seems to create fault in whole disk, made MSSQLSERVICE offline. Additionally, no error logs were unavailable ...
1
vote
2answers
64 views

Sql Server Restoring Process Time Takes Too Long Time

I have 7 databases on my reporting server. I restore those databases every night with differetial backups. Normally, the differential restore time was taking about 1 or 1.5 hour for each databases. ...
1
vote
3answers
53 views

Lost data, how to recover (sql server)

We currently have a db that the backup has been set to Simple that is being backed up every night (we have backups for last 7 days), is it possible to find records that were deleted in say June? The ...
0
votes
0answers
13 views

How to increase idle time of “LaunchPad” for SQL Server external scripts?

sp_execute_external_script can take a while to initialize when not run for a short time. How do I set the idle time on the controller Launchpad process to keep it from shutting down too soon? Note I ...
-1
votes
1answer
22 views

SQL Server Database replication from Enterprise to Express version

We need to replicate one of our enterprise SQL Server database to DR site for HA purpose, due to budget reason, we would like to install another SQL Server Express rather than the enterprise or ...
1
vote
1answer
36 views

Multiple availability groups--can each availability group have its own listener?

I have created two availability groups containing multiple databases on the same SQL Server instance. Can I have two different listeners for these two availability groups?
0
votes
1answer
55 views

Changing Column Data Type with FKs

I want to change my column data type from "Datetime" to "Datetime2(7)". If I try to do it with the GUI SQL Server 2014 asks to save all FKs table dependencies and then I get a lock timeout because ...
2
votes
2answers
121 views

Cannot find Database Mail feature in SQL Server Express 2012 SP1

I need to use SQL Server Database Mail feature in my project. However Database Mail seems not available on my development instance. There should be a 'Database Mail' node in the Object Explorer. In ...
2
votes
3answers
64 views

What is SQL Server doing in the background once a Backup/Restore is complete?

When I run a backup or restore through the SSMS GUI, the dialog shows Executing with 20% increments rather than every 1% tick. To get round this, we can use DMV's. Thing is, when the query shows 100% ...
0
votes
1answer
60 views

SQL Server Non Clustered Index Compression

I'm struggling to find out the answer, we currently use compression on all our data warehouse tables, which has improved performance and also greatly reduced the storage space used. I've only ...
3
votes
2answers
239 views

How to remove a secondary database from an availability group and rejoin it?

I have an availability group (AG) with multiple databases (DB-A, DB-B, DB-C), and multiple secondaries (SEC-B, SEC-C) and one of the databases will not resume synchronization on just one of the ...
5
votes
0answers
59 views

Why am I getting a snapshot isolation issue on INSERT?

Given two tables Parent KeyID GroupID Name Active Child KeyID ParentID Name Child.ParentID is FKed to Parent.KeyID We insert both Parent and Child in a single transaction. If a ...
1
vote
0answers
51 views

Error 9003 Log Scan is Invalid Error When Restoring Transaction Log After SQL2016 SP2 + CU8 Upgrade

We are using SQL 2016 Enterprise Edition and have recently applied SP2 + CU8. We were previously on SP1 + CU6. Since the update we are getting the following error when restoring transaction logs on ...
-3
votes
0answers
60 views

Unable to upgrade sql server [on hold]

When running the quick update I get this message: 'There are no SQL Server instances or shared features that can be updated on this computer.' I am at RTM and trying to go to SP2 or SP2CU8. Do ...
0
votes
2answers
49 views

Count the number of days in each month between two specified dates

I am trying to write an SQL Server formula which give the number of days in each month between two specified dates. E.g:
2
votes
1answer
34 views

Get User for Audit Entries

I am trying to construct history entries for my application tables. (Basically a "who changed what and when" set of tables.) My problem is that I have a lot of users. Well over a thousand. My ...
1
vote
1answer
51 views

ETL process causes database to rapidly grow - Shrinkfile reduces size from 140GB to 2GB - Keep shrinking?

I have a database (SQL Server 2012) that is used mainly for ETL of data. Every hour SSIS packages run that truncates/deletes and reloads full datasets. The database keeps growing even though the data ...
0
votes
1answer
67 views

Error 23 on transaction log backup, full backup works fine

I have a database with the database files on the E: drive, and logs files on the D: drive. I'm getting the following error when trying to run a transaction log backup: Read on "D:\LOG\AOA_Log.ldf" ...
0
votes
0answers
44 views

Error 18456 when moving database to new environment

Last night I moved a database from Server Q (QA) to Server P (prod). Part of the process was to remove some QA logins we use and replace them with production logins. Things seemed to go well but ...
0
votes
1answer
27 views

How to move tables located in two MS SQL server to a new MS SQL DB in single schema and table [on hold]

Am new to SQL, kindly assist me with my query. I have two MS SQL servers(version 2014) with an application data available on it, placed in 2 separate geo's, and i want to merge these two geo tables ...
0
votes
2answers
42 views

Constrain unique value between multiple tables

I have a database where there's one base table that is extended (by foreign keying) by other tables. Something like this: I've been assigned a task where I have to do the following check before ...
0
votes
0answers
32 views

SSMA cannot read meta data (missing runtime components)

What I want to do should be rather easy: Use SSMA to transfer internal Access tables and queries to SQL-Server. On my Notebook I'm running SQL-Server 2017 and Office 365 (32 bit) As I have 32 bit ...
2
votes
2answers
77 views

What is best way to move large number of existing indexes into new file-group - DB Size: 700GB

I have requirement to move all the indexes into different storage space (file-group) within existing SQL Server 2014 Database (Current Size: ~700GB) I'm planning for approach where i can drop ...
5
votes
2answers
640 views

Selecting 2 column in an Inner join

Below are my two tables : I am trying to write a query that joins these 2 tables AND returns the Source_Title and Destination_Title for the given Source ID of Result Map table. I have tried written ...
0
votes
0answers
25 views

Collect a column as CSV in GroupBy

I have this schema: Result Story: BILL_INFO has all bill headers. There is a business process called Deposit that occurs once a day: BILL_INFO are updated with a DEPOSIT_ID from DEPOSIT_INFO table ...
0
votes
1answer
43 views

Set up read-only privileges on the dbo schema, but allow creation of entities in another schema?

Is it possible to create a custom schema in a database such that users that have read-only access in that database for the dbo schema can be set up with the ability to create and modify entities for ...