Questions tagged [sql-server-2012]
SQL Server 2012 (major build version 11.00.xxxx). Please also tag sql-server.
4,431
questions
1
vote
3answers
60 views
Shrinking data file to save disk space before migration
I know this is most discussed answered on various forums: I completely understand answer is no in most of the time or cases.
However want to know if it can be good approach under any scenario:
Lets ...
5
votes
3answers
891 views
Size Requirement of SQL Database
I have been asked this question in an interview that how much would be the DB size for a standalone SQL server if 650MB of data is processed every month. I couldn't give any answer to this question in ...
0
votes
1answer
30 views
Create a trigger to fill a field according to acondition in sql
I want to create a trigger to fill a field according to acondition as below description
For example:
I have a table for all insps that have attachments named: “inspectionAttachments” and I have ...
0
votes
1answer
21 views
hide instance not working
We do not appear (yes/No) for hide instance in SSCM for all SQL Server 2012 servers.
We are unable to see (yes/No) option for hide instance . Kindly assist me here .
Thanks a lot !
0
votes
0answers
31 views
Get actual Job Name of the running SSIS package from Program Name column of the results while running sp_whoisactive or sp_who2
When I run sp_whoisactive or sp_who2 and if there is a SSIS Package running it would always display in the Program Name as the name of the running SSIS Package like SSIS-Package-{063BC46B-1F74-4207-...
1
vote
3answers
50 views
Get actual Job Name from Program Name column of the results while running sp_whoisactive or sp_who2
I am running sp_whoisactive on my Prod and offload the data for analysis.
When I run sp_whoisactive or sp_who2 and if there is any SQL Agent Jobs running it would always display the Program Name like ...
2
votes
2answers
386 views
is it safe to compress backups for databases with TDE enabled?
I've been reading about this for a long time, and it seems it's not safe to compress a backup when the database has TDE enabled.
is anyone experiencing errors during restore with compressed backups ...
0
votes
1answer
64 views
Cannot fetch a row from OLE DB provider “SQLNCLI11” for linked server
I have two SQL Servers on two different machines somewhere in the cloud (maybe Azure).
One is Microsoft SQL Server 2012 (SP3-CU10) (KB4025925) - 11.0.6607.3 (X64)
Jul 8 2017 16:43:40
Copyright (c) ...
0
votes
1answer
14 views
how to display running count of records in query
I am working on SQL SERVER 2012, and I have been trying to figure out how to include a running count of records in a group by statement. For example, the query would look something like:
SELECT ...
-1
votes
1answer
31 views
I can't identify what is happening in this table with a PDF on it [closed]
I have a table with this config:
Now if you look at COLUMN_11, it is a varchar -1.
But as far as I know, to insert a PDF file into a table, you need filestream, and the column should be VARBINARY(max)...
0
votes
0answers
10 views
SQL SERVER symmetric keys convert from varbinary to hex
Hi currently I setup symmetric key on SQL Server 2012
-- Create the certificate which will be used to encrypt the symmetric key
CREATE CERTIFICATE ENC_CC_KEY
WITH SUBJECT = 'Certificate Used to ...
2
votes
0answers
32 views
MSSQL 2012 SP4 11.0.7493 periodically unresponsive until cluster failed over
I have a production MSSQL 2012 Standard SP4 (11.0.7493) database that periodically (non-deterministically, but anywhere from every few days to every few weeks) becomes unresponsive to queries made by ...
0
votes
1answer
18 views
Setting up SQL server multiple Names but within the same Database
Can we create different SQL Name (so will not change the previous connection strings) in a single SQL Server with the same content of the Database and log-in credentials?
2
votes
2answers
40 views
Can I change MSSQL interpretation of date order system wide?
I use Laravel with PHP from https://laravel.com/
MSSQL is a driver and works perfectly - with th exception of dates.
For some reason the project has decided that the follwoing is a universal date ...
1
vote
2answers
67 views
Query Cost when filtering with varchar vs nvarchar
Recently the application I'm working on encountered performance issue on a particular table. When I check the queries executing on this table, I noticed a warning about CONVERT_IMPLICIT on the ...
1
vote
1answer
31 views
One-directional database replication without delete on target database?
I have two databases: A small one where data is permanently added and a big one where the data is copied from the small one and is supposed to be stored long term. The small database deletes old data ...
1
vote
1answer
32 views
SQL Native Client Upgrade
Application server for CRM has SQL native client 2008 version installed. I have installed SQL native client 2012 side by side as need to connect to an sql availability group listener. How do I get the ...
0
votes
1answer
37 views
How to create a mapping table?
I have 2 tables as below
CITY_A
ID
CODE
CITY
001
90
PARIS
002
90
PARIS
003
85
PARIS
004
60
SYDNEY
005
75
SYDNEY
006
75
SYDNEY
CITY_B
ID
CODE
CITY
001
IN
PA
002
OUT
PA
003
OUT
PA
004
IN
...
0
votes
1answer
37 views
Querying AD from SQL Server
I've read tons of questions and answers about my error but none of them helped me ( from PINAL website, microsoft links and everything ). questions from 9 years ago to today.
I created a Linked server ...
0
votes
0answers
27 views
sql publication / subscription 2008r2=>2012 Could not locate text information
I have replitation setup from sql 2008r2 publication to 2012 subscriber
it was working fine and after 4h i faced error:
Error messages:
The process could not execute 'sp_replcmds' on 'PB01\PROD'. (...
0
votes
3answers
68 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 ...
1
vote
2answers
78 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
66 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
23 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
818 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 ...
-1
votes
1answer
48 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
84 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 ...
0
votes
1answer
77 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 ...
1
vote
3answers
74 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
63 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 ...
-1
votes
1answer
40 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
82 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
57 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
36 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
78 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
106 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
22 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
27 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
22 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
33 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
91 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
128 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
44 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
56 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 ...