Microsoft's SQL Server is a relational database management system (RDBMS) that runs as a server providing multi-user access to a number of databases. It originated from the Sybase SQL Server codebase, which is why both products use the extension of SQL called Transact-SQL (T-SQL).

learn more… | top users | synonyms (2)

1
vote
1answer
27 views

How does the table scan in an UPDATE WHERE predicated on an unindexed column work?

I was looking into a deadlock caused by two concurrent UPDATE statements: UPDATE [table] SET [column] = 0 WHERE [unindexed_column] = @id My understanding is that because the column the WHERE is ...
4
votes
1answer
87 views

Finding all joins required to programmatically join a table

Given a SourceTable and a TargetTable, I would like to programmatically create a string with all joins required. In short, I am trying to find a way to create a string like this: FROM SourceTable t ...
1
vote
1answer
126 views

UPDATE with CASE with 2 tables

I have 2 tables and I want to update table2 with criteria of table1 and table2. The criteria are: 1.table1.amount > 10000 2.table2.flag is null or table2.flag = '0' So if the 2 conditions are ...
1
vote
1answer
74 views

Help on deciding how to pick Correct Index

I would like to ask for some help to create correct indexes for this query: SELECT DISTINCT D.TypeID FROM dbo.Sizes AS S WHERE EXISTS ( SELECT 1 FROM #PermissionsTable AS PT ...
1
vote
2answers
77 views

Collation by row, not by column

Is it possible in SQL Server to set collation on individual rows in a table (as opposed to by column, database or server)? If not, perhaps does anyone know if this is a planned feature for SQL Server ...
1
vote
1answer
31 views

Increase memory limit when server is stopped

There was a local SQL Server 2012 instance. Once memory has decreased to critical 128 MB and then has stopped by me. I can not start it (idea: not enough memory). Is it possible to increase this ...
3
votes
1answer
157 views

How to check the status of log file restore for SQL Server

Used this script to restore a full backup (about 30GB of data and 100GB log) on a SQL Server 2012 box: RESTORE DATABASE [dbname] FROM DISK = N'S:\import\dbname_201505131100.bak' WITH FILE = 1, MOVE ...
0
votes
0answers
31 views

Relationship between file shrink and used memory in SQL Server

Some background info: this is a test SQL Server 2012, with restored databases from production servers, all of them with over 20% space available in the data file, up to even 50%. I'd rather restore as ...
0
votes
1answer
13 views

Stored Procedure Resultset Row Count and Resultset Size in Bytes/KBs

Is there any way to get total row count and size of result-set generated by a stored procedure execution? @@ROWCOUNT is a good option if its already added in each stored procedure but I just want ...
1
vote
1answer
20 views

Recover master database

I got the followng error 2015-05-13 12:04:31.00 Server Using locked pages for buffer pool. 2015-05-13 12:04:31.10 Server Using dynamic lock allocation. Initial allocation of 2500 Lock ...
2
votes
3answers
234 views

Login failed for user 'domain\Administrator'. (Microsoft SQL Server, Error: 18456)

On my newly installed SQL Server 2014, I get the following error when trying to connect to the SQL Server: 2015-05-13 12:09:38.40 Logon Error: 18456, Severity: 14, State: 5. 2015-05-13 12:09:38.40 ...
0
votes
1answer
27 views

SQL Server restore full backup + partial differential backups

I created a full backup of my database using SQL Server Management Studio wizard, and then I perform differential partial backup each day via cmd to the same file. SQL Server version is 2008 R2. ...
6
votes
1answer
58 views

Capture and Replay workload

We have a new server which we are migrating too and want to see the potential benefits of the hardware. So the idea is that we capture a workload and replay this against our new box. My question is ...
4
votes
1answer
88 views

Find what data is placed in a datafile

I have a database with 5 .ndf (secondary) datafiles on SQL Server 2008 R2. (Each of these datafiles is assigned to a separate filegroup.) I want to know what data is there in those files. Is it ...
0
votes
1answer
23 views

Will SSDT-BI work with SQL Server 2008 R2?

Sorry if this is redundant, but due to the crazy naming of the tools, it's hard to find the answer to the question. Question 1 Will SSIS packages, reports and so forth built with Microsoft SQL ...
2
votes
0answers
46 views

Receiving error when running DBCC CheckDB - multiple IAM pages

Running DBCC CHECKDB (dbname) WITH NO_INFOMSGS, ALL_ERRORMSGS results in this error: Table error: Multiple IAM pages for object ID 813245952, index ID 1, partition ID 72057594073972736, ...
3
votes
1answer
35 views

SQL Server Disk IO Performace appears different between otherwise identical servers

I have two identical servers each running Microsoft SQL Server and performing a batch processing job. Server #2 keeps timing out while processing while server #1 appears to be running smoothly. I ...
8
votes
2answers
104 views

Getting a realistic query plan when partitioning with low volumes of data

We're using partitioning to reduce the amount of blocking our OLTP system experiences due to locks, with a partition scheme that splits the working tables into 100 partitions based on a customer id. ...
3
votes
1answer
40 views

When are the unnecessary row versions being removed from the version store

Sorry for my bad English :) I need a help with understanding version store`s cleaning. I have the following situation. 12:00 Start a select statement under the snapshot isolation level and not ...
2
votes
2answers
154 views

History of database restore completion times?

I'm trying to estimate the restore time for a few 1TB+ databases on SQL 2012. Is it possible to look at completed restores from the last year and list the completion time ? It's an odd remote server ...
3
votes
2answers
86 views

Verifying connection pooling server side with CONTEXT_INFO on

I'm working with a 3 tiered application, Microsoft Dynamics AX, where the middle tier maintains connections to a SQL Server. Several clients connect to this middle tier server. The middle tier server ...
2
votes
2answers
26 views

Disabling sql services while performing maintenance on SQL Server 2008 R2 cluster

Our storage team is performing updates on an MPIO driver for our SQL Server 2008 R2 cluster. They suggested disabling the sql server service on the node they are doing the update on - will disabling ...
-1
votes
1answer
17 views

SQL statement for comparing actual products and plan products

I need some helps for writing SQL statements to compare count of actual products and plan by like below 2 Input tables: CREATE TABLE PRODUCT_PLAN ( PRODUCT NVARCHAR(50), START_TIME ...
0
votes
2answers
30 views

OLE DB Driver sql 2008r2 to Oracle failing

I have a SQL Server R2 Installation running on Windows Server 2008 R2. I have installed Oracle Instant Client, registered the OraOLEDB.Oracle driver(orasql12.dll), and set the PATH in environment ...
3
votes
1answer
42 views

Secondary replica indexing

I have a question, about a question, that is part of the 70-462 Microsoft exam. I had this question today, and I'm not completely sure of the correct answer. While I did pass the exam, I would like ...
-1
votes
1answer
29 views

Retrieve Column name as Data [closed]

Based on this code below from adventurework, I would like to display the name of the column as a data in the first row and the remaining rows are data of the column. I do not know how to do it. ...
5
votes
3answers
373 views

Get MS SQL Server to release disk space

A poorly managed database table has grown to be enormous. 48+gigs of orphan records. I am trying to clean it up and put my dangerously full hard drive back to a normal state. I will be deleting approx ...
1
vote
0answers
37 views

Statement succeeds, data missing [closed]

I have two reports from the same customer, where they claim that an error occurred that implies a SQL Statement didn't execute. These are very simple statements, setting a value in a single column. I ...
0
votes
0answers
32 views

Deep cloning a hierarchical database structure

I am trying to clone a hierarchical structure in my database, and I almost have it working; however I can't seem to get the output clause to access a column from a select statement. This is generally ...
0
votes
1answer
51 views

Invalid object name 'sys.dm_os_volume_stats'

I am trying to select 15% of disk space available in a server. SELECT DISTINCT s.volume_mount_point [Drive], CAST(s.available_bytes / 1048576.0 as decimal(20,2)) ...
-3
votes
0answers
22 views

SQL Server - Count the number of times the contents of a specified field repeat in a table [migrated]

What's the best way to 'SELECT' a 'DISTINCT' list of a field from a table / view (with 'WHERE' criteria) and alongside that count the number of times that that field content repeats in the table / ...
4
votes
1answer
67 views

Tempdb change settings and recommendation

In my production database I have below configuration in TempDb and needless to say I am facing a lot of IO issues on the drive . So, as per recommendation I am planning to change it Change #1 ...
3
votes
1answer
38 views

Pagination performance, with subquery, inner join and where

I am trying to optimize following query (this is most simplified version I could came up with): SELECT tr.Id, StatusDate FROM ( SELECT tr.Id, tr.StatusDate FROM mon.ArchivedTaskResults_201504 ...
0
votes
0answers
39 views

DB_STARTUP blocking on spid 7

I have a sql server 2012 instance that I'm installing a new license on that had previously had an evaluation license. I've did this on two other servers with out incident, but this server is giving me ...
4
votes
1answer
192 views

Large Transaction Backup

On my SQL database I run a full backup at 6am and transactional backups every 15 minutes on week days starting at 8am. Every Monday the first transactional backup is 7 Gb. I want to know why, my ...
0
votes
1answer
38 views

Database Default Locations doesn't persist

When I set the default location for the Data & Log in the Server Properties in SQL Server 2012, and click Ok, it resets back to the previous value immediately - if I reopen the Server Properties, ...
1
vote
2answers
26 views

Naming The SSRS Report Name based on the Parameters Passed

I want to save my SSRS Report Based on the Parameters Passed. i.e. Am passing P1 And P2 as parameters so I want my SSRS Report name as P1_P2_ReportName.Xtension. Any suggestions?
0
votes
1answer
40 views

Why temdb and log file size is not reduced by SQL Server

With a series of question Part1, Part2 and Part3. With the answers and research on internet I came to know that TemDb is use for holding different values (ex.: Temp variable, Temp table, CTE, Hash ...
0
votes
2answers
63 views

Index on Column with only 3 status?

I have a table with millions of rows. This table has a column which we frequently filter(means we use it in WHERE clause frequently), the values are Insert/Update/Ignored. Is it make sense to add ...
0
votes
2answers
49 views

Insert query with a subquery

I want to insert somewhere around 400 rows into a table. All of the column values will be the same fixed value for most of the columns, with exception to one column which I want to pull from a fairly ...
4
votes
2answers
65 views

Have full SQL Server restore but losing 1 day of data

I have SQL 2008 R2 64bit and it is backed up with ASIGRA SQL backup. The issue I have is that we had corruption on the server and the DB got corrupted yet the LDF file is in tact and does have all the ...
0
votes
2answers
76 views

How to create a VIEW in SQL Server [closed]

I have a user table and I need to create a VIEW so a user can only see their own data/row. How could I achieve this? I have been searching online but I can't find anything useful User with user_id, ...
0
votes
0answers
22 views

create two foreign key from one table sql server

i am creating user table like code PK Table CREATE TABLE TblUser (UserId int identity primary key ,Name varchar(20)) AND creating one more table FK Table CREATE TABLE TblAnnouncements (Id int ...
0
votes
1answer
37 views

How to enforce that one row in a parent table MUST be associated with at least a row in a child table [duplicate]

I have a one to many relationship enforced via FK, classic example order and order_item, whereby a fk on the order_item to the order table enforces that one item belongs to one order, and one order ...
0
votes
1answer
38 views

how big of a role does hardware play? [closed]

I'm the developer, not the DBA. I don't know much about setting up databases but i'm concern of the setup at my current work. The server is installed on desktop PC hardware(i7, 16GB RAM, 1 TB SATA ...
1
vote
1answer
18 views

SSIS Package Security

I am writing a Package for one of my client according to his requirements. Package development is totally complete now time is to protect it with some security. Is this possible I encrypt all the data ...
3
votes
2answers
78 views

SQL Server 2008 R2 - Unable to delete Login

I've been using this site for a while and this is the first time I've had to ask a question, but just wanted to say "Thank You" to everyone who has helped me in the past (without knowing they did so). ...
5
votes
2answers
80 views

Is it possible to change the default style used by CAST/CONVERT when converting DATETIME? [closed]

When you attempt to CAST a DATETIME as VARCHAR in SQL Server, the default date formatting style is a fairly inaccurate date format that loses the precision of both seconds and milliseconds. For ...
2
votes
3answers
62 views

Order by query optimization for multi select data (enum)

We previously used to store multi select data (enum) using pipe separated characters, as shown below like this - which made ordering on that enum data very simple. ╔═══╦════════════╦═════════════╗ ║ ...
1
vote
2answers
74 views

Merge faster than Insert

Are there any advantages/disadvantages of making use of a merge over a insert function? Can an insert statement make use of the `OUTPUT' Note: the ON clause for the merge is set to 1=0 (always ...