Questions tagged [sql-server-2012]

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

Filter by
Sorted by
Tagged with
0
votes
3answers
45 views

MSSQL - Convert overlaping datetime ranges into non-overlapping datetime ranges with respect to priorities

I have data stored in a table like this: CREATE TABLE Records ( [Id] int IDENTITY(1,1) not null ,[From] datetime not null ,[To] datetime not null ,[Priority] int not null ) Every row contains ...
0
votes
0answers
15 views

What precautions should we take when configured log shipping in bulk recovery mode? [closed]

What are pre-qualification should we take when configured log shipping in bulk recovery mode
1
vote
2answers
66 views

Replace specific part of a string

I've got a table with multiple columns, APGRPID, VIRTKEY, LFDNR and PARAMETERLIST. I want to change a part of some strings in the PARAMETERLIST column. In the PARAMETERLIST I want to replace the "...
0
votes
0answers
54 views

Interest calculation after repayment in MS SQL Server query

I have two tables one Loan table and another RePayment table. I want the output like the below table: Below are some queries which I have tried: Interest = Principle * Interest Rate/360* Tenure; ...
0
votes
1answer
32 views

Pivoting 4 by 44 result set

I have a SQL Server query that gets the sales data for a 44 store market chain, it includes 4 values for each store (Sales, COGS, GP and GP Margin), I declared a CTE and joined it 44 times for each ...
0
votes
0answers
10 views

Linked Server to AD reporting error even with max permissions

I've created a linked server pointing our AD to create some reports. the query to retrive the info is this one: SELECT * FROM OpenQuery ( ADSI, 'SELECT mail ,mobile ,telephoneNumber ,...
6
votes
4answers
791 views

Selecting ALL records when condition is met for ALL records only

Sorry if this has been asked before. I couldn't find any examples. I am trying to pull a student's course work for a semester, only if they have received a grade of 'NA' in ALL their courses. Right ...
0
votes
1answer
19 views

Extracting Customers who had transacted in two different merchants [closed]

Am trying to extract list of card holders who had done transactions in two different merchants on the same day. Both the merchant details are available in the same table. Please find enclosed code am ...
-1
votes
1answer
30 views

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

I need an expression for non-boolean type specified in a context where a condition is expected, near 'order'. SELECT Kelas.idkelas AS id_kelas, Matakuliah. Mata kuliah AS ...
3
votes
2answers
73 views

SQL SERVER equivalent for Oracle DBA_USERS

I'm working on conversion of Oracle queries to MSSQL queries. Following is query for Oracle - SELECT USERNAME FROM DBA_USERS WHERE USERNAME = 'TESTUSER'; But in MSSQL, DBA_USERS is invalid object is ...
1
vote
1answer
64 views

Database T-Log is full due to 'Active_transaction'. SQL server is using new T-log file first rather than old

I had a SSIS process which failed due to T-log file Full for the Stage database. T-log file max growth is limited to 510GB however only 180-200 GB of t-log file space is getting used everyday. Even ...
2
votes
3answers
58 views

SQL Server 2012 patching failure - The language of SQL Server instance MSSQLSERVER does not match the language expected by the SQL Server update

I've picked up the support for a SQL Server 2012 instance on a server at our German site and need to apply SQLServer2012SP4-KB4018073-x64-ENU. The patching is failing with the installer showing error ...
0
votes
2answers
67 views

Does SQL Server optimize two “>” operations on same column

Can SQL Server optimize the following: DECLARE @id INT; DECLARE @d1 DATE; SELECT a, b FROM t WHERE id_column = @id AND date_column >= CAST(CURRENT_TIMESTAMP AS DATE) AND date_column >= @d1 ...
0
votes
2answers
56 views

What Is The Best Way To Clone A Database From Production To Development Environment? [closed]

We use SQL Server at our company as DBMS. I have a scheduled job working monthly. The job restores every databases on production server to development server at the end of the month but there is ...
0
votes
1answer
34 views

Setting up encryption on a SQL2012 Database - how to?

I am not really a DBA, but I have a requirement to set up NIST-approved Encryption on some databases. Looking around online, there appears to be a few varieties of Encryption for SQL, but the terms ...
3
votes
2answers
79 views

How can this larger subquery be (much) faster?

In my organisation Ricoh is the supplier of printers and copiers. Papercut is used for registering which copies are made and for which account. Another application working with Ricoh is registering ...
1
vote
1answer
55 views

Want to use pivot and lag function together in SQL

I have the below data in one table. I want to put that data in columns and then have a difference based on the year. +---------+--------+------+-------+ | Product | REGION | YEAR | Sales | +---------+-...
1
vote
1answer
35 views

Audit succesfull logons , loging every 2 seconds

I created an audit to audit only succesfull logons. But the problem is, I did it in a test environment and it's loging a connection every second Did I do something wrong ? I only selected SUCCESFULL ...
0
votes
2answers
32 views

Finding mode in SQL Server

I have the below query which returns me the mode which is the most repeated value in a data set select top 1 TargetPriceRec as mode from PricingRecurring Group By TargetPriceRec order by Count(*) ...
0
votes
3answers
70 views

How to remove sysadmin from sa login in sql server

I have a requirement wherein I need to remove sysadmin server role from sa login. I created 1 more user and gave the sysadmin role to the user. When I uncheck sysadmin from sa login it throws an error....
0
votes
1answer
31 views

Is there a way to trace the DDL and DML activities performed on Microsoft SQL Server manually?

I had C4 audit enabled to log all the activities previously and it mysteriously turned off. So I was looking for a way to trace changes/updates made to the complete database in terms of it's schema ...
4
votes
1answer
97 views

Good practices about Data Encryption

I would like to know (better ideas/best practices...) what can I use to encrypt my data. I've used TDE in the past and I really don't like it. because if something happens with the certificate, and ...
0
votes
2answers
21 views

SQL Server Reporting Server Migration

I have a separate database server and a separate reporting server. I would like to upgrade and migrate the database server to a separate server and do not to touch the reporting server. Since the ...
0
votes
1answer
23 views

SQL native client installation

App team had suggested to reinstall SQL native client for SQL server 2012. My question here is can I download the SQL server native client installation file and just install over the existing native ...
0
votes
0answers
18 views

Yet Another error 10054 after disabling TLS 1.0

We've got: SQL Server 2012 SP4-OD 11.0.7469.6 running on Windows server 2012 R2 Build 9600 with .NET Framework 3.5.30729.4926 installed, while SPN registers perfectly at SQL Server startup. That ...
0
votes
0answers
15 views

Wrong column data types when using dtswizard

I need to copy a database from a MS SQL Server 2017 to a MS SQL Server 2012. I am not sure what's the best way to go, but I'm currently trying to use dtswizard to do the job. Everything seems to be ...
0
votes
3answers
32 views

How to exclude non-distinct rows in a query

I have a table that contains references to clients impacted in a problem. The parent table contains the problem info, specifically the ProblemID (PbMID). Since one problem can affect multiple clients, ...
0
votes
1answer
62 views

OPENROWSET shuting down SQL Server service, but only running on the server

I've never seen such issue. when i'm using SSMS from my own machine, normally conected to the server I want to run the query, I can run openrowset to select from an excel file with no problems: ...
4
votes
2answers
125 views

DIFFs promoted to FULLs

We use Ola Hallengren's DatabaseBackup stored procedure to backup a load of SharePoint databases on a SQL Server 2012 instance into Azure blob storage. We have been doing this for quite a while ...
1
vote
1answer
39 views

Exclude certain results from in condition in sql

I have two tables Table 1 Id data1 data1 1 'ff' 'ffe' 2 'r' '3' 3 'df' 'er' Table 2 Id WFID data1 data2 1 12 'd' 'e' 1 13 '3' '4f' 1 15 'e' 'dd' 2 12 ...
1
vote
1answer
47 views

SSMS Template Browser Add-In development

Okay, I’m trying to do something that I just can’t seem to get accomplished and I haven’t found anything online to address this request. In the “Template Browser” I want to add another category of ...
-2
votes
1answer
49 views

Convert Varchar to Datetime

I have a database field Column_A which is in Varchar(16) not null and the values are for example 20191210215033CS but I want to break it like 2019-12-10 21:50:33 Since it is a production database ...
0
votes
0answers
29 views

A simple question about TDE

I have a question regarding TDE on SQL Server 2017 for example. I created the master key Created the certificate Created the database encryption key ( now the database is encrypted) Backed up the ...
3
votes
4answers
122 views

SQL Server memory

It's regarding the SQL Server memory. When the server is running out of memory, we recommend adding additional memory to the hardware to overcome CPU utilization issues. But before proceeding to the ...
1
vote
1answer
53 views

Troubleshooting slow connection establishment

The client and the server are running on Windows on different subnets. I'm facing a 20s delay to establish a connection to a SQL 2012 Always On availability group using .NET Core Sql client using sql ...
1
vote
1answer
55 views

Assign Failover Cluster and High Availability Always On from Old to New Domain

What are best practices steps when the Windows Server 2016 machine hosting SQL Server and failover cluster (2 node and shared folder witness) is joined to another domain? What steps definitely/might ...
0
votes
0answers
41 views

HADR_SYNCHRONIZING_THROTTLE Waits

We recently migrated a large chunk of our databases to a new data center and on one of our clusters we are now seeing high amounts of waits for HADR_SYNCHRONIZING_THROTTLE. We didn't see this in our ...
0
votes
2answers
23 views

Cannot Find Job Associated Active Email Notifications

We have a email notification going via our SQL Server however I cannot find any job or setting associated with it. Its definitely the correct server and I am logged in as admin. The email is sent via ...
-3
votes
1answer
49 views

Is there a different (better) way to do this? [closed]

I have one parent table(p) with primary key (id) and two child tables (c1, c2) with foreign keys (pid), i want to return all the records including no matches where id = 1. SELECT p.id, c1.data1, c2....
2
votes
1answer
42 views

T-SQL90 vs Transact-Sql

In Sql2012 Management Studio, there are separate options for "T-SQL90" and "Transact-Sql". My .sql files always seem to open in "Transact-Sql". My question is what is a &...
2
votes
1answer
213 views

Why BCP creates such big files?

I'm creating some reports via BCP to be sent via emails. create TABLE ##tempsss ( create TABLE ##JOB_DataAssociacao_verContrato ( F1 VARCHAR(6) ,F2 VARCHAR(200) ...
0
votes
1answer
212 views

Failure sending Excel attachments larger than 1.5MB

I have innumerous reports that I send from SQL Server to people. But for some reason there's this single one, with 10k+ rows, that I can't send via dbmmail. I tried top 7000 and it worked but top 8000 ...
0
votes
1answer
17 views

Getting VLF info with least privileged to run across multiple servers of different version

Per our monitoring scripts i am thinking to add monitor the status of VLF for each database across different SQL servers in our organization: We have mix of servers from 2012 to 2019: I've found a ...
0
votes
2answers
47 views

How to know how healthy an SQL Server database is now?

I want to know how healthy an SQL Server database is now (before I started to work with it). Then, in a month or so, I want to check again to see how healthy database is at that time and compare it to ...
-1
votes
1answer
41 views

Cluster Index Scan 96%

I am seeing this Cluster Index Scan at 96% and I am not sure why that is? In the table I have a clustered index on the PK and a non-clustered on the where condition so should this being using the non-...
0
votes
1answer
28 views

How to List All Permissions for SQL Server Fixed Database and Server Roles

I am trying to list all current permissions for db_owner and sysadmin for SQL Server 2012. I found these SPs: EXEC sp_srvrolepermission 'securityadmin' EXEC sp_dbfixedrolepermission 'db_owner' ...
4
votes
1answer
106 views

Suddenly SQL server restarted with pending task count increased

We are trying to understand the issue where SQL server was suddenly restarted on its own- Its a SQL server 2012 SP4 -GDR applied with 40 CPu's HT enabled , thus total of 80 logical processors- MAXDOP=...
0
votes
1answer
41 views

SQL Server 2017 Always-ON

I have configured Distributed AG from DC1 to DC2 (SQL 2017 Ent edition with CU22 version) DC1- DB1, DB2 and DC2-DB3, DB4 I have restarted DC1-DB1 SQL services, after restart DC1-DB2 should be primary....
0
votes
1answer
36 views

Is it possible to put mdf and ldf to NAS (Synology)

I'm planning to purchase NAS (synology) for personal use. I'm working also as developer, it is possible to put my test database (SQL server data and log) to NAS? This just for personal and for ...
1
vote
2answers
44 views

How to update group no incremental by 1 based on every group from 1 to 3?

I work on SQL server 2012 I face issue i can't update group no to every steps from 1 to 3 meaning i need every group from 1 to 3 take identity number incremental by 1 as 1,2,3 etc .. create table #...

1
2 3 4 5
89