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

Validation of Partitioned table Performance

We are testing partitioning on a table which contains a datetime column (DateColumn). Partition function I am using is: -- 138623 + 16774 records CREATE PARTITION FUNCTION pf_TableName_DateColumn ...
2
votes
2answers
33 views

Cannot see new drive in SSMS maintenance wizard

I'm trying to setup a Backup Maintenance Plan in SSMS for Sql Server 2012, running in a failover cluster on Windows Server 2012. The current plan backs up to the same cluster volume where the ...
0
votes
0answers
19 views

Analyze databases for “risky” fields/data as deployed

What is the best way to analyze databases, both by field names and field content, to determine whether there is a privacy or security risk with having the data "as is"? Is there a way to script a ...
0
votes
1answer
39 views

Can't connect to ODBC database with pyodbc. Which SQL Server driver should I install on the Raspberry Pi?

I'm trying to connect to a SQL Server database using a python script. I'm using the pyodbc library to connect to it. cnxn = pyodbc.connect('DRIVER={SQL Driver}; SERVER=192.168.80.30 ...
1
vote
1answer
32 views

how to clear only the query plans from the current session?

I am working on tuning a query on a very busy server, where I don't want to clear the cache, using DBCC FREEPROCCACHE; I know it will cause at least a CPU spike, and in this case I don't want it. ...
2
votes
1answer
54 views

Difference size DBCC Page and DBCC Fileheader

I'm trying to read the current database size using dbcc command. In my test I execute following commands: DBCC Fileheader('tempdb',1) => size = 988152 DBCC Page('tempdb',1,0,3) => size = 5112 ...
2
votes
0answers
30 views

SAN Admin vs. DB Admin free allocated tempdb

I really want to understand. My SAN-Admin told me I have to make sure my TempDB does not grow to max hard disk space. I have 380 Gig on a dedicated disk, on a dedicated LUN, on a dedicated machine. My ...
4
votes
1answer
127 views

Cross Apply Fails When DateTime Added

In trying to achieve a Pivot-ed goal for a two row data table into one row, my first thought was to use a Cross Apply. By using the Cross Apply one can identify/generate each of the rows with a ...
-1
votes
1answer
23 views

Microsoft SQL Server Not Showing Server Name in object Explorer [duplicate]

I Recently Installed Microsoft SQL Server 2014 (SSMS) on my local machine for development learning purposes. I am running Windows 10 32 bit. When i try to connect, Server Name does not appear. Screen ...
0
votes
2answers
42 views

What are the SET options that affect Plan Reuse and how to get their values in T-SQL?

I'm troubleshooting the case when a stored procedure runs great from the management studio at any time, but the same stored procedure can run terribly badly in one of the webservers, even for the same ...
4
votes
5answers
134 views

Is there any best number for rows count in a table to start using indexing?

I'm a newbie in DBA. I want to know if there is any specified point in a table's rows count that when we reach that point, then we could use an index. I know there should be some dependency between ...
1
vote
1answer
48 views

Stored procedure running for a long time

We have a stored procedure which is running for ever, whereas when it is run as script it takes just couple of minutes to complete. When I just declare the params and assign values to them and run the ...
3
votes
1answer
49 views

Force everyone to use snapshot isolation

I have a scenario in which I don't want any readers to block writers. I don't want users using table hints or isolation levels to issue shared locks, which might block writers. Is there a way for ...
1
vote
1answer
37 views

Grouping by more than 1 column using Partion By or any other method - Sql Server

I have the following tables in my SQL Server database: Product -Id -Name -Price -TypeId (Foreign Key) -SubTypeId (Foreign Key) Type -Id -Name SubType -Id -Name -TypeId (Foreign Key) I currently ...
1
vote
2answers
107 views

Confused Logins and Users in SQL Server

In SQL Server, when setting permissions with a Grant statement, we do it on Users, not Logins. For example: CREATE LOGIN login1 WITH PASSWORD = 'sssssssss'; use mydb; CREATE USER user1 FOR LOGIN ...
0
votes
1answer
27 views

Clear out remnant LDF log files of Sharepoint DB not visible on SBS 2008 Domain Server?

Typical ways for dealing with LDF files that take up a lot of space, recommend these processes to shrink/ eliminate the drive space being occupied. ...
0
votes
0answers
25 views

How to merge multiple SQL Server DBs to one central DB

I am working on 25 identical DBs (SQL Server 2014) installed in 25 Branches. I need to merge the data of these DBs into one central DB, daily.I tested Replication (merge) method. As my servers are ...
1
vote
3answers
75 views

Remove duplicates in SQL Server Group By

I have 2 tables, Product and Type, the tables looks something like this: Product -Id -Name -TypeId Type -Id -Name I want to be able to write a SQL Server query which outputs the products grouped ...
10
votes
3answers
831 views

What does OPTION FAST in SELECT statement do?

I have done some digging on what the OPTION (FAST XXX) query hint does inside a SELECT statement and am still confused on it. According to MSDN: Specifies that the query is optimized for fast ...
0
votes
0answers
59 views

Suggestions for indexes or how to partition a table in SQL Server 2008R2

Table structure and DBMS SQL Server 2008 R2 I have a single table structure (flat) that has summarized sales data (YTD,MAT etc) by unique combinations of "Customer", "Product" and "Territory". ...
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
18 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
122 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
31 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
53 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
103 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
36 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
33 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
43 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
35 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 ...