SQL Server 2012 (major build version 11.00.xxxx). Please also tag sql-server.

learn more… | top users | synonyms (3)

0
votes
0answers
2 views

Permissions for Cluster service account in SQL server

Recently i faced an issue where the SQL server 2012 being hosted in a 2 node failover cluster failed to start. And since the cluster and windows event log didn't help much, i started checking the SQL ...
0
votes
1answer
34 views

Database design considerations for unused columns with every table has same schema

I am a web developer so I don't know a lot about databases. The company I joined recently has a very mature Desktop ERP built in .NET and SQL Server, they are providing services to huge corporate ...
0
votes
0answers
11 views

Issue with Linked Server query

I have a job which fetches data from an Oracle 12c database and inserts into a SQL Server 2012 database, via a linked server from the SQL side. It's a simple Select * statement and just pulls in any ...
1
vote
2answers
32 views

Execute stored procedure remotely using linked server

We have 3 SQL Server 2012 instances, 2 of them we're not db_owner. Some of our stored procedures use DMV and sys views and stored procedures that only work when executed locally. I'd like to ...
1
vote
2answers
168 views

Get first and last record for each date and calculate their difference

I need to calculate the DATEDIFF in seconds between the First record for each date with EventCode = 1 and the last record for each date with EventCode = 2. I have posted a sample data set for 2 days ...
0
votes
0answers
21 views

Finding records only when all ids present in a group

Having these two tables id | val TableA -------- 1 | A 2 | B 3 | A 4 | B 5 | A 6 | C 7 | D id_A | data TableB ----------- 1 | a 2 | b 3 | c 5 | d 7 | e First I ...
0
votes
1answer
40 views

Update empty values with null

I create a Job that runs the query below for all databases in a server in order to update empty values with null in all columns for all tables. The problem I'm facing is this query literally killed ...
2
votes
2answers
19 views

Concurrent backups (full and transaction) and testing recovery model

My intent is to test my recovery model and setup log shipping to replicate a database on another server. I have a database called AdventureWorks on a primary sql server. Presently SQL Backup performs ...
1
vote
0answers
59 views

Logical read when use Offset in SQL

When I execute this script SET STATISTICS IO ON SELECT *, ROW_NUMBER() OVER (ORDER BY [Date] DESC) AS [ROW_NO] FROM vwTblTest WHERE ([Factor] >= 139501 AND [Factor] < ...
1
vote
1answer
49 views

Matching empty string is not working

I have the following query SELECT Ice.IceId, Ice.Code, Box.Ice, LEN(Box.Ice) AS IceCharLength, DATALENGTH(Box.Ice) AS DataLength, Box.Ice, ASCII(Box.Ice) AS ASCII, CAST(Box.ice AS ...
0
votes
0answers
17 views

Querying Table from another Database using Synonyms

I have two databases(A,B). on database "A" i created synonyms CREATE SYNONYM [dbo].[Names] FOR [server1].[B].[dbo].[Names] I should now be able to query the table "Names" from within database "A" ...
-1
votes
1answer
36 views

How can i restrict remote login in SQL Server 2012 Express using management policies [closed]

Does anyone know method to restrict remote login using management policies.
0
votes
0answers
9 views

Multi Purpose Witness/Master Data Services SQL Server

I currently have a Master Data Services SQL Server instance that I use to execute SSIS packages, moving and consolidating data from a few OLTP servers to a Data Warehouse. It currently just runs its ...
3
votes
0answers
35 views

Concurrent Merge Issues

A (simplified) model of my application has several processes dumping data into the table below: CREATE TABLE [dbo].[InputData] ( [InputId] [int] NOT NULL, [Dts] [datetime] NOT NULL, [...
0
votes
1answer
29 views

Select 1 Row Per Day For Each Database

I have a table with over 60 million rows. Snapshots taken at multiple times a day for all databases across all instances. I am trying to reduce the rows in my select by only returning 1 snapshot per ...
3
votes
2answers
33 views

ALTER TABLE SWITCH

I have two columns that I want to convert from computed to non computed. I have the code for that. However, it was suggested to me to use the ALTER TABLE SWITCH. I believe the individual who ...
0
votes
2answers
83 views

Tiny query used to be sub-second speed, now takes 60+ seconds

Ok, I've got a monitoring process that runs the following query to make sure the databases are backing up regularly. This process used to take 1-2 seconds for connection, query execution, and ...
0
votes
0answers
7 views

How to move SSAS tabular instance databases?

We have a SQL Server 2012 SSAS tabular instance in our environment that is sitting in domain1. We need to move these SSAS databases in a different SQL server 2012 that is on domain2 which has no trust ...
1
vote
2answers
60 views

SQL Server 2012 database in suspect mode after upgrade from Developer to Standard Edition

SQL Server database is in suspect mode after an upgrade from developer to standard edition 2012 version. In the log file there are two errors: 933 and error 905. Following error occurred when we tried ...
0
votes
0answers
23 views

SQL Server 2012 sp3 error and SNAC

It is a client server with only the Management Tools basic/complete and Client Tools connectivity. While it appears that some the of SP3 took based on items in the Add/Remove Programs having a .6020 ...
0
votes
0answers
78 views

SQL query runs fast on local computers but slow on production server

I am running a fairly basic query on my local development machine which runs almost instantly. However on the server its taking around 3-4 seconds to return results. I have ran Client Statistics on ...
1
vote
1answer
33 views

First and last records in a string of linked rows

I have been handed an (ancient) database in SQLServer format containing rental records. These records can be modified by the customer while the rental is still in flight, if they want the drill for ...
0
votes
1answer
25 views

Call to sysmail_delete_mailitems_sp keeps deadlocking

I run SQL Server 2012. I have a maintenance job that runs every night. At the end of the maintenance, I do some cleanup and call this: Begin try Exec msdb.dbo.sysmail_delete_log_sp @logged_before = '...
1
vote
2answers
31 views

Maximum Attachment Size in database mail

Good Afternoon, I am trying to send an attachment via database mail. declare @mail_recipients VARCHAR(4000) = 'abc@123.com' , @mail_subject VARCHAR(500) = 'subject' , ...
3
votes
1answer
33 views

how to change the file directory of your log and data files and what are the effects

I have inherited a SQL server 2012 instance where the file directories of the log and data files are on the same folder on the same drive(all are in the C:\ drive). My task that I will be doing is ...
0
votes
0answers
35 views

What is the VERSIONING_COMMITTING wait type in SQL Server 2012?

I have a fairly large SQL Server 2012 database in an availability group that experienced performance problems for about an hour, with the bulk of the wait in HADR_SYNC_COMMIT (waiting for synchronous ...
0
votes
2answers
51 views

How do I script SQL Server 2012 replication to turn it off during a deployment and then turn it back on after the deployment?

The scenario that I'm in is: We have a database that is replicated but its objects (tables, etc.) are updated via Entity Framework. Whenever a schema change is made to the database by the SEs, we ...
0
votes
0answers
33 views

Help on Database Table Design

I am trying to create a website with multiple Q&A. The main features I need to support are as below There will be multiple types of questions. (a. Single option Answers, b.MultiOption, c. True ...
0
votes
1answer
27 views

sql server 2012 developers edition license and 3rd party applications [closed]

Our company is using an ERP system for our product inventory management and customers orders. The newest version uses MS SQL 2012. if we are not developing software and the only users accessing the MS ...
0
votes
1answer
39 views

Better way of re-arranging the indexes for better performance

I ran a script to find overlapped and duplicate indexes for a database. Below is the sample screen for the above said. Please advise how can I arrange them or what should be the guidelines to make ...
0
votes
0answers
28 views

Query runs 10 times slower on one node compared to another using the same database

I have got an AlwaysOn database on two nodes and have discovered that the same query takes less than half a second to run on one node but around 7 seconds on the other one. It doesn’t matter whether ...
3
votes
1answer
115 views

SQL, SQLCLR objects & effective memory utilization

We've recently converted our ERP system from IBM Universe to SQL Server. Application performance is generally tolerable but occasionally degrades to terrible. We're running the database on Win ...
1
vote
1answer
59 views

BCP utility:“Copy direction must be either 'in', 'out' or 'format'”

I moved a SQL Agent job from a SQL Server 2008 R2 instance to a 2016 instance. The job called a PowerShell script which in turn called bcp.exe. After moving the job, I receive this error: Copy ...
0
votes
0answers
14 views

Regenerate a data model in report builder

Is there any way to automatically regenerate a data model in report builder? I am using SQL server 2012 and Visual studio 2013. Please help.
0
votes
1answer
20 views

Create a view showing total minutes per customer per month and change from previous month

I have an existing database (SQL Server 2012, on premise installation) and need to add a column to a view which gets displayed via a Crystal Report. The issue I am having is with restricting the ...
0
votes
0answers
94 views

Cannot Update a System Collection Set

I'm trying to tweak the "Server Activity" Data Collection set as outlined in this blog post (I wrote the post, btw. Sorry--it's kinda long). It is working in SQL 2008 R2 and also in SQL 2014. However,...
1
vote
0answers
28 views

Error when trying to install SQL Server 2012 Ent in to a Server Core 2008 VM

I have a problem that I hope you can help with. I am studying for my 70-462 exam and in order to do so, must setup virtual labs as follows. DC: Windows Server 2008 R2 Enterprise (Full Installation) ...
1
vote
1answer
42 views

TSQL 2012 deleted table in INSTEAD OF and AFTER triggers?

My colleague ask me very simple, but difficult for me question: If I have deleted table with 10 records in INSTEAD OF trigger and I delete 8 of them how many records will I have in deleted table in ...
0
votes
2answers
22 views

Read CSV and perform SQL in SQL Server Management Studio

Is it possible in SQL Server Management Studio to read a CSV and perform an SQL update per line? Example data.csv "column1","column2,"column3" "column1","column2,"column3" "column1","column2,"...
1
vote
2answers
56 views

SQL Server - How to grant SELECT permission on View that access data in schemas from differents owners?

I need help to deal with a problem about permissions in my database. This is the scenario: 1 Database 4 Schemas: schemaA; owner dbo schemaB; owner ownerX schemaC; owner ownerX schemaD; owner ...
2
votes
2answers
30 views

SQL Server agent job dependency

We have a 4h datawarehouse job that runs every 4h on 4h schedule. We want to create a new 'daily' schedule and have some processes run out of hours. However, if when the daily job comes to run and ...
1
vote
0answers
39 views

SQL Server 2012 AvailabilityGroups - Preferred Backup Replica

I currently have a 2 node SQL Server 2012 HA Availability Group setup. Currently we have a number of SharePoint databases that exist in this availability group. I'm attempting to ensure our backups ...
0
votes
0answers
44 views

Simplifying this NULL check [duplicate]

Is there a way to simplify this check? I would like to compare if two columns are equal and that includes if one is NULL and the other has a value (which would mean they're considered different). (A.[...
3
votes
1answer
39 views

How to migrate windows login in from one sql server to another sql server on another domain

We have a SQL server that is located in domain 1(DMN1). We are migrating databases in domain 1 to our new SQL Server in domain 2(DMN2).Corporate states that there will be no trust established between ...
1
vote
0answers
38 views

SQL Server 2012 failover cluster node won't start cluster services

We have 2 node SQL server failover cluster setup in our environment. Node2 SQL server machine got shut down. I turned it back on and connect back to the failover cluster. It successfuly connected ...
1
vote
1answer
31 views

Create an XML Schema collection in SQL Server 2012?

I want to create an XML schema collection to validate some XML in a column for the following XML: DECLARE @xml as xml SET @xml=' <R C="firstName" O="" N="Fred" /> <R C="lastName" O="" N=...
1
vote
1answer
56 views

Update all tables containing column name

In SQL Server, I can find all tables containing a COLUMN_NAME: SELECT * FROM INFORMATION_SCHEMA.columns WHERE COLUMN_NAME = 'COLUMN_NAME' How can I update all of these columns like: UPDATE <...
3
votes
1answer
47 views

How to Load Balance Availability Group

I have 2 Servers under SQL Server Cluster (Server 1, Server 2) 2 Databases configured with Availability Group (Database 1, Database 2) Server 1: Database 1 PRIMARY REPLICA Database 2 PRIMARY ...
0
votes
0answers
32 views

How to minimize locking / maximize update throughput on small table

I have problem on SQL Server. I have a very, very small table which has a very high update frequency. CREATE TABLE [dbo].[counters]( [id] [int] NOT NULL, [val] [bigint] NOT NULL) Table has ...
1
vote
1answer
88 views

Why am I seeing OPTION (MAXDOP 1) in my Actual query plan even though I've not set it in the stored proc?

SQL Server is set with MAXDOP 0 by default. In the stored procedure I'm testing I keep seeing WITH (MAXDOP 1) in the Actual Execution Plans even though I've not specified any hints other than ...