Stack Exchange Network

Stack Exchange network consists of 174 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange

Questions tagged [sql-server]

All versions of Microsoft SQL Server (not MySQL). Please also add a version-specific tag like sql-server-2016 if that is relevant to the question.

0
votes
1answer
34 views

Setting up Data Level Application Alerts in SQL Server [on hold]

Solutions are available for providing alerts when any job fails in SQL Server. Is there any solution available for setting up data level alerts - for e.g. if data hasn't updated in USER tables for ...
-1
votes
2answers
82 views

Data Warehouse: Auto Generate Slowly Changing Dimension Code For Any Table with Dynamic Sql

Is there any code to take OLTP/Stage data and transform it into Data Warehouse Kimball Slowly Changing Dimension Type 2? The code should be dynamic, and should be able to utilize any table as input. ...
5
votes
1answer
61 views

RCSI and index maintenance

I have a database that is RCSI enabled and I've been rebuilding my indexes online (SQL 2014 Enterprise) for as long as I can remember. My understanding is that if we were to rebuild the indexes ...
-1
votes
1answer
30 views

intermittent High Volume of I/O Reads for a SP [on hold]

On my production SQL Server, there are incidents of 95-100% CPU usage almost everyday (1-2 times in a day), lasting for 5-10 mins. Although it recovers itself and no intervention is required. It is ...
0
votes
1answer
43 views

SQL Trigger not respecting where clause [on hold]

I have a trigger: CREATE TRIGGER [dbo].[UpdateTbl] ON [dbo].[TableB] AFTER INSERT AS BEGIN DECLARE @role varchar(20) select @role = u.[role] from inserted i join users u on ...
1
vote
0answers
40 views

User permission businness logic

This question will also be posted in the stackoverflow, since dba and programmers may have different opinions. First of all sorry for the long question, but I wrote some extra code so that I can ...
0
votes
2answers
50 views

Compile Dynamic Sql before Running

I have a table, and want to test if dynamic sql will compile. Example: create Table dbo.Product ( ProductId int, ProductName varchar(255) ) This will succeed: Column Name exists declare ...
0
votes
2answers
44 views

First and Last of Month Calculations

This is probably a rudimentary question for most, but for some reason I'm not getting it right. I currently use two specific SET formulas for "1st day of last month" and "Last day of last month" 1st ...
0
votes
0answers
25 views

Add more partitions to partitioned table [duplicate]

How would I create more partitions to an existing partitioned table? At the moment, there's partitions set for every day for the remainder of 2018, and now I need to add more partitions for everyday ...
1
vote
1answer
38 views

Cluster IP's under Access Point for Administering the Cluster

When adding the cluster IPs under Access Point for Administering the Cluster, do we only include IPs for the public subnets, or do we also need to include an IP for the private subnet(s)? This ...
0
votes
1answer
33 views

SQL AlwaysON. keeping Agent Job in sync, but with same JobID?

Is there a way to specify Job ID when creating a job? Or is there a way to update the Job ID of a specific Agent Job that already exists? I have a software from a vendor that uses the Job ID to ...
0
votes
0answers
37 views

Open transaction preventing log reuse?

I have a SQL servers in an availability group, set as synchronous commit. Due to this setup, log backups only reclaim log space when a backup of the secondary has been processed. I noticed my log ...
7
votes
2answers
108 views

Accidental DBA: Unsure why I have a broken log chain?

First of all, thanks for having a look at this - We've got a large database in our production environment (1.26 TB), it's got a few hundred corrupt pages in it and has done for months, so the same ...
1
vote
0answers
25 views

What are the requirements for SQL Replication on Azure SQL DB Managed Instance?

We are seeing if it is feasible to setup Azure SQL DB Managed Instance (SQL MI) and an Azure VM with SSMS installed for this replication scenario: We have a vendor who needs access to our SQL Server ...
0
votes
2answers
21 views

SQL Server Agent - Do not show job step details and column headers in output file

I have a SQL Server Agent job which runs a select statement on a schedule and appends results to a CSV file (Right click the job --> properties --> advanced and then adding a file path to the output ...
1
vote
2answers
54 views

Creating databases - no access to folder - MS SQL

I am merging a few instances together which are for separate customers. They need to be separated by account access so customer X can't view customer Y's databases. I have created a login (we'll ...
4
votes
1answer
69 views

TLS 1.2 breaks SQL Server linked servers

As part of a recent security blitz we set up TLS 1.2 on all of our servers. Last night I flipped the "Force Encryption" flag on all of our SQL Servers and since then I've had a weird issue with linked ...
1
vote
2answers
47 views

How can I add “in” keyword in this code to accept more than one value in gender and age parameters using SQL Server 2012

I want the parameters in Age and Gender to accept more than one value Create Procedure [Admission].[SelectPlayerData] @MembershipNumber varchar(20), @PlayerName varchar(70), @PlayerNameEnglish ...
-1
votes
0answers
24 views

In Place migration from SQL server 2014 to SQL Server 2016 [closed]

please suggest how to proceed in place migrtion from sql server 2014 to sql server 2016 in active passive cluster. what are steps needs to taken
-1
votes
2answers
44 views

What permissions should be added to public users sql [closed]

I have a SQL Server and am looking at making it public. What I mean by this is: I can create a DB and give access to myself and friends etc. I need to create a login which can only view databases it ...
0
votes
2answers
37 views

Copying all columns of a row from table into another?

I would like to keep the history of a table using SQL queries without triggers. The simplest way to do that is to fire a SELECT and INSERT into the history table like below: INSERT INTO history (...
1
vote
2answers
43 views

Live update index in production database [on hold]

I have read Perform Index Operations Online provided by MSFT but I couldn't find any detail information for my questions. My questions are: What is the impact when I update (create/drop) non-...
3
votes
1answer
74 views

Finding gaps on intersection dates

This is a problem I've been trying to work through on and off for the past month, and haven't made any progress. Essentially, I am working with a HR system that stores two major types of position for ...
2
votes
0answers
21 views

Filestream access denied via UNC / SQL

I am having an issue with filestream and accessing the files. From the server itself I can access the files in the filestream folder when browsing direct on that computer. However when I try to browse ...
0
votes
1answer
17 views

Some queries not logging using RDS's SQL Server with C2 Auditing enabled

Similar to a past issue I had with audited queries not showing when using Extended Events, I'm having an issue with queries not logging when using C2 Auditing on an RDS SQL Server instance. (I would ...
0
votes
1answer
33 views

How to insert data from a local MSSQL db table to a remote MSSQL db table using WCF application coded in .NET [on hold]

I made a WPF application using VS2013, coded in .NET. It is working fine in my local SQL Server. But I want to use it to upload data from a local database to a remote database. How can I do this? I ...
0
votes
1answer
57 views

SQL Loop through Inserts and Update table

I have a table (tblStagingHeader) containing the below two columns and example data. It is a record of SQL table names that have been created as part of an SSIS\ETL load. StageTable Inserted --...
5
votes
1answer
74 views

Performance gain with MultiSubnetFailover for single subnet

On BOL I read following about MultiSubnetFailover=True: The MultiSubnetFailover connection option should be set to True even if the availability group only spans a single subnet. This allows you to ...
1
vote
1answer
60 views

Include Columns in Index : SQL Server

I have one question regarding include column in the indexes. If I have an include column which is updating its value quite often, does it update the index every time it's updating the value or does ...
4
votes
2answers
66 views

SSMS can't connect to Azure database

I got a new Windows 10 machine and installed the latest version of SQLEXPRESS and then the latest version of SSMS (17.9.1). When trying to connect to my Azure database, I'm getting the following ...
4
votes
1answer
119 views

Should the filtering column(s) always be in the keys / includes?

I'm considering creating a filtered index in my copy of the Stack Overflow database. Something like this, for example: CREATE UNIQUE NONCLUSTERED INDEX IX_DisplayName_Filtered ON dbo.Users (...
3
votes
1answer
65 views

SELECT from Clustered Columnstore results in LOB Reads

I am performing a SELECT from the following Clustered Columnstore Index which contains 5.2 Billion Records. When I review the output of STATISTICS IO, I am seeing LOB Logical reads. My question is ...
-3
votes
0answers
26 views

Sql job scheduler dynamic excel file connection failing [closed]

i have a script file that finds the most recent excel file in the folder so my excel connection is taken at run time. it works in visual studio package but it fails in the job scheduler. ...
1
vote
0answers
26 views

Resynchronize transactional replication in SQL Server 2012 without doing a complete reinitialization after disk filled

We have a DB that is doing a transactional replication to one other server. There are three tables it is replicating in the DB. Yesterday the subscriber ran out of disk space. This caused the ...
3
votes
3answers
54 views

Why is the Read-Only Routing not functioning in this Availability Group?

First off, my apologies if this has already been answered elsewhere. I have not been able to find any articles or threads describing my exact situation, but no one's Google-fu is perfect. With that ...
1
vote
2answers
36 views

AG listener creation failed SQL Server [on hold]

I'm getting the error below while creating an AG listener in SQL Server. Ensure that the network adapters for dependent IP address resources have access to at least one DNS server. Alternatively, ...
0
votes
1answer
34 views

Remove punctuation marks, special chars and space and compare cols

I have a table with new and old long description columns and I want to compare them by removing space, punctuation marks, and special characters for differences. Create table DESCR_COMP ( HCPCS Char(...
2
votes
4answers
64 views

.bak file not visible for restoration

There is a database on a server of which I would like a copy on my local machine for testing purposes, so I created a backup in the default disk location (C:\Program Files (x86)\Microsoft SQL Server\...
0
votes
0answers
22 views

Do database restart affect create Index suggestion/statistic?

Do database restart affect create Index suggestion? If I restart database then right after running the sp_BlitzIndex @GetAllDatabases = 1 is it going to give an accurate index statistic? If no, how ...
1
vote
2answers
41 views

Dynamic SQL - How can you use it to run a SELECT against all schema's and Tables?

Scenario I have a database that contains all of our customer data, which is separated by Schemas. For example: Customer1 = Schema1, Customer2 = Schema2, Customer3 = Schema3, etc... Sometimes we ...
1
vote
1answer
30 views

Rolling week numbers into one row and getting cummulative values

I have a table of orders with varying dates and have been asked to get the weekly order count for past 8 weeks and cummulative order count overall I have been using the datepart clause to break my ...
0
votes
1answer
47 views

SQL Insert via mappings table

As part of a SSIS ETL process, I have multiple staging tables. I have used xxxx just to resemble data: e.g. tblStage1 Field_ABC Field_ZXC Field_QWE xxxx xxxxxxxxx xxxxx tblStage2 ...
2
votes
1answer
53 views

Why wont SSMS remember my tables when I connect to the server

I have the same problem everytime I connect to SQL server through the SSMS tool. If I have been working on a script and close my laptop for a period of time, when I come back and re-connect it doesnt ...
7
votes
2answers
261 views

Parameter sniffing = On with Parameterization = forced. Which takes precedence?

These two settings seem to contradict each other. One forces plan parameterization so that only one plan gets created. The other allows for multiple plans If you have Parameterization = forced, ...
0
votes
1answer
31 views

Removing duplicates values with join

I have a query that looks like this: SELECT B.Company, COUNT(*) AS QTY FROM Table1 A INNER JOIN Table2 B ON A.CompanySk = B.EDWCompanySK WHERE A.StartedDate >= '20171128' GROUP BY B.Company ORDER ...
1
vote
1answer
71 views

Best way to speed up requests using date columns

Our database is receiving the following requests: select * from [schema].[table] (nolock) where (Date_A > Date_B and Archive = 0) This is a normal request that is made by our application. On ...
0
votes
1answer
40 views

Checking update value before update

First time posting so apologies if this has been asked already. I have a table in SQL Server that is being updated from many different locations with data that I don't want in the table. I have come ...
0
votes
1answer
40 views

Index Seek Plan turns to Index Scan after adding another Join condition [closed]

I had a query passing from Entity Framework which is a very expensive query with a terrible performance. while optimizing this query I found the problem in this part: SELECT TOP 20 * FROM [...
0
votes
1answer
49 views

SQL Server - drop user triggered silent revoke of privileges

I encountered following scenario: A user X granted a ton of permission in the SQL Server database. For example it granted SELECT permission on table Y to user Z. A user X was dropped with simple ...
1
vote
1answer
30 views

Storing Routes and Locations in Graph using SQL Server 2017

I'm very new to Graph database, so please ignore my mistakes. My scenario described in following picture: I have different locations connected to each other with a route between them. Then I have ...