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)

1
vote
2answers
34 views

cannot find old connection string connecting to old database and not new one that has been defined

Cannot find old connection string connecting to old database and not new one that has been defined. We have changed web servers on Azure and cannot find the reference to the old database because our ...
4
votes
4answers
155 views

tempdb growth and shrinking tempdb

I’m a DBA that is fairly new to SQL Server coming over from a UNIX/Informix. I have a question about tempdb growth: From what I can see on regular databases if I start with a database that is 10 GB ...
4
votes
4answers
260 views

Easy way to change Column ID (primary key) of a table to Auto increment

I started to use SQL Server recently and I still don't know the best way to do some things. I created all the tables with a column ID as the primary key. Now when I try to insert values I get the ...
1
vote
2answers
62 views

SQL Join problem [closed]

I have a problem trying to join two tables TableA +----------+--------------+ | PersonID | customerId | +----------+--------------+ | 123 | 456 | | 258 | 145 | | ...
0
votes
0answers
16 views

SSIS Package Error Unable to locate reference column

I have an SSIS package that worked fine until today. For some reason I am getting this error: [UpdateCurrencyRate by MaxTickTime of DAy [2658]] Error: Unable to locate reference column ...
6
votes
1answer
540 views

AND conditions within unbracketed ORs work but why?

I have very similar code to the first block below. It is in production in a critical process, and I am not confident that it will always work. I would like to know why it does. It uses or (1=1) to ...
4
votes
3answers
121 views

Get Stored Procedure Result Column Types

I'm trying to get whatever a stored procedure returns, with the column names and their types. I can do this with tables but I couldn't figure it out for stored procedures. I tried the sp_columns but ...
1
vote
2answers
72 views

Databases in Suspect state after enabling TDE

A few of my databases are in a suspect state. How can I get them online? I don’t know what info is relevant and what isn’t, but I’ll give as much as I can. Here is what happened: I enabled TDE in ...
1
vote
1answer
29 views

Monitoring decimal values on Perfmon using User Settables

I am currently using sp_user_counter1 to store database information on Perfmon, which can be recovered by AWS CloudWatch, but the values are Decimal, and the sp_user_counter1 parameter supplied must ...
2
votes
1answer
52 views

Can mirroring be used to upgrade SSRS?

Can you use mirroring to upgrade SSRS? For instance, I've upgraded from SQL 2005 to SQL 2014 with mirroring. SSRS is running on the same box as my database server. I'm going from SQL 2012 ...
2
votes
2answers
44 views

Separate license needed for Visual Studio 2012 SQL Server database projects? [closed]

We have SQL Server 2014 Standard Edition and would like to use Visual Studio 2012 Database Projects for version control. Do we need to purchase a license to use VS database projects? Or is it ...
3
votes
2answers
102 views

What is considered for output from an sql server job step?

In short: It seems I only get PRINT messages to my SQL Server job history. What is the definition of valid history output? Background: Just executing a statement like UPDATE product SET ... will ...
0
votes
1answer
35 views

Alter multiple Logins through SQL

I am trying to change the following properties for SQL users to disable password complexity and expiration. Using: ALTER LOGIN xx WITH CHECK_EXPIRATION=OFF, CHECK_POLICY=OFF GO Where 'xx' is an ...
3
votes
1answer
32 views

Changing database name based on project environment

I have three environments for our BI project (DEV, QA, PROD) and two databases in each environment, source(EDB) and target(EDM) DEV environment: Source = EDB_DEV Target = EDM_DEV QA environment: ...
0
votes
0answers
23 views

User mapping to one DB dropped for one login periodically

I have a domain user (DOMAIN\ReServer) that was created to allow SSRS reports to access various databases. Those DBs that reside on SQL instance RS01\Prod have never been a problem. One DB resides on ...
2
votes
2answers
58 views

Filtered index error when using two column condition

I created a filtered index (in SQL Server 2012) and compared it with non-filtered index – I could see promising improvement as shown below. Now I need to change the filter condition to use two ...
1
vote
0answers
30 views

Autocomplete in SQL Server Management Studio showing too much

I'm new to using SQL Server 2008 Management Studio as I just started working with it last week. Yesterday when I was working in one of our databases I remember that I used the auto complete ...
1
vote
0answers
42 views

Search for Arabic text ignoring diacritics, alef hamza differences, and kashida in SQL and oracle

Well, I have a table with an Arabic column which may contains variant forms of the same word in multiple rows, for example the word "أسمى" might be in the following forms: 1- with diacritics: ...
0
votes
0answers
20 views

Is there a way to get alerted for stats going stale?

It came to our notice that applications running slow when there is bulk update/insert operation on few tables, randomly on AD-HOC basis. NO fixed date when data will be updated. Thus we see the ...
1
vote
1answer
14 views

Configuring SQL Replication subscriber to a publisher in a different DNS zone

I have a server that I wish to set up a subscriber on, however the publisher lives on a different domain controller and is not in the primary DNS. To access the server, a FQDN needs to be provided. ...
1
vote
1answer
33 views

DIRTY_PAGE_POLL without activated Indirect Checkpoint

Since I encounter some performance issues on my SQL Server 2014 (12.0.2370.0 (X64)) I'm dealing with enormes amounts of different wait types. One of the top 5 wait type is "DIRTY_PAGE_POLL". I've ...
1
vote
1answer
61 views

Use of Trigger on table which can have 100 hits / second. Will it hamper performance?

Currently in one of our projects we have the following situation. The server computer is Windows Server 2008 Standard SP2. Processor is Xeon (R) 2.13 Ghz. We are running SQL Server 2008 R2. We need ...
0
votes
1answer
22 views

Generate backup script of SQL Agent Jobs using c#

I am using C# code to read all the SQL Agent Jobs: static readonly string SqlAgentJobName = "SqlAgentJob_123"; static ServerConnection conn; static Server server; static Job job; try { conn = ...
1
vote
1answer
40 views

How to synonymize a database name?

Within one database instance, I need to restore a set databases into new names. The new names will be suffixed based on the development phases, like: _DEV and _QA. Where: DBApp_DEV shall access ...
3
votes
1answer
57 views

Tempdb log file was growing continuously on SQL Server 2008 R2-SP2. Could a pending insert statement which uses temporary table be a cause?

I just started at my new job as a DBA. All of a sudden, we started getting alerts about disk space. When looked into it, I found that tempdb log file was growing continuously. There was an active ...
0
votes
0answers
31 views

How to have static and dynamic columns in one table with calculation?

How can I have static rows with 12 months along with dynamic rows and have it look like one table? I don't have column Budget, I created separate helper table with budget amount for whole year. So I ...
-4
votes
2answers
43 views

Query orders in recent 5 years [closed]

I am using SQL Server, and I have an Order table with a column OrderDate (datetime). How can I write a query to retrieve all the orders in the past 5 years? My query: select * from Order where ...
2
votes
1answer
40 views

How do I guarantee using Microsoft ODBC Driver 13 for SQL Server in a linked server?

On SQL Server 2016, how do I guarantee using Microsoft ODBC Driver 13 for SQL Server in a linked server? I don't mind there being another layer in there, such as the MSDASQL provider, but I do want ...
6
votes
1answer
1k views

What to do when handed a server the first time?

I'm a new SQL Server DBA in a new company. Just recently, they have handed me access to the server. There are about 50 OLTP databases with different sizes, some ranging 250MB and the biggest database ...
0
votes
0answers
19 views

Performance Comparison using extended events

I am using SQL Server 2012. In my development database I have an old (MySP_Old) and new(MySP_New) versions of a stored procedure. This procedure has around 10 big queries in it. I need to compare each ...
1
vote
2answers
102 views

OrderBy int slow for large table join

I have roughly 1.5 million records. This query works fine for smaller data, but it gets a second slower for every few hundred thousand records. For 1.5 million, the query is noticeably struggling. I ...
1
vote
0answers
27 views

Synchronization report for uncontained objects across each of the replicas in HAG

I have seen How to transfer logins and passwords between instances of SQL Server , Synchronize Availability Group Logins and Jobs and SQL Server 2012 Availability Group Add-in to synchronize ...
7
votes
1answer
154 views

Query against sys.schemas and sys.synonyms runs very slow for one user

Scenario: SQL Server 2014 (v12.0.4100.1) .NET Service runs this query: SELECT name, base_object_name FROM sys.synonyms WHERE schema_id IN (SELECT schema_id FROM sys.schemas ...
1
vote
0answers
13 views

syspolicy_purge_history 3rd step runs forever on a cluster node?

I have a SQL Server cluster. On one of the nodes, the syspolicy_purge_history job runs forever on step 3. I did stop and restart the job, however, again it is running forever at step 3. How can I ...
2
votes
3answers
134 views

How can I create 3 tables with references On SQL Server

I started using SQL Server recently and I think this is simple to resolve. I need to create one table with a country list, and two tables that will use the country list in a column. Here is the ...
1
vote
2answers
44 views

Can't create a table with the same name I deleted before

I started to use SQL Server recently and I think that its simple to resolve I did: 1 - Create table table_nome 2 - Drop table table_nome 3 - I'm trying to create a table with the same name, and ...
3
votes
3answers
31 views

Is there a way to get the last NDF file READ/Access date / time?

I have found a mysterious NDF file in my DB. Can't tell if it contains valid data or if the file is dead. I'd like to remove it but I cannot tell if the file is in use by SQL Server. Windows Last ...
1
vote
1answer
30 views

linked servers between availability group to a server

I had three servers(server1, server2, server3) in availability group. And the listener name is "Production". I have a server name "Acceptance". I need to run a script that which will copy the tables ...
1
vote
0answers
45 views

Database suddenly in recovery-pending

We have a client running 70 databases on a SQL server. Last month they called us that suddenly database wasn't accessible. Database was in recovery pending mode. Today they called us again ...
2
votes
2answers
65 views

Filtering a result set on a very large table (using INCLUDE index in SQL Server)

Consider a very large table having hundreds of millions of rows defined as -- Here ObjectIdName and ObjectTypeName together are unique. -- Due to their size they aren't indexed, but rather they are ...
2
votes
1answer
37 views

SQL Server spatial geometry properties on index

Is there a way to add geometry.STSrid(object property) to a spatial index or is it already added when I create a spatial index in SQL Server 2012. I have mixed SRID table and I was wondering if it ...
5
votes
3answers
226 views

Shrinking database which is not having any insert/update

We have a process of archiving wherein we take the backup of current database and restore it as xxx archive database. Now this database contains previous data and will not have any ...
0
votes
1answer
23 views

Point in time restore fails - backup file from before the restore point not available (why does this matter)

I have tried to do a point-in-time restore of a database through the management studio gui, the point-in-time being yesterday morning (2016-04-12). This fails with the error "...cannot open ...
3
votes
1answer
36 views

is there a way to find out who was spid228 at a given time in the past?

I have a script that reads the error log so that I can see what has been happening within the last day: --create the table CREATE TABLE #Radhe (logdate datetime not null default (getdate()), ...
0
votes
2answers
45 views

Need help with this backup audit SQL Server script

I am using below backup script taken from http://www.ludovicocaldara.net/dba/sql-server-last-database-backup/ link to audit my servers for backups. This works great except when I have spilt backups. ...
3
votes
1answer
589 views

Is SYSUTCDATETIME a safe primary key?

I have a serially modified table of processed events. A utc time for when it was processed and an eventId. Is it safe to use SYSUTCDATETIME() as my primary key? I can easily use a surrogate key but ...
5
votes
1answer
88 views

Benefit of filegroups and setting filegroups to read-only

Can someone site me a real world scenario on when making multiple filegroups to read only a good option and when to use them? What benefits are there if you set it to read-only? On a database with ...
0
votes
0answers
23 views

SQL Server: migrating masters databases between clusters by detaching/attaching them

As a migration strategy is it possible or feasible to detach a master database in a Microsoft SQL Server cluster and then attaching a different master database's files from another cluster? The goal ...
0
votes
0answers
17 views

installed 2012 SP3 after fixing missing cached installer files, @@ version shows up as sp1

I was to upgrade stg server running SP1 2012 standard, upon getting downtime on the first try I received multiple errors about missing installer cached files (.msp), which was fixed using Microsoft ...
4
votes
1answer
130 views

Actual Number of rows is too high even with new tables

I have a query based on two newly created tables in SQL Server 2005. I have index created on these tables. But when I write a query with JOIN condition, the number of actual rows returned is too high ...