Questions tagged [sql-server-2008-r2]

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

Filter by
Sorted by
Tagged with
2 votes
1 answer
1k views

Duplicating rows based on a count column SQL Server [duplicate]

I have the following table: MyTable PlaceID NameID Code CodeCount 1 1 1234A 2 1 2 1234A 3 1 3 1234A 1 2... 2... 3... 3... I want to select 1234A where ...
Dan's user avatar
  • 167
0 votes
1 answer
84 views

Speeding up "duplicate" checks

We have an events table that is reasonably large (~35 million rows) The original table is like this, CREATE TABLE [dbo].[Events]( [EventID] [int] IDENTITY(1,1) NOT FOR REPLICATION NOT NULL, [...
user1664043's user avatar
0 votes
0 answers
761 views

An expression of non-boolean type specified in a context where a condition is expected, near 'List'

myconn.Open() Dim command As New SqlCommand("Select * from Food where Food List = @list", myconn) command.Parameters.Add("@list", SqlDbType.VarChar).Value = txtbox1.Text Dim ...
hunter's user avatar
  • 1
0 votes
1 answer
1k views

calculate running balance of debit credit using union all

i'm making account statement for which i need that account balance before today and with each transaction row of debit or credit plus and minus from initial opening balance on the basis debit/credit ...
Osama Rizwan's user avatar
0 votes
1 answer
87 views

How to export my query output to CSV in SSMS

I have some outputs in SQL Server Management Studio, but want to export them to CSV for easy transmission to another db. I have seen command to export to xml but not CSV. Thanks Abdulmojeed
Abdulmojeed's user avatar
0 votes
2 answers
177 views

T-SQL Update Random String Value in Column

I have a table that contains a file path column containing data like this. C:\ABC\Files\AA.dat C:\ABC\Files\AA.Unbound.qp C:\DEF\AA\GGG Build 1 Modules\Random123.qpp C:\DEF\AA\GGG Build 1 Modules\...
Stockburn's user avatar
  • 429
0 votes
0 answers
29 views

Count Split across Shifts

I have a table which registers orders with a PlanStartTime and PlanEndTime. The customer has three shifts in a day starting from 7 AM - 3 PM, 3 PM - 11 PM, 11 PM - 7 AM (next day) Say an order is ...
Kaushik's user avatar
  • 11
0 votes
1 answer
84 views

Index Fragmentation - log issues

I have a few questions that I want to understand in order to take informed decision. I am not a DBA by profession, I have done some administrative tasks in the past and now I would have to create a ...
jxs5455's user avatar
  • 23
0 votes
2 answers
869 views

why there is no incremental backup in sql server [closed]

How i can change my database backup type from full backup to incremental backup? Is that possible? Why there is no option for incremental backup type.
Logain Theran's user avatar
0 votes
1 answer
93 views

Details of transactions in SQL SERVER 2008 R2

I need following details: Username of the user who initiated the transaction Origin of the query i.e. Whether Query executed in SQL server New Query Interface or Transaction due to editing in Table ...
IT researcher's user avatar
-1 votes
2 answers
324 views

How to get First in and Last out in multiple records with night shift:

We have Date, Time, EmpId, InOut, Shift_Start_Time and Shift_End_Time of an employee. Need your help to write a sql for these conditions: 1.Consider the records which Time is falling between ...
Deepa's user avatar
  • 1
2 votes
1 answer
959 views

VLF count suddenly growing and unable to reduce it

Owing to reductions in IT resources, I am now finding myself having to manage this with limited knowledge and so am seeking advice, please. We have 2 SQL servers with replication of multiple ...
CVee's user avatar
  • 21
0 votes
1 answer
2k views

Unable to connect to SQL Server from one machine; "an existing connection was forcably closed by the remote host"

Connecting to the SQL Server (2008 R2 SP3 - KB 4057113) with SSMS version 18 yields: A connection was successfully established with the server, but then an error occurred during the login process. (...
Joshua's user avatar
  • 426
6 votes
2 answers
234 views

Optimize/Speedup query

Below query is used for inserting and updating the tables in the SQL Server database. The XQuery is slow while executing in SSMS for first time. Query insert new <ROW> Update BalanceTable set [...
IT researcher's user avatar
0 votes
1 answer
294 views

SQL Server Express 2008R2 - restore db failing due to size limit, but file is under 10GB

I'm trying to restore a live db to a test db, but I keep getting a '..failed because the resulting cumulative db size would exceed...limit of 10240' error, yet my database is under 10GB, I feel like ...
hap76's user avatar
  • 15
0 votes
0 answers
134 views

Can Temporal Tables be implemented in SQL 2008 in a way that can be migrated to SQL 2016?

We have a system that is currently used by customers that have versions of SQL from 2008 R2 all the way to 2019. We want to start introducing, in a limited way, Temporal Tables, even for customers ...
Daniel Bragg's user avatar
0 votes
4 answers
1k views

Is there anyway to view historical performance of SQL 2008 R2 database?

So.. I was wondering, is there a way for me to generate any report for the historical performance of a MS SQL database? I'm originally an Oracle DBA, but now I'm requested to support a few SQL ...
Jason Oon's user avatar
0 votes
1 answer
172 views

How To Grant A User In AD Groups Which Is Denied To DML Commads, To Update On A Spesific Tables

I have a Active Directory user account named SQLQRY in my sql server. SQLQRY is permitted only read data. Those users can use onyl select statement. I need to give just update and delete permission on ...
DBA's user avatar
  • 69
1 vote
1 answer
823 views

Deny All DDL & DML Commands In Sql Server

I want to deny all ddl and dml commands to AD and SQL Server users over all the databases on my database server. How can i do that?
DBA's user avatar
  • 69
1 vote
1 answer
2k views

Stored procedures prefixed with sp_MSdel<TableName>, sp_MSins<TableName>, sp_MSupd<TableName>

I noticed in the database I manage a bunch of stored procedures for delete, insert, update prefixed with sp_MSdel, sp_MSins and sp_MSupd. Does anyone know what tool creates these stored procedures? ...
boggy's user avatar
  • 427
0 votes
2 answers
797 views

why a convert from varchar do date fails on a different row everytime it runs?

I have a database with a field like this (Dont know why it's varchar): 19950105 i'm trying to convert it to DATE as DDMMYYYY. I could do this with: convert(varchar(10), cast(The_ugly_field as ...
Racer SQL's user avatar
  • 7,374
0 votes
2 answers
66 views

Installation and shell to move physical and logical SQL Server in azure IaaS VM

Firts of all excuse my english is not my primary language. We are creating an azure template to deploy an IaaS machine with disks C and D with windows server, and the idea is also deploy an ...
Andres Arango's user avatar
0 votes
2 answers
4k views

UPDATE STATEMENT GETTING STUCK

I am facing a performance issue with an update statement. It takes too long to update, but when I perform a select on that updating table it completes very fast. UPDATE mo SET mo.RNCNEID = ts....
Kamran Lari's user avatar
0 votes
1 answer
49 views

Was SSRS installed in SharePoint Integrated Mode?

I've inherited an old QA database server with SQL Server 2008R2 (yes, yes, I know it's beyond EOL; there's nothing I can do about it!) and SSRS installed. It's the back end of a SP server on a ...
RonJohn's user avatar
  • 605
6 votes
1 answer
2k views

SQL Server - Files timestamps unchanged so what is it that's being backed up?

Please see the below snapshot, showing the timestamps of all the data files as well as transaction log files for one of the SQL Server instances under my management. This is a production instance. ...
RGO's user avatar
  • 423
2 votes
0 answers
974 views

SQL Server: Read Only replica of production server

I have a production database which is being used by my primary application. Another department has created a new application for which I need to provide subset of my data from my database. The new ...
Kartikeya's user avatar
1 vote
3 answers
3k views

How to Add A User To A Database In Standby / Read-Only Mode In Sql Server

I have a database which is in standby / read-only mode in my reporting server. But, I can not add a new user to this database. How can i add a new user to this database?
Furkan Yılmaz's user avatar
0 votes
1 answer
35 views

Can I modify the fill factor value while a database is in use?

I'm using SQL server 2008 R2. I asked a similar question before on this forum, now I'm asking: First, can I change the fill factor while the database is in use? Second, how can I determine the most ...
user197220's user avatar
0 votes
0 answers
86 views

Unfinished A Killed/Rollback Transaction [duplicate]

I have killed a transaction 2 days ago but it hasn't finished yet. You can see the situation in the pic. What can i do?
yummit's user avatar
  • 15
0 votes
1 answer
67 views

Sql Server view with very limited access

I have a requirement to limit a view in Sql Server 2008 R2 that user: user has access to select from view. user has not access to copy the result from select statement. user has not access to join ...
Nima Derakhshanjan's user avatar
1 vote
2 answers
281 views

Error while running sp_blitz in 2008 SQL Server and lower versions

I have created an SSIS package to run sp_blitz in my production servers. The stored procedure runs fine for servers having a version higher than 2012 but fails for 2008 and 2005. Please find the ...
l.lijith's user avatar
  • 888
-1 votes
1 answer
1k views

How to Find All Sql Server Users Privileges Rights

I want to list all user's privileges which is in Active Directory accout or using Sql Server account to connect to my database server. I want to see that which users have ddl right or which users can ...
yummit's user avatar
  • 15
0 votes
2 answers
1k views

Database Log File Size Growth So Huge Unexpectedly [duplicate]

My database has two log files. Their sizes are growing very fast. My backup sizes are becoming massive. I know that when I take full backup of my database, the log files are emptied but it is not. I ...
yummit's user avatar
  • 15
1 vote
1 answer
480 views

How to Get Backups & Restores Start and Finish Times?

I backup my databases from prod environment to file server. After taking my backups, i restore them to my report server. And i want to know that if i can get information about when backup and restore ...
yummit's user avatar
  • 15
1 vote
1 answer
131 views

Can I change Fill Factor option for our database server?

I have a production database for ERP which has clustered and non clustered indexes. Some other tables have index type as heap and i don't understand what does heap means. Every month i have a job run ...
Ayman Farouk's user avatar
1 vote
1 answer
253 views

Do I need to add more memory to my SQL Server 2008 R2 instance?

I've been asked if one of our SQL Server instances has sufficient memory. This is a SQL Server 2008 R2 Standard Edition running on a x64 machine with 40 CPUs and 64 GB of RAM. The total size of all ...
RGO's user avatar
  • 423
0 votes
1 answer
120 views

Capturing Column Names in Dynamic SQL Statement

I'm in the process of updating some procs made for SQL 2008R2 to 2016 that are using a dynamic result set. Assuming there is a procedure that always has exactly one result set, but the result set has ...
Jsjjharp's user avatar
0 votes
4 answers
3k views

Can I change tempdb size to a specific value and can I shrink it during our daily working hours on our production database

Can I change tempdb size to a specific value and can I shrink it during our daily working hours on our production database ?. Please tell me if it has bad effect on a production database. My database ...
Ayman Farouk's user avatar
0 votes
1 answer
323 views

Survey Database Structure

I am building a database to feed into a PowerBI dashboard. The data is extracted as CSV (SurveyResults) from Survey Monkey which will be loading into the MSSQL database. The outcome i am after is the ...
Vine's user avatar
  • 137
2 votes
2 answers
227 views

Log error restoring old database to SQL Server 2017

I am trying to migrate a database from an old SQL Server 2008 R2 to SQL Server 2017. The database was originally 2000 and thus has a compatibility level of 80. Initially I took a full database backup ...
Sheila's user avatar
  • 21
0 votes
1 answer
1k views

Moving Partitioning Files To Another Disk Drive In SQL Server

There is a production table which was partitioned by someone in our company. Some partitioning files was wrongly located to different disk drive. I have to move those files to the disk where they ...
Dbo's user avatar
  • 25
3 votes
1 answer
88 views

Inconsistency between object explorer and available database dropdown

I am working with SQL Server 2008R2. I am able to see a database in the "available database" drop down, but not in the object explorer. I am able to query it, for example select * from ...
testtesttest's user avatar
2 votes
2 answers
348 views

How can I backup my large SQL Server table?

Environment: SQL Server 2008 R2 Standard Edition on Windows Server 2008 R2 (yeah - I know). VMWare, Commvault. We have a 1.4 TB DB with one table. Here is the schema: CREATE TABLE [dbo].[...
PeterDaniels's user avatar
0 votes
1 answer
63 views

What is the best way to check for matching sets of rows?

I was watching this video yesterday on how unlikely it is to shuffle a deck of cards the same way twice: https://youtu.be/czSdEhtXwm4?t=300 And I thought to myself "My SAN adminsitrator still has ...
James's user avatar
  • 2,612
0 votes
1 answer
153 views

Without rewriting this query, is there a way to force the query optimizer to better estimate the amount of resources required, e.g. with query hints?

I know there's a couple of alternate ways to write this query, but I'm more curious if there's another approach that I could use to improve the performance by helping guide the optimizer in the right ...
J.D.'s user avatar
  • 35.2k
0 votes
1 answer
311 views

Define Database Size

I want to create a database with Size limitation. I am using sql server 2008r2 edition. Maximum size should be only 20GB. That means it should allow only 20GB space for particular database. How can ...
Jack's user avatar
  • 1
3 votes
3 answers
95 views

I need help with a SQL Query. SQL beginner here! [closed]

I'm totally new to SQL and I've inherited a customer's server (the company that managed it no longer exists). They need me to run a SQL Query that shows their inventory sold for pots. Specifically, ...
TomR's user avatar
  • 31
0 votes
1 answer
41 views

Is it safe to add more than primary data file to Temp DB in SQL server 2008 R2 as we have database server with 4 Core processor?

Is it safe to add more than primary data file to Temp DB in SQL server 2008 R2 as we have database server with 4 Core processor and please tell me the steps to do it .And does it will tune ...
Ayman Farouk's user avatar
1 vote
2 answers
232 views

Replace function removing Ones / 1 when removing char(185) (superscript 1)

Ok as the title suggests this is occuring. When using the REPLACE function on char(185) for data in a temporary table, ones ("1") are being removed as well. SQL SERVER 2008R2 UNICODE Data DB ...
Doug Coats's user avatar
0 votes
2 answers
403 views

How to find Sum of dynamically generated time attribute in sql server 2012

I have a table with two columns (TASKID and Dateadded). I am trying to find difference between timings and would like to calculate the sum of the diff (time) attribute. select taskid,dateAdded,CAST((...
Nalo Nenu's user avatar

1 2
3
4 5
76