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.

learn more… | top users | synonyms (2)

0
votes
0answers
5 views

SQL Server Performance hit after cache rebuild

After I rebuild my indexes and update my statistics, SQL Server will have to rebuild the cache to get up to speed with the current setup. So, will the SQL server do this immediately after my stats are ...
0
votes
0answers
6 views

Compare Previous and Current Year Sales

I am seeking advice on how to modify my sales query that will compare 2 separate years (current and previous years) and do some calculations for the two years. Below you will find my current sales ...
0
votes
0answers
5 views

Help Interpreting a group by clause

I have the following Group By clause: Group By Grouping Sets (a, (b, Rollup (c, d)) ) My thought process is Grouping sets ( a ) Union All Grouping sets( (b, Rollup (c, d) ) ) Then expand the ...
0
votes
0answers
5 views

SSRS 2012 Report with Oracle database as datasource never finishes

I am investigating a SSRS 2012 Report which used to return data from an Oracle database. However, recently it stopped returning data. The report will sit there and run forever until something times ...
0
votes
1answer
17 views

stored procedure logic,data flow visualization tool

I have a very poorly written stored procedure with cursors, if else etc. Is there any toll available to visualise the logic and data flow? Thanks
2
votes
0answers
15 views

How to show when loan was paid off

First time posting but have been a reader for over 10 years. I have a need to show when a loan was paid off regardless of the rolling balance from refinancing/taking out additional loans. In the ...
0
votes
0answers
14 views

How to split a single query into two?

I'm trying to figure out how to split a single query into two separate queries. The following two queries is what I want: Query #1: Label Value TOTALSTUFF 100 Query #2: ...
1
vote
1answer
15 views

SQL Server 2014 (12.0.4439.1) to SP2 (12.5000) service start failure

In what seems to be eerily familiar to the oh-so-famous SSISDB SP1 fiasco, I've hit a snag while upgrading our DEV server to SQL 2014 SP2. The base version was SP1+CU5 (12.0.4439.1). We have SSISDB ...
0
votes
0answers
10 views

(SQL Server) How to Generate Schedule Based on Datetime Range and Duration

What I am trying to do is generate a schedule based on an input date. There are start and endtimes for each visitation period listed in MyTable as StartTime and EndTime. Data in MyTable would be: ...
0
votes
0answers
17 views

Trigger on replicated DB

If I have database db1 with schema sch1. I want to create another schema sch2 which will be used by different application and the tables in sch2 will be populated from tables in sch1. So my approach ...
0
votes
0answers
13 views

Lock Request timeout causing Orphaned spids

I have an issue where an application with a single connection to the database, got a lock request timeout. In my mind a lock request timeout can only happen if a query waits for a resource for over 5 ...
0
votes
2answers
21 views

when were the sys-dm_os_wait_stats last cleared? sql-2005!

I intend to monitor the execution of my stored procedures in a specific database, using the following script, which I got from How can I monitor the call count per stored procedure per timespan? ...
0
votes
0answers
19 views

how to find out the next time a job is scheduled to run in sql - in real time and even if the job has never been run before

I have a very similar question here but the problem with that question/ answer is that it does not work for all situations. for example, for the jobs that I have just created and have not been run as ...
0
votes
0answers
15 views

How knowing information between linked servers (MySQL & MS SQL)?

I am new to StackExchange Database Administrators and have just a little bit of experience with Databases (mostly MySQL). I have been asked for my job to link a MySQL Database to a MS SQL Database, ...
0
votes
3answers
47 views

Is GUID(uniqueidentifier) not suitable for a clustered index? [on hold]

When i use uniqueidentifier datatype for primary key column then it will automatically create clustered index... So, will it slow down my queries or not ? I am explaining some description of my ...
0
votes
1answer
23 views

On a single table, how is an indexed view different from a non clustered index?

Assuming that no joins are involved, and the PK of the view (the UNIQUE Clustered Index) is the same as that of the base table, is there a difference between how a nonclustered index (NCL) and an ...
0
votes
0answers
13 views

Data Cleansing Using DQS

My question is regarding the installation of DQS server. I have a production server and a data warehouse server, both are synced. Is it the best practice to cleanse the data in production using the ...
0
votes
2answers
54 views

How to resolve Geospatial Data over linked server causing error?

Update of the issue. The exact error is Failed to initialize the Common Language Runtime (CLR) v2.0.50727 with HRESULT 0x80131022. You may fix the problem and try again later. The error is happening ...
1
vote
0answers
15 views

How can I get the actual SSAS error when processing a cube from a SQL Agent job?

I have a SASS cube on one server and a SSIS package on another server that triggers processing the cube. The SSIS package is executed via a scheduled SQL Agent job. I have enabled error reporting for ...
1
vote
1answer
17 views

Permissions for Cluster service account in SQL server

Recently i faced an issue where the SQL server 2012 being hosted in a 2 node failover cluster failed to start. And since the cluster and windows event log didn't help much, i started checking the SQL ...
0
votes
1answer
19 views

How convert database from SQL Server 2012 TO SQL Server 2005 [duplicate]

I have SQL Server 2012 database which I need to use. But I can't install SQL Server 2012 on my PC. I use SQL Server 2005 only. How can I change the database SQL Server 2012 To SQL Server 2005 OR ...
0
votes
0answers
15 views

login failure for sa to unspecified DB

I have a pair of SQL Server 2008 R2 DB mirrored and I'm seeing a login failure approximately every one minute. [417593] MSSQLSERVER Type: FAILURE AUDIT Computer: EVS-DBSERVER-2 Time: ...
1
vote
1answer
30 views

Replication from Enterprise to Standard edition

Can I define transactional replication while the Publisher and Distributor are both Enterprise Edition and the Subscriber is Standard Edition? What do I need to consider in case it is possible (given ...
0
votes
1answer
28 views

AlwaysON AG synchronous commit mode disconnected transaction log effect and mitigation

I have an AlwaysON AG with one primary and one secondary replica in synchronous commit mode. The databases in the AG all have autogrowth disabled (standard policy within organisation). There is ...
3
votes
1answer
20 views

Can SSDT deploy SQL server service broker objects?

Can SQL Server Data Tools (SSDT) deploy sql server broker objects? (So contacts, message types, services, queues and so on.)
0
votes
1answer
47 views

Database design considerations for unused columns with every table has same schema

I am a web developer so I don't know a lot about databases. The company I joined recently has a very mature Desktop ERP built in .NET and SQL Server, they are providing services to huge corporate ...
0
votes
0answers
10 views

Can a snapshot be “disconnected” from the app logon, to keep ONLY the immediate changes?

Can a snapshot be "disconnected" from the app logon, to keep ONLY the immediate changes before that disconnection, without changes subsequent to the disconnection being written to the snapshot? I want ...
0
votes
1answer
20 views

How to generate list of dates — ie every day for the past 2 years? (sql server)

We're using a business intelligence system and need to load a list of dates so we can flag them as 'last week' or 'last 12 months' or some dynamic value. I'm wondering what's the simplest way to ...
0
votes
0answers
29 views

Table optimization in SQL Server with huge data [on hold]

I have a table in one of my databases which has 20 billion rows and keeps on increasing daily. Even if I do a select *, it takes a lot of time to fetch all records. There s only one primary key in ...
0
votes
1answer
36 views

OVER and PARTITION BY for db size change

I have the following column below. I am not too familiar with the OVER function. Question is, will the column usage_change_mb be the daily change (from daily snapshots) or an average change of all the ...
1
vote
1answer
24 views

Visual Studio Database Project

I work in a company that is deeply ingrained in .Net programming. I am responsible for managing a couple SQL Servers, with about a dozen databases in total. Our programming manager recently ...
0
votes
0answers
26 views

T-SQL for creating staging tables with indexes for partition switch operations

I have some partitioned tables in a SQL Server 2012 environment. Is there an easy way to make the create table statement along with its indexes and constraints so I can partition switch to them on ...
1
vote
2answers
35 views

Execute stored procedure remotely using linked server

We have 3 SQL Server 2012 instances, 2 of them we're not db_owner. Some of our stored procedures use DMV and sys views and stored procedures that only work when executed locally. I'd like to ...
-5
votes
0answers
20 views

Resolved SQL Server 2000 on Windows 10 [on hold]

Here is the solution for question: See file
0
votes
1answer
24 views

Updating and/or inserting several rows in the same SQL statement

I am implementing an account "ability" type thing - a users account is given the abilty to do one or many things in the system, like (simple examples) cancel orders or pay invoices. I have a table ...
2
votes
1answer
43 views

Creating a helper UDF or stored procedure and limiting external access

I'm looking for a recommended best practice for dividing functions and stored procedures into a 'public API' and 'private implementation details'. I'm working on a security system and I want client ...
-4
votes
0answers
26 views

How to create dynamic view [on hold]

How to create dynamic view for the below code. I am getting error must declare @top1table DECLARE @top1table varchar(50) DECLARE @top2table varchar(50) DECLARE @top3table varchar(50) set @...
1
vote
1answer
34 views

Replication Subscribers and AlwaysOn Availability Groups (SQL Server)

I have AlwaysOn Availability Groups configured with Replication Subscribers, and is currently running successfully with one publisher using the command below. -- commands to execute at the publisher,...
1
vote
2answers
170 views

Get first and last record for each date and calculate their difference

I need to calculate the DATEDIFF in seconds between the First record for each date with EventCode = 1 and the last record for each date with EventCode = 2. I have posted a sample data set for 2 days ...
0
votes
0answers
23 views

Finding records only when all ids present in a group

Having these two tables id | val TableA -------- 1 | A 2 | B 3 | A 4 | B 5 | A 6 | C 7 | D id_A | data TableB ----------- 1 | a 2 | b 3 | c 5 | d 7 | e First I ...
0
votes
0answers
25 views

Retrieve a set of values for each id if atleast 1 value is present in SQL Server

I want the following group to be repeated for every projectid if there is atleast 1 row of value present and other row values should be NULL I want the following group to be repeated table1 id ...
1
vote
2answers
26 views

How can I perform a full-text CONTAINS call across a list of phrases?

I have a list of words/phrases in a table phrases. I have another table with a full-text catalog indexing the description column. I want to populate a table results with a record for each phrase, and ...
0
votes
1answer
40 views

Update empty values with null

I create a Job that runs the query below for all databases in a server in order to update empty values with null in all columns for all tables. The problem I'm facing is this query literally killed ...
1
vote
3answers
53 views

Need to intentionally create blocking processes for testing

My team and I have an issue where we need to be able to identify processes that are blocking other processes and kill them. There are a ton of scripts that are freely available to perform these ...
0
votes
0answers
13 views

Design: Available domain database

I'm building website and service that will allow user to check if given domain is available. Right now I'm thinking about good way to store result from whois, but i dont want to store whole response ...
0
votes
0answers
12 views

MS SQL 2014 SP1 on Windows 10 - service doesn't start automatically

I've upgraded Win 7 to Win 10 with SQL 2014 SP1 Express x64 on it and the SQL Server service doesn't start automatically after machine restarts, even though it is configured to start so and it had ...
1
vote
1answer
23 views

Configuring a non-nullable foreign key uniqueidentifier with a default Guid.Empty value that exists in foreign table

Project Details: MS SQL 2008 R2 I have already asked what amounts to one half of the question here, but I am hoping someone in this forum can answer the other half, involving MS SQL server ...
0
votes
1answer
13 views

In SQL Server and using only client side encryption requests, can I use a different certificate for each client?

Based upon the UI dialogue box in SQL Server Configuration Manager, if I right click 'Protocols for server_name', it appears that I can only select one certificate to use. My experience so far tells ...
1
vote
1answer
23 views

How to Create Indexes Or Manage Performance For Complex Queries Before a Release?

Last night we had a major release that involved a massive data dump and some complex queries. We semi-anticipated the slowness and were able to react quickly to creating some new indexes in SQL ...
0
votes
2answers
39 views

Is it good to create new indexes for better performance - SQL Server [duplicate]

Hi I have a SQL Stored Proc that used to take 45 seconds to execute. Then I run the Execution Plan under SQL and saw some high cost steps: Then I right click that and select: And finally I ...