All versions of Microsoft SQL Server (not MySQL). Please also add a version-specific tag like sql-server-2016 if that is relevant to the question.

learn more… | top users | synonyms (2)

0
votes
1answer
40 views

Is it possible to have a deadlock in this situation

I am working with SqlServer and Java. I have the following (pseudo) code : begin transaction For each item of a list select the row in db ... update the row End for end transaction ...
1
vote
1answer
563 views

Selecting rows from same name table from multiple databases in single result set

For some reason, I have a table Table_1 in n databases (same name and schema structure) instead of one single databases. The columns are like this: | Column_1 | Column_2 | I can select data from ...
7
votes
1answer
527 views

Merge row size overflow in SQL Server - “Cannot create a row of size..”

The target table to which I'm trying to merge the data has ~660 columns. The code for the merge: MERGE TBL_BM_HSD_SUBJECT_AN_1 AS targetTable USING ( SELECT * FROM ...
1
vote
0answers
142 views

Trigger failing when called using sp_executesql

We have a recursive trigger on a table that executes AFTER INSERT. There is a check to ensure the trigger does not recurse more than 32 levels deep: IF(SELECT TRIGGER_NESTLEVEL()) >= 31 ...
18
votes
5answers
1k views

In Sql Server, is there a way to check if a selected group of rows are locked or not?

We are attempting to update/delete a large number of records in a multi-billion row table. Since this is a popular table, there is a lot of activity in different sections of this table. Any large ...
1
vote
2answers
1k views

Global Temporary Table used in Stored Procedure executed concurrently across sessions

I use dynamic SQL in a stored procedure and must use a global temp table so the temp table and its data is available outside the instance when sp_executesql happens. I need the stored procedure to be ...
1
vote
1answer
407 views

In Sql Server what is the difference between VAS and Buffer Pool?

My understanding: In Sql Server, Buffer Pool is where all the Data/Proc/Log Cache, etc are located. Virtual Address Space is a logical location that refers to physical locations (either in RAM or ...
0
votes
2answers
43 views

Insert data into table where 4 fields are the same and the fifth changes

I have a table with this structure: username varchar(35) startdate datetime enddate datetime saledate datetime packageid int for each username there are 5 packages, so one username has 5 records ...
-1
votes
1answer
38 views

Can I connect to default instance with computername\instanceid?

I create default instance on SQL Server 2012 Standard. When I set it up, I changed instance id from 'mssqlserver', which is a default value, to 'new_instance_id'. For some reason I want to connect ...
0
votes
1answer
152 views

Replication Configuration

I had a SQL Server 2008 Express edition as a Default instance and I am having SQL Server 2012 Evolution and SQL Server 2014 Evolution are my named instances. When I was trying to configure ...
2
votes
2answers
599 views

Slow Performance caused by Correlated Sub-queries & Clustered Index Seek

I'm running a query in which one of the tables (FIELDDATA) has nearly 400,000 records which is taking more than 2 minutes to execute. I ran the execution plan, and noticed that the clustered seek ...
2
votes
2answers
369 views

SQL-Server login-error of SQL-Server Agent Account

I have to manage a configured SQL-Server version 2005 and have setup Database Mail successfully - test mail works. Also I've changed the agent service to a domain user with (currently) domain admin ...
0
votes
0answers
51 views

Trigger copies history table: Will removing index lock options speed up the process?

I have a trigger applied to a table to write inserts and updates to a history table. That history table can grow pretty fast, and we want to see, if we can speed up insert operation a bit. The values ...
2
votes
0answers
46 views

Code required to make column not nullable

I have a table where I mistakenly allowed NULL values in a column: CREATE TABLE EXAMPLE ( EXAMPLE_ID INT IDENTITY(1, 1) NOT NULL, FOO_ID INT, CREATED_ON DATETIME DEFAULT ...
4
votes
1answer
362 views

Sudden poor SELECT performance on a large table with existing indexes

My company uses a software suite in which the only thing I can truly modify is the database. We've always had performance issues (mostly hardware problems that we hope to resolve soon), but lately ...
3
votes
1answer
184 views

Determine which trace flags are set as a startup parameter vs. enabled globally?

Probably a quick question. We are looking to test out a couple trace flags as startup parameters in our environment, and while I know we can use DBCC TRACESTATUS to get global-scoped trace flags, it ...
0
votes
1answer
47 views

Usage of ExecSQL in UDF?

Problem: is it possible to use sp_executesql or EXEC inside of a user defined function? Thanks!
0
votes
0answers
29 views

How to Customized the Where Statement based on UDT

Goal: Display customized data based on customized where statement from UDT. The UDT is a parameter inside of a stored procedure. Problem: A parameter from a stored procedure is @communication ...
0
votes
2answers
129 views

SQL Server 2008 R2 - Memory Allocation

We have a SQL Server 2008 R2 instance that is running on a Windows Server 2008 R2 Enterprise server that has been allocated 128GB of memory. However, it maxes out at 70GB. Can anyone tell me how I can ...
2
votes
2answers
253 views

migrate db's - best way to mirror or replicate a full database

I would like to mirror/replicate my databases to the cloud. The cloud is setup using VPN to my actual machine. I am a bit confused by the options I have and would like to get some light into it. My ...
1
vote
2answers
456 views

How to create a dummy Linked Server in SQL Server 2012

I have a database in two different production servers. I want to keep the schemas consistent between the two. One has jobs that call stored procedures that reference a Linked Server. The other does ...
4
votes
2answers
369 views

Shared connection pool in SQL Server and prevention of cross-database queries

Microsoft recommends that a shared connection pool should be used when running e.g. a SaaS software with one database per customer but with a shared codebase to prevent pool fragmentation: ...
0
votes
2answers
249 views

xml parameter to distributed query - difference between SQL2005 & SQL2012

I have inherited an old SQL2005 Enterprise database (on Windows 2003) that allows an xml parameter to a distributed query such as this: exec sp_executesql 'exec [server].[database].dbo.sproc ...
2
votes
2answers
401 views

Mixed SQL Server instances with static and dynamic ports

Let's assume someone has 5 different SQL Server instances running on a server. Initially all are using dynamic ports. Is it safe to restrict one of those instances to use the static port 1433 while ...
0
votes
1answer
687 views

SSRS email Subscription Not Working but local smtp is working

SQL SERVER EDITION- 2008 ENTERPRISE EVALUATION EDITION Operating System- Window Server 2008 R2 I've Created Local Smtp to use gmail id for Subscription of SSRS Report by Email as we don't have an ...
0
votes
2answers
371 views

Unable to delete Log Shipping configuration

I need some help with my SQL 2005 server. I am trying to setup log shipping, I've successfully done so for all user-databases, except one. From the looks of it, it once had log shipping configured ...
1
vote
1answer
64 views

Migration from SQL Server 2012 Ent to SQL Server 2014 STD

We recently migrated from a traditional hosting environment with a back end of SQL Server 2012 ENT to an Azure VM running SQL Server 2014 STD. We did all the cool stuff with BPEs on SSD, etc. The ...
0
votes
0answers
112 views

Why does a table take more space in SQL server than in Teradata? [closed]

Is there any reason for a table to occupy significantly more space in SQL server than Teradata? The rows and data structure (columns, data types, data type length) are same, no extra objects like ...
0
votes
0answers
92 views

MSSQL Query table returned all rows but keep executing for long time

After database migration to a new server, my web application got many timeouts on particular table, I suspect there is some problem with the table. When I simply try a small table (of 3 thousand ...
-2
votes
1answer
60 views

Usage of COALESCE? [closed]

Today: table abc a b c d ---- ---- ---- ---- 1 null 2 3 null null null 7 null 5 null 4 1 = e 7 = b 5 = f 3 = i 2 = w 4 = o The Goal is to retrieve this ...
2
votes
1answer
134 views

CheckDB error 9003 SQL server 2014

Currently I am restoring SAN snapshots to another server nightly and running weekly checkdbs on that test server. The checkdb is throwing the following errors. The log scan number (105217:402:0) ...
3
votes
2answers
140 views

Unable to restore database backup because it is accessed by other connection

--first command use master Go -- second command ALTER DATABASE MyDB SET SINGLE_USER WITH ROLLBACK IMMEDIATE Go -- Third command RESTORE DATABASE [MyDB] FROM DISK = ...
0
votes
1answer
59 views

SQL Server Express 2008 R2 Configuration Manager How To Find It

I run Windows 8.1. I installed SQL Express 2008 R2 over a year ago, but now need to access it from another machine. My problem is that the Configuration Manager (SQLServerManage10.msc) is not on my ...
3
votes
2answers
152 views

What is the recommended method to move databases?

I want to know the recommended method to move a database and data from dev to pre-prod to production in SQL Server. The databases are originally created in MS Access so some upsizing to SQL Server ...
1
vote
1answer
95 views

backup to NAS using sqlcmd

I've been searching for possible duplicates before asking but can't find anything. The closest was Backup SQL Server To Nas but not exactly my case. We have a brand new Synology NAS configured, due ...
2
votes
1answer
196 views

Is worth change databases collation from Latin1_General to Modern spanish, migrating to a new server

We are migrating 3 databases tables from Sql Server 2000 to a new sqlserver 2014. I know that for new databases the recommended Collation for spanish is Modern_Spanish. But what is the recommendation ...
16
votes
1answer
2k views

Why 0 is equal to empty string?

I need some help in finding why the following T-SQL statement returns 1 (true): SELECT IIF( 0 = '', 1, 0) I guess someone has change an ANSI option like SET ANSI_NULLS or something else that is ...
1
vote
1answer
92 views

AlwaysOn Listener and DNS

We have two DNS servers which replicate entried between them and we recently had a DNS issue where some of the listener addresses were removed from one of the servers only. At that point some of our ...
1
vote
2answers
89 views

Restore a newer filegroup backup

So this is my set up. In our data warehouse we have mostly tables that are filled with data from a ETL-process. We do not take backup of these tables since we have an option to do a full reset using ...
0
votes
1answer
90 views

Need to migrate a SQL Server 6.5 Prod to SQL Server 2012 in VM

We are planning to move our SQL Server shop to VM(VMware). We still have one SQL Server 6.5 in production. What would be my course of action/path to move/migrate 6.5 to virtualized SS 2012? It's the ...
0
votes
0answers
120 views

Insert Unique Records into Linked Server Table (from SQL to Oracle)

My issue is that I am trying to load only unique primary key records into oracle from sql. In the insert into stored proc statement I tried doing it by where primary key does not equal primary key ...
0
votes
2answers
55 views

Database Engine vs. Database location

I'm a new user of SQL Server 2008 R2. We work in a Windows domain environment and I have access to multiple servers - by this I mean I have various drives mapped to various servers. I have SQL ...
0
votes
0answers
151 views

Timeout too long on SQL Server 2012 Linked Server to MySQL

We have a statement in a SQL Server 2012 stored procedure that is an INSERT into a temp table from SELECT using OpenQuery to pull data through a Linked Server from a remotely hosted MySQL database. ...
0
votes
0answers
151 views

MSSQL - GRANT EXECUTE permission inside stored procedure

Environment SQL Server 2012 (11.0.2100.60) Situation user is allowed to execute a number of stored procedure; user is readonly denywrite one of stored procedure has an EXECUTE statement; The ...
13
votes
1answer
310 views

SQL Server recreating plans each day

We have this problem in our production environment. Microsoft SQL Server 2008 R2 (SP1) - 10.50.2500.0 (X64) - Enterprise Edition (64-bit) on Windows NT 6.1 (Build 7601: Service Pack 1). SQL Server ...
1
vote
2answers
242 views

Send CSV file with db_sendmail

I am trying to send a csv file with 15000 records via the database mail in SQL Server 2014. The problem is that when I open my email the csv only contains 209 records. I have tried the same thing in ...
0
votes
1answer
84 views

Best way to remap database login to new database user and keep previous database user

Here's what my environment looks like: Active Directory (mydomain.local) - Groups - group01 - Members - aduser01 SQL Instance - Logins - mydomain\group01 - ...
0
votes
0answers
69 views

Steps to stop and start SQL Mirror server instance in Amazon EC2

I have to stop and start the SQL server instance running on AWS. What are the steps that needs to be followed to get the Mirror server working again. Would the steps described here Should I pause ...
1
vote
3answers
151 views

Load specific element from XML

I have the following xml: <root> <123 type="line"> <aa type="item"> <value>1</value> </aa> </123> <234 type="line"> <bb type="item"> ...
-1
votes
3answers
864 views

Pasting data from Excel table takes very long [closed]

I use SQL Server Management Studio 2012 to import data from Excel sheet to a table on SQL Server. I use the most straightforward way that I just Ctrl+C a table in Excel and Ctrl+V in table edit window ...