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

learn more… | top users | synonyms

2
votes
1answer
724 views

Cannot CAST '33.33' to INT

I have encountered a problem where the WHERE clause is causing a problem. The varcharColumn is of datatype VARCHAR and contains numbers as well as text. The query looks to be averaging this column, ...
1
vote
0answers
254 views

SQL Server 2008 R2 DeadLock on query Notification

for the first time, I'm running into a deadlock on ...The deadlock graph doesn't help me much except the fact the query notification system seems to responsible. <resource-list> ...
0
votes
2answers
260 views

Tools for Identifying Needed Indexes

I want to create the best indexes for each table in my database. Is there a query or tool in SQL Server to help with this process?
2
votes
1answer
270 views

Calculate number for each row

My table structure is below: CREATE TABLE [ACC].[Document]( [DocumentID] [int] IDENTITY(1,1) NOT NULL, [Date] [date] NOT NULL, [SalesCompanyFinancialPeriodID] [int] NOT NULL, ...
5
votes
1answer
536 views

Release SQL Server Memory usage

How can release memory usage of sql server by command. my system have 16GB RAM, but when get huge query by sql server, memory usage become full. if I restart SQL Server service memory usage become ...
3
votes
3answers
5k views

How to get last identity row Inserted when using instead of trigger

When I inserted on tables that exists instead of triggers on those. @@Identity , IDENT_CURRENT('Table') and SCOPE_IDENTITY() return null. How I can get last identity of inserted row
6
votes
1answer
1k views

Recursive CTE performance

Need help with recursive CTE performance. Below CTE is running very slow as it is trying to pull heirarchical data recusively. Table is big with every root id having upto 3 recursive itemid. There ...
2
votes
1answer
570 views

Ordering with custom paging when using pivot to convert a query

This is a follow up to my question on changing a flat result set into a different column set using Pivot. Scripts for test DB can be found in that link Ordering works just fine like this: SELECT ...
1
vote
1answer
597 views

How many files should I create for one filegroup and 9 weekly partitions?

I have 9 weekly partitions on one filegroup. How many files do I need to create? There are 3 tables containing 46 million, 16 million and 10 million rows.
5
votes
1answer
209 views

Electricity off while shrinking database, how can I recover my database?

While i execute shrink database, the electricity has been gone down, I can't access my database now, it is (In Recovery), how can i recover it?? Note: it is a very huge database: 25 GB. EDIT: My ...
28
votes
3answers
2k views

Unexpected scans during delete operation using WHERE IN

I've got a query like the following: DELETE FROM tblFEStatsBrowsers WHERE BrowserID NOT IN ( SELECT DISTINCT BrowserID FROM tblFEStatsPaperHits WITH (NOLOCK) WHERE BrowserID IS NOT NULL ) ...
2
votes
1answer
1k views

SSIS PL/SQL task hangs with message “Multiple-step OLE DB operation generated errors.”

I've configured a Microsoft SQL Server 2008 R2 SSIS package with an Execute SQL Task to run a PL/SQL query on an Oracle 10.2 database. The Execute SQL Task (named "SQL Update MY_STATUS flag") is ...
2
votes
0answers
342 views

What is causing all of the msrepl_tran_version columns to become out-of-sync between locations in transactional replication setup?

I have been having a recurring issue with transactional replication setups at the firm I work for. We use SQL 2008 R2. Seemingly without warning or any replication errors, all of the ...
7
votes
3answers
5k views

View delete statements in the Transaction log

Is it possible to view delete statements that have recently occurred in the Transaction Log?
4
votes
1answer
645 views

Does SQL Server evaluate functions once for every row?

I have a query like this: SELECT col1 FROM MyTable WHERE DATEADD(dd, 0, DATEDIFF(dd, 0, GETDATE())) BETWEEN col2 AND col3 ; This gives a tooltip on the execution plan ...
6
votes
1answer
3k views

Why does SQL Browser service get disabled?

I have an intermittent problem with a software installation package that installs our product (written using InstallShield/InstallScript). During the process of the installation, we restart the SQL ...
6
votes
1answer
413 views

Is there a way to DENY CRUD operations on connections from linked server?

I have a SQL Server instance, RPT1 (2008 R2), that was set up for "power users" to run their own queries. This server is linked to our production reporting server, PRD1 (SQL Server 2008 instance), ...
15
votes
2answers
3k views

Restore database excluding FILESTREAM data

Context We are developing a system with a large-ish database in the bottom. It is an MS SQL database running on SQL Server 2008 R2. The total size of the database is about 12 GB. Out of these, ...
2
votes
2answers
2k views

Replace cursor with set-based approach

I am looking to replace my cursor-based solution if possible in a particular stored procedure. If it makes any difference, this is running on SQL Server 2008 R2. I am looking more for an algorithm ...
2
votes
1answer
1k views

Connection to localhost dramatically slower than to network server

I have an Excel VBA application that connects to a SQL Server 2008 R2 database through ADODB. When I'm on the network at work, the connection is almost instantaneous. When I am at home working with ...
3
votes
1answer
414 views

Transaction log growing on a mirrored principal

I have a pair of SQL Server 2008 R2 servers hosting a synchronously mirrored database with no witness. This weekend, we had to do some network maintenance so I paused the mirroring. Upon resuming, the ...
3
votes
1answer
1k views

Where do I find the meaning of TdsInputBufferError numbers?

We are having some sporadic connection errors on some of our SQL servers. I did some searching and found out about the Ring Buffer in SQL 2008 R2 and found some information, but I am not entirely sure ...
8
votes
3answers
4k views

How to boost performance of virgin queries in MS SQL Server?

I have ASP.NET web site that does it's own independent caching of data and data does not change for long periods of time, so it does not need to query SQL Server second time with same query. I need to ...
4
votes
1answer
823 views

Mitigate negative effects of shrinking

Closely related to this question from a few weeks ago, but the answers didn't discuss how to do the dirty deed. Here's the situation: We now 15 GB data in a database, but a logging bug in an ...
0
votes
2answers
137 views

full outer join where join key in result always has value [closed]

I wish to do a full outer join between two tables A, B joining on A.ID = B.ID. Now, it is quite easy to include A.ID and B.ID in a result set. this will include rows where: A.ID is null, B.ID is not ...
-1
votes
2answers
373 views

Parsing a string result from a query

My sql server 2008 query returns a very long strings such as: GET ...
5
votes
2answers
271 views

Performing data update operations while backing up a large SQL Server database

I have a large (in the tens of millions of records) database that I am going to perform a full database backup on. However, the database is large enough that transactions can start before and during, ...
5
votes
1answer
1k views

SSAS Cube in Excel - Show only applicable rows with KPI?

I have a cube built in SSAS 2008r2. I'm exposing it for the moment through an excel PivotTable. I recently added a KPI to the cube, and when I show the KPI in my PivotTable interface it causes ...
3
votes
5answers
8k views

Convert varchar column to datetime

In SQL Server, I have a varchar column with value such as: 07/May/2012:00:06:22 07/May/2012:00:06:22 07/May/2012:00:06:22 07/May/2012:00:06:22 07/May/2012:00:06:22 QUESTIONS How do I convert ...
4
votes
1answer
378 views

SQL Server Partitioning - Parent / Child tables

I'm currently investigating implementing partitioning for a fairly hefty (800GB and growing) SQL Server database. All of the data in the tables is relatable to a date/time, however this date/time is ...
1
vote
2answers
668 views

Does Sql Server 2008 support Database Sharding

Does Microsoft support implementing Database Sharding using Sql Server 2008 R2 (any edition). From my limited understanding of it, I think, we could probably implement it using Sql Server Express. But ...
4
votes
2answers
2k views

Recover deleted records [duplicate]

Possible Duplicate: How do I get back some deleted records? Our C#.NET application mistakenly deleted all records from all tables of its database. The application automatically takes ...
2
votes
1answer
224 views

How to split tables without affecting all stored procedures

We have merge replication setup between corporate database and remote clients. Lately we realized that people working on the corporate server do not need data to be tracked by merge replication as ...
7
votes
1answer
819 views

Why does the order of parameters matter for sp_trace_create?

The first batch of the following script calls stored procedure sp_trace_create with parameters in documentation order; the second batch swaps the positions of parameters @tracefile and @options: ...
2
votes
2answers
213 views

Is it possible to retrieve the specific databases selected in a maintenance plan step?

I would like to use a tsql query to retrieve the databases involved in one of the steps in a database backup plan I've created. From a previous question, I understand that somehow, the data is ...
9
votes
2answers
362 views

Is there a set based way to load/read a tree branch with HierarchyId

I am playing around with HierarchyId, and I have not figured out a set based way to do the following: insert all subtree at once retrieve all subtree at once This question is related to my ...
5
votes
2answers
880 views

Error handling in container procedures

I'm aware of and use the techniques in this question. In my environment we have a lot of container procedures that call subprocedures, that may call other procedures, ad infinitum. For me ...
2
votes
1answer
63 views

SQL Server Cache population on server / service startup

We have upgraded our SQL Server instance with buckets of RAM, so it can now much more effectively cache . The issue is that it takes time (days) to populate the cache. As far as I understand this is ...
1
vote
1answer
241 views

I cannot write into SQL Server 2008 R2 express edition from C#

There is no error, the dataset is getting updated, but the database is not updated. I am using Windows authentication in connection string to the database. I have given accept changes on update.
4
votes
5answers
2k views

Automatically Execute Stored Procedure After Any RESTORE DATABASE Event

Is it possible to have SQL Server 2008 R2 Standard automatically execute a stored procedure in any given database that is restored or attachced to the instance? I've got close to a solution by ...
3
votes
2answers
303 views

How do I count rows with two properties in one index scan in SQL?

I have a table Units where I have rows ItemId, ItemCreationDate, ItemUnitsCount. ItemId is a primary key and I have a clustered index over it. I need to output the following: for each day I need to ...
5
votes
2answers
3k views

Find the disk size of specific rows

I am trying to figure out the disk size a number of rows in various tables take up. I can define this rows by a query. How can I find out the actual disk size that corresponds to the result set in ...
9
votes
0answers
2k views

Deploying dacpac application to SQL Server 2008 R2 [closed]

I cannot get dacpac working on my installation of MS SQL Server 2008 R2. I am using Visual Studio 2010 Shell with MS SQL Server Data Tools to build a project into a dacpac file. However, when I try to ...
2
votes
1answer
894 views

Mysterious disappearing consistency errors in SharePoint DBs

We have a pre-production SharePoint SQL server which threw an 824 error yesterday evening on the Content DB. As part of my investigation today, I ran DBCC CHECKDB on this DB and it came up clean. ...
0
votes
1answer
85 views

Copy snapshot files from Publisher, Paste and Apply on subscriber in SQL Merge Replication

I read an excellent article about copying the snapshot files for Transactional replication from Publisher to Subscriber and Apply them on subscriber. ...
14
votes
1answer
1k views

Recalculate Time Dimension in BIDS

I'm using BIDS to create a cube in SSAS 2008 r2. I used the wizard to create a time dimension. Part of that configuration is selecting a date range. After creation, I realized that I needed a wider ...
1
vote
1answer
408 views

Microsoft SQL Server 2008 R2 Subscriptions

I have an installation of SQL Server 2008 R2. In the subscriptions section I do not see an icon or button to create data driven subscriptions; in the previous installation of SQL Server 2008, I do ...
5
votes
2answers
3k views

REBUILD - Clustered Index, TABLE, or both?

I'm having trouble finding a definitive resource on this anywhere, so hopefully a guru can give me an answer here. I have a very large table that we had to add a column to. The clustered index is ...
2
votes
2answers
159 views

Impact of using mirroring to migrate between SQL Server 2005 and SQL Server 2008 R2

I've got a DB which sits on a machine (SQL Server 2005) due for replacement very soon. I'm planning on having the database mirrored to the replacement machine (SQL Server 2008 R2) so that when the ...
3
votes
1answer
230 views

Why might a table scan have a huge I/O Cost?

I know that table scans are bad, and that every table should have a primary key and clustered index, but I'm wondering what might cause the spectacularly bad performance that I'm seeing below in SQL ...