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)

3
votes
1answer
43 views

SQL Server 2012 mirror setup - how to reduce transaction log files [duplicate]

We just upgraded our Windows Server 2003\SQL Server 2005 setup to Windows Server 2012/SQL Server 2012. Both configurations have a mirror with NO witness server. On the old setup the transaction logs ...
0
votes
0answers
7 views

Replication Conflict tables in SQL Server 2000

Due to previous several replications during these years in a database I'm working with, there are several tables with names with this format : *onflict_AllData_[Tablename] which * can be a, b, ... ...
1
vote
1answer
45 views

Dynamic Partition Elimination when using “OR ” or “IN”

Say I have a query like this: SET @ContainerId = 5 SELECT * FROM Container.Container_Partitioned WHERE containerId = @ContainerId When I run this, I get a query plan with Actual Partition ...
1
vote
1answer
53 views

SQL errors Microsoft.ACE.OLEDB.12.0 on dev box, but works on server

I'm inserting into a .xls spreadsheet from TSql code. Runs fine as an Agent job and on command from the server, but not on my dev box. Both complex and simple commands like: Insert into ...
2
votes
0answers
42 views

SQL Server DB Backups WaitTypes

I am backing up a database to a network drive. I am seeing the below Wait types for the backup. I have also tried backing up to a local drive and same issue (though backup does run much quicker). ...
0
votes
1answer
22 views

Talend collation issue in mysql

I am using Talend to backup MSSQL TO MYSQL Server. Everything goes well, I have a connection, data flows from one db to the other... however I cannot correctly copy diacritic signs. On MSSQL I have ...
0
votes
2answers
28 views

SQL Server DB Restore Unable to browse directory

I have a problem with SQL Server 2008. When I try to restore a backup (located in the default location). This error appears. Cannot access the specified path of file on the server. Verify that you ...
2
votes
1answer
34 views

Building a ColumnStore index hogs system resources

I am experimenting with the columnstore and I am finding that while it is building the process hogs all the system resources. I have a table with 2.3 billion rows and while I build the columnstore on ...
1
vote
1answer
44 views

MS-SQL: unique constraint case-insensitive

How do I add a case-insensitive constraint without altering the column collation? I've tried CONSTRAINT [AK_User_Username_UserType] UNIQUE (LOWER([Username]) [UserType]) and CREATE UNIQUE INDEX ...
2
votes
1answer
87 views

Get employee names on the basis of Date

I want a dynamic query which will fetch the employee name who has completed successfully 6 months and are ready for confirmation. I have written a hardcode query does that. Here is the query SELECT ...
2
votes
1answer
36 views

Pitfalls of renaming tables in sql server

I've thought of an approach for a process that builds a fairly large table (2million rows), now I'm canvassing opinion for it. What's going to bite me with this renaming approach to a making a table ...
1
vote
0answers
24 views

Count query help needed with unique records [migrated]

I have this following data-structure and I am trying to find unique ID where value Alphabets value Equals to A and B (i.e. select ID = 1, but not ID = 3 or 5). and also find unique ID where value ...
-1
votes
2answers
27 views

SQL: Find row number with column entry of a specific string [closed]

I'm have an MS SQL Server 2014 Express database which I can search using a PHP script on my server to find if a string exists in the database. My SQL code is: IF EXISTS (SELECT * FROM TABLE WHERE ...
1
vote
2answers
48 views

SQL Server : trigger FOR DELETE

I want to create a trigger, which does not delete a customer if his name is Peter. How can I do that? CREATE TRIGGER trgCUSTOMER ON customer FOR DELETE AS BEGIN IF (SELECT name FROM deleted) not ...
2
votes
2answers
26 views

Replication with two publishers [duplicate]

I have three servers with own databases, and database schemas are same. Let's call them servers A, B and C. All three servers will be operational, which means that all three servers will serve for ...
2
votes
1answer
46 views

Is there any way to reduce/shrink tempdb.mdf size without restarting SQL Server

Is it necessary to restart SQL Server after DBCC SHRINKFILE on tempdb.mdf or is there any other method to reduce the size of tempdb.mdf without restarting SQL Server? Kindly help as I need this for a ...
0
votes
0answers
32 views

SQL Server 2012/SSIS - How to Import Partitioned Table Data to Reporting DB?

What's a recommended SSIS process flow for importing a daily partitioned table to a reporting DB table (SQL Server 2012)? Will be switching partitions on main DB to a staging table each day and ...
1
vote
2answers
72 views

Group by month and year given yyyy-mm-dd as a date

I have a list of incidents and dates along with them, yyyy-mm-dd then a category. I need to order by the category (speeding tickets, DUIs, etc...) for each month in a year. This is what the two ...
4
votes
2answers
380 views

What happens if a client connection is killed while holding a lock?

What happens if a client establishes a transaction, locks a row or table, and the client process crashes before it has a chance to rollback or commit the transaction? What, if anything, does SQL ...
2
votes
3answers
65 views

Excessive amount of data received from server

We are having a problem with slow queries on a certain table. We tried some things with indexes but that didn't make any difference. Then we discovered that the amount of data being transferred was ...
0
votes
0answers
4 views

Recommendation: Beginner needs to Regularly Post SQL Code for Troubleshooting. Where to? [migrated]

I am doing an internship that requires me to learn how to use SQL within SAS to run queries. Since I have little experience, I will need to frequently post code in order to check it for efficiency as ...
1
vote
1answer
46 views

How to change default security on SQL Server database so that everyone can use it?

I have a database hosted on my machine that I want co-workers to be able to access and edit through a program I created. My current connection string is: ...
5
votes
2answers
57 views

Predicate not resulting in expected scan

So I have this query that I'm trying to tune and am running into an issue that I'm having trouble understanding. First of this is the query I'm using. SELECT si.LoanNbr AS [LoanNumber], ...
0
votes
0answers
27 views

Can I simulate a sequence in pre-2012 SQL Server, with separate identity column, in function style?

A database on SQL Server 2005/2008/R2 is currently using an identity column in a separate table as primary key source. The reason is that the application, with NHibernate as ORM, needs to know the PK ...
1
vote
1answer
34 views

Statistics needs to be captured for query analysis

What statistics are required to theoretically prove that X query work better than Y query. As per my knowledge I need to look for: Query elapsed time Logical read Logical write Physical read ...
1
vote
0answers
23 views

Does SQL Server 2012 Standard Edition have an option for select a window over time range?

As an example, in StackOverflow they answer the question Finding a count of rows in an arbitrary date range using Oracle. One of the queries is very similar to what I need, but in reverse, I need ...
2
votes
0answers
24 views

SSIS ASCII requirement: “Code page is 1252 and is required to be 20127”

I have a requirement to export a database to a tab-delimited file in the ASCII format. I am using derived columns to convert any Unicode strings to non-Unicode strings. For example, a former Unicode ...
2
votes
2answers
42 views

Query Row Count for All Tables

I need help creating an MSSQL query to pass in every table name to the query below, which returns the number of rows. This is how I get the row count for a single table: SELECT Total_Rows = ...
4
votes
0answers
84 views

Why is my Azure SQL Server so slow?

We currently have a VM that is very underpowered and are proposing to move to an Azure VM with better specs. The problem is, the Azure VM is much slower than the original VM even though it is of a ...
4
votes
1answer
56 views

Reporting Service 2014 Service Pack 1 Failing to work with error - wrong database version

Tonight we upgraded our SQL Server 2012 (SP2+CU6) cluster with SQL Server 2014 Service Pack 1. On that cluster nodes, we have Native mode Reporting Services scale-out configuration. After in-place ...
2
votes
1answer
45 views

How to use a view to span two tables that are identical

We have table A that receives data from our shop floor and we currently have it so that the data is moved from table A to table B after 5 years. I want to streamline this but need help creating a ...
2
votes
0answers
61 views

Weekly SQL database backup failing

I have a weekly SQL database backup job that is failing. If I look at the end of the history of the job, I see the following messages: Executing query "USE [msdb] ".: 2% complete End Progress ...
1
vote
0answers
26 views

SSIS - The value could not be converted because of a potential loss of data, runs fine in BIDS, not on the server

The value could not be converted because of a potential loss of data I'm getting this error when running an SSIS package from a server job. Normally this is some sort of type error, but I can't ...
-2
votes
0answers
10 views

I want to move the listbox one to another listbox and update the particular listbox value [migrated]

Here, Below i used the code. I am new in VBA. I am trying to move the one list box to another listbox, but I am not able to update the database table. I am struggle on few days. Why this error came ...
1
vote
0answers
16 views

BLToolKit save null instead of 0 [migrated]

(Can't use it as tag, but we're Using BLToolkit as ORM) I have this weird problem where BLToolkit saves NULL instead of 0 in our database. If you look the image, this is my values that will be ...
2
votes
4answers
69 views

SQL Server 2008 backup script

I have a lot of SharePoint 2013 databases to backup and if update fail to restore, so I want to automate this operations. ALTER DATABASE [TEST_1] SET OFFLINE WITH ROLLBACK IMMEDIATE GO BACKUP ...
3
votes
1answer
22 views

SQL Server 2012 - How to Remove Partition on Publisher but not Subscriber?

Is it possible to setup partitioning on a SQL Server 2012 publisher table, so that older data can be removed without affecting the same table on a subscriber table? Table exists on Database A (SQL ...
1
vote
1answer
70 views

How do I determine the cause of a very small table responding to queries slowly?

I have a table that stores less than 3 registers, but the queries on it are very slow. This table has only a single Primary Key with 0% fragmentation. > DBCC SHOWCONTIG scanning 'MYTABLE' ...
0
votes
0answers
36 views

Problems with GO keyword [duplicate]

I have a query: DECLARE @str NVARCHAR(max) SET @str = 'SET QUOTED_IDENTIFIER ON' + CHAR(13)+ CHAR(10) + 'GO' + CHAR(13) + CHAR(10) + 'Select 1 from MyTable' PRINT @str EXEC (@str) It returns an ...
2
votes
1answer
27 views

Performing Backup in 2 different ways in parallel?

We wish to perform backup in SQL Server in 2 different ways in parallel. Now currently we have a 3rd party tool that is performing the Backups, Full and transaction log, now the business wants to ...
2
votes
2answers
82 views

SQL Server 2008 R2 Memory Pressure

My SQL Server has a weird problem. It seems it happens with the same matter. It always restarts after running a period of time(about one month long). And I used dbcc memorystatus to check the problem. ...
11
votes
1answer
261 views

Why does referencing a variable in a join predicate force nested loops?

I came across this issue recently and couldn't find any discussion of it online. The query below DECLARE @S VARCHAR(1) = ''; WITH T AS (SELECT name + @S AS name2, * ...
2
votes
2answers
44 views

Restore Error event id 17066 and 3624 while restoring diff backup

I am getting the following error while restoring the Diff back up after restoring the Full backup in Norecovery mode. I am unable use dbcc checkdb as the database in restoring db.Issues happens only ...
0
votes
3answers
54 views

SQL Server: track database changes

I have two very similar database questions related to changes tracking. There are a lot of automation tests for an application, all of them use one database backup. Currently before each test ...
1
vote
1answer
41 views

Intervals query of huge data

My question is more or less theoretical - what is the best approch to get query data by intervals. The situation I have a system that manage counters (thousands of counters - counts consumption of ...
4
votes
1answer
106 views

In SQL Server Mgmt Studio, why don't triggers automatically get updated when tables get renamed?

I ran into an issue last week where we renamed a bunch of tables in a SQL Server and it broke a bunch of triggers. I would have though SQL Server Mgmt Studio would have been smart enough to update ...
2
votes
1answer
40 views

Partitioned Database restore is very slow on SQL Server 2012 with SP2

Team, We have a Partitioned database which is very small in size(112MB backup size). This is partitioned with 15000 files for one table and 7500 files for other table. Currently we are running into ...
0
votes
0answers
25 views

How to Create a Recommended Test Planning in SQL Server

Goal: Make lots of different test for a specific stored procedure named 'sp_test' in order to review if you are retrieving the same data based on data input. Purpose: If you have made lots of ...
9
votes
2answers
100 views

Why isn't the primary (clustered) key being used in this query?

I have a SQL Server 2008 R2 table whose schema structure looks as follows: CREATE TABLE [dbo].[CDSIM_BE] ( [ID] [bigint] NOT NULL, [EquipmentID] [varchar](50) NOT NULL, [SerialNumber] ...
0
votes
1answer
31 views

Moving TempDB data and log files

I had to move tempDB files around. Both data and log file were originally on c:\ drive. I moved the mdf file to E:\ drive and log file to F:\ drive. This was successful and I was able to get SQL ...