This Tag is for SQL Server 2008 R2, major build version 10.50.xxxx

learn more… | top users | synonyms

2
votes
1answer
488 views

Join tables in two databases make query slow? is better to partition db?

I have a table1 in db1 and table2 in db2 on SQL Server 2008 R2. If I make a select query joining both tables, it's really slow to get the results. A simple query like SELECT * FROM db1.dbo.table1 ...
1
vote
0answers
39 views

Low batch Batchrequests/sec

I am running this query to do massive deletion in my database. I am looking at Batchrequests/sec and it is quite low (like 15% of what my server can handle) Is there any way to rewrite this query to ...
0
votes
0answers
182 views

Login failed for user 'x'. Reason: Could not find a login matching the name provided

I get this error Login failed for user '****'. Reason: Could not find a login matching the name provided. [CLIENT: 10.4.3.5] Right around 3 AM ish but the application connecting to sql server ...
0
votes
1answer
79 views

Pivoting some row data into columns (SQL Server 2008 R2)

Sorry if this has been answered before but I'm exhausted and on a time line. Maybe I'm just an idiot. I'm designing a data export from One application to import into another. Full-Disclosure: I did ...
1
vote
1answer
44 views

Am I using the correct data types on SQL Server side to call an Oracle 10g function?

When calling an Oracle function with the following in parameter types NUMBER(7,0) VARCHAR2(8 BYTE) VARCHAR2(4 BYTE) DATE and return type NUMBER(14,5) from SQL Server 2008R2 via a linked Oracle ...
0
votes
2answers
227 views

Reducing database size to restore to SQL Server Express

I have a SQL Server 2008 R2 database, about 15 GB. I want to copy it for a partner, who is using SQL Server 2008 R2 Express. I deleted many tables and rows, and now I am sure that the data is ...
0
votes
0answers
49 views

table check constraint, greater than > not accepting

CONSTRAINT CK_BABY_YOUTH_CHILD CHECK (case when Passenger_Type='Baby' then Reference_ID >=0) This is my table check constraint, i have no idea why sql server is not accepting ">". Please ...
2
votes
1answer
118 views

How to find number of days since beginning of fiscal month?

This relates to my question How to find XXth day of previous month in SQL server? The fiscal month starts on 26th of each month. I need to find out from any date: The date of the start of the ...
2
votes
3answers
231 views

Using expressions in the SELECT list to thin down a CASE statement

I have a query I'm working through rewriting - it has a huge bunch of case statements in the select list that all basically look like this: select Column1 = case when (Something = 2) and ...
0
votes
0answers
45 views

Installer Error while Installing SQL Server Reporting Services

I have a Windows 2008 R2 Server 64bit, I have already installed SQL Server 2008 R2 SP2 64bit Enterprise Edition, Which is working fine, without any issues. Now when I am trying to install Reporting ...
0
votes
1answer
105 views

Lost DMK encryption password for master database

Back story: My company has TDE encryption enabled for some of our databases. The password that the master key was encrypted by for one of our servers is lost. We do have the backup .key file, however, ...
3
votes
1answer
240 views

How to find XXth day of previous month in SQL server?

I have 2 parameters, an input date (DATETIME) input day of month (TINYINT) If I enter 11 MAR 2014 as the DATETIME and 26 as the input day of month, I would like to select 26 FEB 2014 as the ...
2
votes
0answers
67 views

Avoiding Functions() in the Where clause

Okay, while analyzing queries against a SQL Server 2008 R2 database, I happened upon the following query: (@p__linq__0 nvarchar(4000)) SELECT TOP (1) [Extent1].[OrderSOId] AS [OrderSOId], [Extent1] ...
2
votes
2answers
54 views

Specific user can't view database contents

I have a particular user, let's call it TheUser. This user is able to connect to my SQL Server instance and view a list of the databases. However, upon expanding a database to view tables, stored ...
0
votes
1answer
56 views

How to identify unused tables

We are planning to merge 2 or 3 region databases who are using almost the same version of SQL Server 2008 R2, have exact tables and most stored procedures for our end users reports.. in the process, ...
1
vote
2answers
97 views

Is there a more efficient way to run this query for first/max transaction?

For each account, I need the first transaction date, the largest transaction amount, and the time taken to get from first to largest. Data is truncated and reloaded frequently, and I have read-only ...
-1
votes
1answer
46 views

Does changing the collation of a column change TIMESTAMP (rowversion) values?

I need to run ALTER TABLE ... ALTER COLUMN ... COLLATE Czech_CI_AS ... for multiple columns in a database. All those tables have TIMESTAMP column which is used for database synchronization. Will ...
1
vote
2answers
81 views

Reduce space used on C drive

I have installed SQL Server 2008 R2 on my laptop, under 32-bit Windows 7. The SQL Server installation is using approximately 30GB of space on my C: drive. Why is it using so much space, and how can I ...
0
votes
1answer
52 views

Slow SQL Server authentication, but fast SAN, fast querying?

I am asking you after days of research but I think I don't have required skills to understand what is happening. I have a slow authentication on a SQL Server 2008R2, which leads to a timeout for the ...
2
votes
1answer
90 views

Finding rows with duplicate values

I have a one to many relationship between the Account table and a ScheduledPayment table. One account can have many payments but there should be a maximum of one payment per day. Although unlikely, ...
0
votes
0answers
43 views

Python - ascii encoding error when updating field content in SQL Server table

I know there are plenty of posts and blog explanations about unicode errors, but I still can't figure out to handle it in my particular case. I've already asked this question on GIS.StackExchange but ...
1
vote
2answers
66 views

Trying to filter msdb..sysjobs by job_id

I'm attempting to determine the name of the SQL Server Agent Job that is currently running by comparing the output of master.sys.dm_exec_sessions.program_name to msdb..sysjobs.job_id I'm using the ...
0
votes
0answers
38 views

Unknown Error when attempting to run Import Data wizard

In SQL Server Mgmt Studio, when right-clicking on a database, choosing Tasks and selecting Import Data, we receive the below error message. Any idea what might be causing this? We are running SQL ...
-1
votes
1answer
34 views

Displaying records in a SQL Server #temp_table [closed]

what's the select query syntax for displaying the content/records in a #temp_table on a SQL Server
0
votes
2answers
133 views

SSIS Package truncation and possible data loss (error code: 0xC020901C)

Good morning all, It's been 2 days now trying to figure out how to solve this issue, still no answer. Maybe you can help me out. Here is the thing. I have created an SSIS package to import data from ...
3
votes
1answer
102 views

SQL Query Optimizer - how does cost vary with resource availability

When the query optimizer calculates the cost of an execution plan, can you expect the plan to differ depending on the amount of resource available to it? Take the following scenario: You have a ...
1
vote
1answer
56 views

Cursors and concurrent users

I typically avoid cursor operations like the plaque, however, I have come across my first problem where using a cursor outperforms a query. So I am forced to use it. I have created an elaborate ...
1
vote
1answer
30 views

Change Data Capture missing changes for a specific record

I have enabled CDC in SQL Server and it generally works well but sometimes the changes are not recorded for some reason. And only for a couple of records. But then if I issue an UPDATE from SSMS, the ...
1
vote
1answer
61 views

Linked Server using ODBC too slow

The scenario is that developers used a linked server object on ServerM to reach ServerST. This linked server was setup as a "SQL Server" type using a domain login that exists as a login on ServerST. ...
2
votes
1answer
71 views

Scripting a maintenance plan

I created a maintenance plan for my SQL Server 2008 R2 using SQL Server Management Studio (SSMS). However, I am unable to export/convert it to a script, in case I need to redo it on another server. ...
1
vote
1answer
76 views

Restoring a database, changing recovery model

I regularly make a backup of my production database, then restore the same onto a test database, so developers can always have recent data for testing. The production database uses full recovery ...
0
votes
1answer
252 views

Why straight SQL query run faster than stored procedure?

I am facing-out a very surprising problem in SQL Server. The problem is when the query run in SSMS window it will return result in ~1 sec and when the query run through a stored procedure it will ...
1
vote
1answer
51 views

Maintenance plan backup and reload the same database

I want in my maintenance plan every night to copy the production database to a backup, and reload the newly-created backup into a test database. By reading here: Restore database - maintenance plan ...
0
votes
1answer
30 views

SSIS unpivot returns different results when run via a SQL agent job

I hope someone can help me. I have an SSIS package which grabs data from an excel (.xls) file, unpivots it from a rubbish format into a 'proper' format, transfers it to a SQL server 2008 R2 db, and ...
1
vote
1answer
125 views

SQL Server Multiple JOINS with Table Value Function - query never ends

I have a query with 4 joins using a table value function to get the data and when I execute it the query never ends. Issue Details Table valued function: CREATE FUNCTION [dbo].[GetIndicator] ( ...
2
votes
2answers
68 views

Why do I need to backup the Database Master Key?

When I make a Database Master Key for a database: CREATE MASTER KEY ENCRYPTION BY PASSWORD = 'Some Long Password' This page from Microsoft recommends I back it up offsite: ...
4
votes
3answers
561 views

Why does transaction log continue to grow in Simple recovery mode with nightly backups

Before immediately marking as duplicate, I have read Mike Walsh's Why Does the Transaction Log Keep Growing or Run Out of Space?, but I don't think it gave an answer to my situation. I looked through ...
2
votes
2answers
71 views

Database events that will cause deletion of index

In SQL server if we try to change a data type of a column having index ,then it deletes the indexes associated with that column and changes the data type . I was not aware of it and was faced problem ...
3
votes
2answers
180 views

Alert when Job isn't triggered

I have a Sql Job on my server that is triggered nightly from a remote server (once it has completed its backups). I have successfully configured the job to notify me when it fails, but I would like ...
1
vote
1answer
27 views

Backup Certificate SQL Server and return bytes with a Select Statement

I have a certificate in a database in Microsoft SQL Server 2008 R2. I want to get a copy of the certificate so I can burn it onto a USB device and put it in a safe. I don't want to have to go onto the ...
2
votes
2answers
152 views

Is Information in sys.dm_db_index_usage_stats reliable

I'm archiving data from an old system that has no documentation. Lucky me... I'd like to find out when the tables were created, last accessed etc. Can I trust that this query will give me the correct ...
0
votes
0answers
36 views

I am trying to implement Scott Chamberlain's code in SQL Server 2008 R2 . Getting Assembly not present errors

I am trying to use Scott Chamberlain's code, here: http://dba.stackexchange.com/a/17466/45380 I was able to compile it and create the DLL, but now when I try to run SQL CREATE ASSEMBLY I get: Msg ...
3
votes
2answers
221 views

Can I update every datetime in bulk?

The current database assumes all times are local to the user. Now we're changing this so the database stores everything in UTC and our application converts the UTC time in the database to the correct ...
0
votes
1answer
60 views

User defined data types causing implicit conversions

user defined datatypes, i'm looking at some execution plans and seeing implicit conversions happening in the background when a var is declared of type user defined data type and pulling a value into ...
0
votes
0answers
28 views

Run SSIS task regardless of checkpoint

Is it possible to make a task always run, regardless of whether the package starts from scratch or from a checkpoint restart?
5
votes
1answer
77 views

Full Text Search Term Casing Affects Results

I have been experiencing a full text problem when searching using CONTAINS. I have the full text catalog accent sensitive setting set to false. The table contains following rows: Microsoft C# ...
0
votes
3answers
51 views

List all tables that a specific login has permissions [duplicate]

This might be repetitive, but I haven't found a solution that serves my purpose 100%. What I'd like to achieve is to have a script (or SP) that'll list all tables that a user has permissions on. Any ...
0
votes
1answer
41 views

How to find when change tracking was enabled?

How can I determine when change tracking was enabled on a table in a SQL database? Assume that this table has a regular cleanup routine, which means that looking at the oldest record in the change ...
2
votes
1answer
58 views

Reporting services scheduled reports are clogging up sql job history log

This is a bit of a cross-disciplinary question - Hopefully I’ve posted in the right place. SQL server 2008 R2 Question: How can I limit the number of rows in [sysjobhistory] for specific jobs, ...
0
votes
1answer
92 views

SQL Server 2008 R2, error creating file for FileStream

I'm trying to create a file to add to a filestream file group and I get the error: Msg 5120, Level 16, State 106, Line 1 Unable to open the physical file "d:\data\filestreamstore.mdf". Operating ...