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

learn more… | top users | synonyms

-1
votes
0answers
14 views

Create a function that returns next working day [on hold]

I have a stored procedure that takes a date as input and returns if it is a holiday. I want to create a function that returns next working day based on that stored procedure and also exclude weekends ...
-2
votes
1answer
23 views

How to display money in 12 Lc or 2 Cr

hi i want display money as 12Lc or 2Cr if money =1200000 as 12 Lc when 12000000 as 1.2 Cr how can i do this help me guys
1
vote
2answers
205 views

Joins between linked servers are dangerous, so can we just load the data into a local table before doing the join?

I was just reading the following article which states that it's a worst practice to do JOINs between two linked servers. The only alternative I can see is to get the necessary data from both linked ...
1
vote
1answer
47 views

Fixing an error 9004 without taking the database offline

My database (SQL Server 2008 r2) is running fine but I’m getting the following error in my event log. Error: 9004, Severity: 23, State: 6. An error occurred while processing the log for database ...
2
votes
3answers
74 views

Should I shrink my database?

I have a 1.2Tb SQL Server 2008 R2 database which is more than 50% empty, because I migrated a lot of functionality to PostgreSql. The database is still in use, and still somewhat growing, but I do not ...
3
votes
4answers
485 views

How do I place leading zeros for numbers less than 10 without affecting those 10+?

Probably a newb question, but... I have a table with a VARCHAR field containing numbers 1 through 300. I need to place a leading zero in front of any numbers less than 10 while retaining the original ...
1
vote
1answer
25 views

It is mandatory to create a route when creating an event notification?

I'm starting with service broker. Already managed to setup an event notification for blocked processes based on this answer and it's working flawlessly. Then I wanted to setup another one to notify ...
3
votes
1answer
44 views

difference between index REBUILD and REORGANIZE in relation to recompile in SQL Server 2008 R2

Does the INDEX REORGANIZE index cause recompilation of the stored procs the same way as INDEX REBUILD
0
votes
3answers
53 views

How to display posted on date and time like1 hr ago or 30 min ago

i want to show the posted date like 1 hr ago.. or 30 min ago.. declare @date datetime ='2014-07-24 11:50:22.033'; SELECT CASE WHEN DATEPART(DD,@date)=DATEPART(DD,GETDATE()) THEN CASE WHEN ...
0
votes
1answer
34 views

Securing an Internet Database Connection

I am looking to setup a website and database that are connected via the internet, and am looking to secure the connection. The connection will probably not be over a VPN, so shall be openly exposed. ...
0
votes
2answers
80 views

SQL Server 2008 R2 memory issue

I have read many posts regarding the memory but still its not clear. I have dedicated server SQL Server 2008 R2 with Windows 2008 R2, 32 GB RAM, 2 6 core processor and a database of around 60 GB on ...
2
votes
0answers
51 views

CREATE DATABASE defaulting to wrong log path

I have a script that automates creating a database across multiple servers and on one of my servers a, SQL Server 2008 R2 SP 2 instance, the script failed with: CREATE FILE encountered operating ...
2
votes
1answer
55 views

SQL Server 2008R2 convert collation

I have an existing database that uses the Arabic_CI_AS collation, but I need to convert it to SQL_Latin1_General_CP1_CI_AS the default collation for the server, but the problem is when I use the ...
0
votes
0answers
15 views

full text index not being updated

I have a table that has a full text index defined on it. Change tracking is set to 'Automatic' but I can see that 'Table Full-Text Pending Changes' is set to '58429', and recently added rows (for the ...
0
votes
1answer
23 views

Merge Replication - Merge initial data contained on subscriber

I have two identically structured databases on two separate servers. Both have different data within them. I have set one of them up with merge replication as a publisher and I want the other to be ...
0
votes
2answers
45 views

How to provision the SQL Server Agent service after SQL Server Edition upgrade

I have upgraded SQL Server 2008 R2 Express to SQL Server Standard Edition. After I have upgraded it, the SQL Server Agent was stopped. I have tried to start but it fails. Only when I have changed ...
3
votes
1answer
24 views

Use of Trigger After a Transaction

I have a scenario where there is a transaction being executed to update a few tables. On one of these tables there is a trigger that accesses the data on those tables, but is only planned to be on ...
0
votes
2answers
82 views

Upgraded from SQL Server Express to standard but CPU usage is maximum 50% on dual core [closed]

I have upgraded SQL Server Express 2008 r2 to SQL Standard Edition on amazon EC2 with a Intel Xeon E5-2670 v2 (Ivy Bridge) Processors with 2 vCPU. I have verified the edition by running this: SELECT ...
2
votes
2answers
105 views

Table with 4 million records - different size and performance in development and production

At my company we use SQL Express 2008 R2, which supports databases up to 10GB. We have 2 databases with almost the same number of rows in all tables. But, one of them is 4.5 GB in size (which is in ...
0
votes
2answers
54 views

Analyse what caused a pagesplit afterwards?

Ok normally we have 0-20 page splits per second, but last night it spiked to ~500. Now is there any way to figure out what caused it? I know i can run the following to find mid page splits but it ...
0
votes
2answers
80 views

Query Optimization required - Subquery using Inner Join

Could anybody advise how can I optimize this query below please? SELECT IT.[iInternalTransactionID] , IT.[iInternalAccountID] , C.[iContractID] , IT.[dtTransactionDate] AS TransactionDate , ...
0
votes
0answers
46 views

SQL Server 2000 Named Instance cannot connect remotely

To facilitate a migration I installed SQL Server 2000 Standard Edition and Service Pack 4 as a named instance on server with an existing instance of SQL Server 2008R2 RTM. The issue I have is ...
1
vote
2answers
57 views

Rapidly increasing TempDB write latency

We have two servers that were set very similarly, but not identically. These two servers have hugely different performance running the same application. On server A the application runs successfully ...
4
votes
2answers
743 views

Is it possible for SQL Server to miss rows on a select * where PK = “value” query

We have just migrated an application to an SQL Server 2008 R2 from SQL Server 2005 and moved from a physical to virtual hosting environment. I have a very strange error in our application and I was ...
0
votes
1answer
37 views

Sql Server sys.Traces log

Working with traces on production server I found some mysterious entries to me in sys.Traces, When I run below query it shows me status of all traces as ‘Paused’ along with entries in ...
0
votes
2answers
44 views

Where are my .NDF files located?

I have created a sample database called TestDB. After that, I ran this select: select * from sys.master_files I found my .MDF, .LDF files from this select. Then I want to find out the .NDF file ...
0
votes
1answer
19 views

Can I set up a SQL Server database based on an excel file which refreshes automatically with any changes in the source excel file?

Can I set up a Server database based on an excel file which refreshes automatically with an changes in the source excel file? I am currently using SQL Server 2008?
2
votes
2answers
48 views

Switching from SIMPLE to FULL recovery mode implications

I have several databases that I'd like to move over to FULL recovery mode so we can have point-in-time restore capability. We don't need it on all of our databases, just the ones that are transaction ...
2
votes
1answer
60 views

Database backup taking longer than usual to a networkshare

The SQL server does backups with this command to a network share \BackupServer\weekeklybackups" BACKUP DATABASE DBNAME TO DISK = '\\BackupServer\weekeklybackups\DBNAME.BAK' There is a 1 gig network ...
1
vote
0answers
23 views

Unable to locate database - Login failed

I am having trouble locating the database and when I go to SQL it wont even allow me to refresh nor back it up. Below is the error that I get. Unable to open database "XimbaTC". Reason: Cannot open ...
1
vote
1answer
67 views

Enforce referential integrity between two groups of data

I have two sets of records: A collection of rules. A collection of actions to perform based on those rules. What I'm trying to model is something like this: Multiple rules can be grouped ...
0
votes
0answers
42 views

Why a select from the tables, joined by a CASE statement, could be 7x slower?

There are two queries from the same two tables: one joins them on the columns @t1.b and @t2.x, the other uses a case statement as below. The 2nd query is 7x slower. The record counts are only ...
0
votes
1answer
52 views

SQL Server 2008R2 Migration to new Platform - What Steps Required?

We are migrating our SQL Server 2008R2 instance from one Windows Server platform to another. SQL Server will remain as 2008R2. The new plaform will have more disk space, memory and CPU. I am doing up ...
1
vote
1answer
98 views

Two SQL Server databases setup with same .mdf and .ldf files

In a SQL Server 2008 R2 instance two databases (the second one being a restore/copy of the first one) have been setup against the same .mdf and .ldf files. How would I go about either deleting the ...
3
votes
3answers
114 views

Log File Management - Space on Disk

At our organisation we have several non-Production environments where Developers run free and wild with TSQL code and databases. The DBA team do not normally monitor or maintain them. Recently several ...
0
votes
0answers
30 views

MS SQL SERVER Database mail stopped working automatically due to Timeout error

I am using SQL Server 2008 R2 SP1 , sometime database mail stopped automatically with the following error. How to fix the same. It have service broker enabled and i cleared the unsent mail. ...
1
vote
1answer
20 views

How do I go from .xlsx to sql Server

I'll try my best to explain this. I've got a spreadsheet (.xlsx) with 220 rows and 15 columns. I need to make it into 3rd normalized form eventually, but how do I get the data from the spreadsheet ...
2
votes
2answers
47 views

Should I opt for a new database or adding more tables?

this is a question around best practice that I'm currently dealing with. I have a database (SQL Server 2008 R2) with a heap of tables (around 40) with data, now the need has risen to have logging of ...
0
votes
2answers
50 views

Are #tables and #procedures 'not best practice' or 'bad practice'?

I am working on a project and part of it is an interface tool that executes SQL code stored in a xml file to import/export files. In the file, temp procedures and temp tables are used quite heavily ...
-3
votes
1answer
62 views

Select Top N rows for Employees in a SQL Server table

I would like to select the TOP 2 activities carried out by all employees from an Employees table "Emp" which has a timestamp column. The regular "Select Top 2 * from Emp...." will only fetch the top ...
0
votes
0answers
14 views

Configuring Reporting Services - ExecutionLogDaysKept

Is it possible to set Reporting Services options when Reporting Services is not installed on a server? Is this how a SQL Server instance used by SharePoint works? I'm a new DBA (very junior...), and ...
2
votes
2answers
46 views

Shared Memory with Microsoft Hekaton

Does the Microsoft SQL Server 2014 In-Memory Engine supports Shared Memory access like Oracle TimesTen? I only found that there was a protocol with this name in SqlServer2008 but i found nothing for ...
1
vote
3answers
54 views

Matching 3 columns in row - if one column is null then exclude it from comparison

A B C Equal 1 1 1 Y 2 2 NULL N Hi, I have 3 columns which I need to compare : Columns A,B,C. If these 3 columns are the same then column 'Equal' = 'Y' But, if a column is null, ...
0
votes
0answers
31 views

Rebuilding an index not working? [duplicate]

I noticed that when I right click manually on an index and choose "Rebuild" or "Reorganize", its not giving any indication that its doing so, then I click on properties again for the same index, I see ...
2
votes
1answer
48 views

SQL Server many-to-many relationship, row reuse?

Below is your typical many-to-many relationship. Pretend there are 2 tasks that have the exact same Tags. because of foreign key/primary key relationship constraints, there is no way for the rows in ...
0
votes
0answers
20 views

Garbage DB Objects Cleansing

How do I find in use db objects from all application pages is there any tool or trick I can use, just like we do search in Visual studio for an object in entire solution
-2
votes
1answer
45 views

Using the “Select Top (100) percent vs. Select * , or selecting any column” [closed]

I wrote the first query below that I was hopeing to give me the exact same results that the 2nd query does, but it seems there is one recrod different: SELECT DocumentSourceName FROM ...
-2
votes
0answers
54 views

Purging millions of records from audit tables on a regular basis

I'm an accidental DBA. I want to purge millions of records from audit tables on a regular basis. I was told that Truncate is not an efficient way of doing it. Our firm doesn't have a DBA, so one of ...
3
votes
1answer
50 views

Maxdop in Profiler

Say I run a server side trace against a SQL Server 2008 R2 instance, which has Maxdop = 1 in place, then I run the trace through readtrace.exe to get RML files for replay. Does the replay preserve ...
0
votes
0answers
91 views

Error attaching mdf file to SQL Server 2008 R2 [closed]

When I want to attach a .mdf file to SQL Server 2008 R2, but I get the following error: Attach database failed for Server 'BABAK-PC'. Unable to open the physical file ...