Questions tagged [sql-server-2008-r2]

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

SQL Server 2008 R2 was introduced in April 2010. Current build versions include:

  1. 10.50.1600 RTM
  2. 10.50.2500 Service Pack 1, released July 2011
  3. 10.50.4000 Service Pack 2, released July 2012
  4. 10.50.6000 Service Pack 3, released September 2014 (final)

SQL Server 2008 R2 left mainstream support on 2014-07-08, and will leave extended support on 2019-07-09.

3808 questions
98
votes
4 answers

SQL server databases stuck in restoring state

I have a Sharepoint server. We had an issue with our backup tool and now some of my databases are stuck in restoring state! Is it possible to stop the restoring process? and also, How can I make sure the database integrity has not been compromised?…
Pooya Yazdani
  • 1,093
  • 1
  • 8
  • 7
60
votes
5 answers

Why does ALTER COLUMN to NOT NULL cause massive log file growth?

I have a table with 64m rows taking 4.3 GB on disk for its data. Each row is about 30 bytes of integer columns, plus a variable NVARCHAR(255) column for text. I added a a NULLABLE column with data-type Datetimeoffset(0). I then UPDATED this column…
51
votes
5 answers

Data obfuscation in SQL Server

What is the best practice for Data Obfuscation in SQL Server? We'd like to use masked Production data in our UAT system. If we want to do it quickly, and with a higher level of obsfucation, what approach should be taken? I'm thinking about…
Sky
  • 3,674
  • 16
  • 48
  • 68
51
votes
4 answers

What are Objective Business Reasons to Prefer SQL Server 2012 over 2008 R2?

My company is facing the decision whether to purchase SQL Server 2012 Denali or SQL Server 2008 R2 for a new database server. I am looking for objective reasons to choose one over the other. Our requirements: Standard edition (for financial reasons…
usr
  • 7,240
  • 5
  • 30
  • 58
50
votes
4 answers

How export a sql server 2008 diagram to PDF filetype?

I want to have an export from my database diagram to PDF or image types. How can I do this? I worked with SQL Server 2008 R2.
Hamid Talebi
  • 605
  • 1
  • 6
  • 8
50
votes
1 answer

Is there an analog of GETDATE() that returns DATETIME2

According to MSDN, Getdate(), GetUtcDate(), and CURRENT_TIMESTAMP all return DATETIME. I ran a short test, which confirms that: CREATE TABLE #t(T DATETIME2(7)); GO DECLARE @i INT ; SET @i=1; WHILE @i<10000 BEGIN ; INSERT #t…
A-K
  • 7,154
  • 3
  • 31
  • 50
49
votes
3 answers

How to make sqlcmd return an ERRORLEVEL other than 0 when the .sql script fails?

I'm running sqlcmd from a batch file and I was wondering how to make it return an ERRORLEVEL other than 0 when something goes wrong with the backup.
leeand00
  • 1,690
  • 5
  • 20
  • 36
48
votes
2 answers

What is the actual behavior of compatibility level 80?

Could somebody provide me with a better insight about the compatibility mode feature? It is behaving different than I expected. As far as I understand compatibility modes, it is about the availability and support of certain language structures…
souplex
  • 833
  • 1
  • 8
  • 10
47
votes
2 answers

Best way to get last identity inserted in a table

Which one is the best option to get the identity value I just generated via an insert? What is the impact of these statements in terms of performance? SCOPE_IDENTITY() Aggregate function MAX() SELECT TOP 1 IdentityColumn FROM TableName ORDER BY…
AA.SC
  • 3,993
  • 4
  • 24
  • 41
43
votes
5 answers

Why is SQL Server consuming more server memory?

SQL Server is consuming 87.5 % of my server RAM. This recently caused a lot of performance bottlenecks such as slowness. I researched this issue. One common solution I could find on the internet is to set the maximum limit for SQL Server. This was…
kombo
  • 657
  • 2
  • 8
  • 11
42
votes
3 answers

Execution Plan Basics -- Hash Match Confusion

I am starting to learn execution plans and am confused about how exactly a hash match works and why it would be used in a simple join: select Posts.Title, Users.DisplayName From Posts JOIN Users on Posts.OwnerUserId = Users.Id OPTION (MAXDOP 1) As…
Kyle Brandt
  • 2,335
  • 8
  • 29
  • 37
41
votes
3 answers

difference in execution plans on UAT and PROD server

I want to understand why there would be such a huge difference in execution of the same query on UAT (runs in 3 sec) vs PROD (run in 23 secs). Both UAT and PROD are having exactly data and indexes. QUERY: set statistics io on; set statistics time…
Kin Shah
  • 61,609
  • 5
  • 116
  • 235
41
votes
1 answer

SIMPLE or FULL recovery model for databases?

When should I use the full recovery model and when should I use the simple recovery model for databases? I always used the full recovery model because it is the default, but today i encountered this error: Microsoft OLE DB Provider for SQL Server…
MicBehrens
  • 759
  • 1
  • 8
  • 19
41
votes
6 answers

Why does adding a TOP 1 dramatically worsen performance?

I have a fairly simple query SELECT TOP 1 dc.DOCUMENT_ID, dc.COPIES, dc.REQUESTOR, dc.D_ID, cj.FILE_NUMBER FROM DOCUMENT_QUEUE dc JOIN CORRESPONDENCE_JOURNAL cj ON dc.DOCUMENT_ID = cj.DOCUMENT_ID WHERE…
41
votes
1 answer

SLEEP_TASK Wait Type in SQL Server - What does it indicate?

I haven't seen the SLEEP_TASK wait type before, and today I seem to be getting a ton of them. I'm not the official DBA, just a SQL Server developer who knows some DBA stuff. We upgraded our servers last weekend to 10.52.2500.0 - R2SP1 I think. All…
JNK
  • 17,858
  • 5
  • 58
  • 97
1
2 3
99 100