SQL Server 2008 R2 (major build version 10.50.xxxx). Please also tag with sql-server.

learn more… | top users | synonyms (2)

8
votes
1answer
316 views

Is the WHERE-JOIN-ORDER-(SELECT) rule for index column order wrong?

I am trying to improve this (sub-) query being part of a larger query: select SUM(isnull(IP.Q, 0)) as Q, IP.OPID from IP inner join I on I.ID = IP.IID where ...
3
votes
0answers
156 views

Best procedure to measure query optimization effects?

I could not find valuable answers or explanations to the following question: How should a procedure to test query improvements effects look like? Using SSMS I am not absolutely sure about the steps. ...
1
vote
2answers
54 views

Query to extract all SQL database roles with INSERT and/or UPDATE privileges

I've taken over the support for a SQL 2008 database and there are a multitude of custom roles (25+) associated within. I'm trying to figure out which of the custom roles have the ability to perform ...
2
votes
1answer
50 views

Dynamic Parameters In Pivot

I know the premise of a PIVOT() this syntax produces it perfectly for me: Select * FROM ( Select field1 ,annual ,dv As Amt FROM Testing ) x pivot ( SUM(Amt) ,for annual IN ([2014],[...
-4
votes
2answers
52 views

Extract string from varchar

How I can extract the substring of a string from end to beginning? I have the following text, and I need extract the last "Modificado Por" and the "Creado Por" /* CREADO POR : Wxxwww ...
1
vote
3answers
83 views

DBCC CHECKDB consistency-based I/O error

Running: DBCC CHECKDB(DatabaseName) with NO_INFOMSGS gives me the following error: Msg 824, Level 24, State 2, Line 1 SQL Server detected a logical consistency-based I/O error: ...
2
votes
1answer
84 views

Is it worth to optimize queries with EarlyTermination Timeout?

Right after running Ola's IndexOptimize to rebuild all indexes and statistics, I cleared the data and plan cache and ran a very complex ugly query to get a baseline of it's performance. The query ...
1
vote
1answer
62 views

Should I remove this clustered index?

I have lots of tables designed similar as the following (slightly simplified) sample. The original table on different servers has between 50,000 and 200,000 rows (around 12,000 - 150,000 pages). ...
1
vote
0answers
55 views

Transactional replication unspecified error SQL Server 2008 R2

I have a set up of Transaction Replication with the Publisher being the distributor. It works on Push mode. While replicating, more frequently for the past few weeks, the data is not being pushed to ...
5
votes
4answers
345 views

Summing data based on distinct dates

I am trying to get an accurate count of total days a tool is out for rental. Here is a data sample: CREATE Table #tmpToolRentalDays ( ToolId BIGINT, StartDate DATETIME, ...
0
votes
2answers
36 views

SQL Server Standard License over written because of Report Builder Evaluation version

A colleague of mine rang me today to told me that on one of our servers the SQL Server has stopped working. If he tries to run the management studio it throws and error saying The evaluation period ...
1
vote
0answers
45 views

SQL Agent job step fails after upgrading to Powershell 5

I've not seen this issue discussed on the web, and have searched far and wide. I have a brand new HP DL380 running SQL Server 2008R2 standard. It's not yet in production, and I'm testing SQL Agent ...
2
votes
1answer
58 views

Select a table's current identity from another database

How can I get the current identity of a table using OPENQUERY in SQL Server? How to select the current identity on the table from another database?
0
votes
0answers
25 views

sql server cpu usage

First off all thanks for your time. I am trying to understand the CPU utilization of our server box. This is a sql 2008 r2 running Hyper-V my question is why only CPU's 0-6 are hitting hard. How can ...
2
votes
1answer
47 views

Geography data type and Upgrading from 2008 r2 to SQLServer 2014

I am getting a warning about a data type called geography. Our system has 1 column of data type geography. I am trying to figure out if the upgrade will fail or just if an app may have an issue. ...
0
votes
0answers
71 views

SQL Server 2008 R2 Reporting Services: “Exception of type System.OutOfMemoryException was thrown”

When I run a report on SSRS reporting services to fetch 600000 row.. I get a error "Exception of type System.OutOfMemoryException was thrown". I read so many blog's for solving this issue but still I ...
0
votes
0answers
11 views

Database becomes system after restore and rename

Here is a tough one: we have restored an (encrypted) database without creating a new db first. It is an upgarde of SQL Server 2008 R2 Enterprise to SQL Server 2014 Enterprise. The bak file itself is ...
0
votes
2answers
28 views

DB Mirroring setup?

I have done a SQL database mirroring setup. There is a Sql job which takes continues full database backup daily. Should I stop this job ?
0
votes
0answers
29 views

SQL Server group is missing after installation of SQL Server 2008 R2

I've installed SQL Server 2008 R2 and defined a local network service account to run the MSSQLSERVER service. Now I'd like to change the running user to a domain user. I know that this domain user ...
0
votes
0answers
25 views

Uninstalling MS SQL Server 2008 R2 Ported from an Older Laptop

I am in the process of removing software I no longer need from my Windows 10 laptop. A couple of years ago I migrated my programs and files from an older laptop using ZInstall, which brought SQL ...
4
votes
1answer
168 views

Will a nonclustered index with a unique column always address all queries filtering that column first?

I have found large heap tables that are over-indexed and for example have multiple different nonclustered indexes with different columns, but some of those indexes have the (only one present) primary ...
4
votes
2answers
80 views

Why am I getting this ANSI warning about NULL values and aggregate functions?

This is the exact warning message: Warning: Null value is eliminated by an aggregate or other SET operation. I understand what it means in general, i.e. that there's a null value in one or more ...
4
votes
1answer
89 views

How to check for Non-Ascii Characters

What is the best way to check if a VARCHAR field has Non-Ascii Characters? CHAR(1) through CHAR(31) and CHAR(127) through CHAR(255). I tried using PATINDEX and have run into the following issue. ...
4
votes
2answers
169 views

Get SSRS Datasources from ReportServer

Housekeeping on an old SSRS, this particular server is 2008R2. I have the query below which gets me the name, location, creation and modification overview for all the reports. I would also like to ...
5
votes
4answers
224 views

Total duration “server” was in “In” state per day

I have data of a server start & stop time on a daily basis for one month. I need the result containing the first start time of the day, last stop time of the day, total time the server was started ...
0
votes
1answer
31 views

SQL Server 2008 R2 Enterprise Evaluation

Was hoping someone could assist me on finding the SQL Server 2008 R2 Enterprise Evaluation? I am trying to create a test environment for a SharePoint migration, and part of the step is from WSS 3.0 ...
2
votes
0answers
61 views

SQL Server Management Studio creates 18456 login error using registered server group

I have been using "Local Server Groups" registration for quite a while now with SQL Server 2008 Management Studio. I have created a group with 5 registered servers. They are registered using SQL ...
0
votes
2answers
73 views

Check if the trigger was fired by INSERT or DELETE

I know this is the easiest question you can find on this website but I wasn't able to find its answer on the internet. How to check if the trigger was fired by an INSERT or DELETE? Example CREATE ...
0
votes
1answer
26 views

SQL Server FTS get tokens from string

What is the query to get the tokens in a string from SQL Server 2008 R2? I need it to highlight results of FREETEXT
1
vote
0answers
14 views

Synonims in SQL Server 2008 R2 FTS

The Search feature on my website is based on SQL Server's Full Text Search (I insert everything relevant to a single table and this table is in the FTS Catalog). We don't have money to buy a ...
1
vote
1answer
31 views

Offsetting reporting Load from one server to another

I have a SQL Server 2008r2 database ( Let's call it "BIG_DB") at 200GB. This server gets hit hard. It is the back end for an application, BIG_DB is a source of a lot of reporting. There are about ...
1
vote
0answers
18 views

Accessing Encrypted SQL Server database through a web-based application

I have secured a database within SQL Server Instance on my local machine using Netlib Encryptionizer. I can access the database by securing my SQL Server instance using the same password as encrypted ...
5
votes
1answer
31 views

During rollback, is lock escalation reversed

Generally, SQL Server will take locks during updates. It also supports Lock Escalation: Lock escalation is the process of converting many fine-grain locks into fewer coarse-grain locks, reducing ...
0
votes
1answer
24 views

FullText Search

We came across an issue using FullText Indexes and SQL 2008 R2, not sure if it's by design or I am missing something. When we search using a fulltext index, I noticed SQL appears to trim leading and ...
0
votes
0answers
22 views

Calling a SQL Server 2008 R2 stored procedure from SSIS 2012 Execute SQL Task

We have a heterogeneous SQL Server environment including SQL Server 2008 R2, SQL Server 2012, and SQL Server 2014. In one 2012 instance, we have an administrative database that we gather metrics data ...
0
votes
1answer
47 views

Query distinct emails not logged in within a period of time

I need help in writing a query to return distinct emails that have not logged into ABC database in the past 5 months. The exact task I have been asked is as following: Create a table in ABC ...
0
votes
0answers
30 views

SQL Server Index recomended but already there (DMVs)

I am using the DMV views to get a list of index recommendations and then I am reviewing each of them to make sure they make sense and don't overlap etc. Some examples are Index ON X ( Y ) and Table ...
4
votes
1answer
36 views

Howto query all files, their fill level and additional drive info with one query?

I need a query that puts together the following results: one row per databse file across all databases additional columns with information about the locigal drive the file is on information about ...
1
vote
3answers
73 views

How to find values from one table missing in another?

I am a Junior Developer. I have been asked to create a subquery to solve this problem. If the question is not clear please let me know so I can provide more details. I have two tables - Article and ...
-1
votes
3answers
86 views

Exclude databases from automatic full backup [closed]

I have 10 databases on my SQL Server. We do an Automatic Full Backup every day at 00.00. The issue is there are two databases out of the 10 that should not be backed up as these databases are ...
0
votes
0answers
29 views

Manual sync between 2 SQL server databases [duplicate]

I will not go in details and explain everything. For some (not good) reason I need to maintain 2 databases synchronized together. The full database schema may be different but not on table I want to ...
0
votes
1answer
21 views

Why do I not see Configure Distribution when I right-click on replication?

I'm using SSMS 2014 for SQL Server 2008 R2. Why don't I see 'configure distribution' when I right-click on Replication?
0
votes
1answer
38 views

List of queries run

I'm looking for a DMV query for SQL Server 2008 R2 which shows me all queries (full history) run by a specific user. I have this code for now: SELECT * FROM sys.dm_exec_query_stats qs CROSS APPLY ...
2
votes
3answers
101 views

To find SQL Server is actually used or not?

I have an SQL Server 2012 and a 2008R2 running in my environment. I need to decommission the server if the server is not actually being used. I did go through this and this where connection count is ...
2
votes
2answers
141 views

SQL Row concatenation with XML PATH and STUFF giving aggregate sql error

I am trying to query two tables and get results like the following: Section Names shoes AccountName1, AccountName2, AccountName3 books AccountName1 The tables are: CREATE TABLE dbo....
0
votes
0answers
19 views

MS SQL data synchronization question

I'm in charge of modifying an application which was intended to run Microsoft SQL Server Compact 3.5. The application must run on a local database during fieldwork when there is no network ...
0
votes
3answers
46 views

Minimum value within a set (or window) within a three column table

I only have SQL Server 2008R2, therefore I do not have all the window functions available since SQL Server 2012. I have a table that looks like this: I would like to retrieve a result set like ...
0
votes
2answers
42 views

How to separate values from one column into two columns in SQL Server [closed]

I have this dataset as input: Name Contact No ------- ---------- Deepika 75865558 Deepika 207586558 Rnveer 746655558 Rnveer 946655558 vaibhav 2356841 vaibhav 6655558 I want to get ...
1
vote
0answers
908 views

SQL server 2008 querying very large large tables

I've recently started a new job, the table row counts are huge compared to where I was before (11 billion rows in one of our main tables). I've been told there isn't time to update the statistics on ...
3
votes
1answer
70 views

Amazing improvement of script execution speed when split - not understood

I have an ETL job that merges data into about 20 columns of a fact table, all integer non-null (default 0) columns. There are 8 merge statements to completely update all the columns and they involve ...