Questions tagged [sql-server-2014]

Use this tag for questions specific to the 2014 version of Microsoft's SQL Server database engine. SQL Server 2014 is the predecessor of the later SQL Server 2016.

SQL Server 2014 (codename Hekaton, version 12.00), released in April 2014, is the successor to SQL Server 2012 and the predecessor of the newer version of Microsoft's SQL Server database engine SQLServer 2016.

This tag covers questions specific to the 2014 version of the database engine. It is recommended that the tag is also used when tagging questions with this version specific tag.

Read more about SQL Server 2014 from MSDN.
Get SQL Server 2014 from here.

4735 questions
1
vote
3 answers

T-SQL get the last date time record

My table looks like this: +---------+------------------------+-------+---------+---------+ |channel |date |code |comment |order_id | +---------+------------------------+-------+---------+---------+ |1 |2017-10-27…
1
vote
0 answers

Generate change log with minimal SQL calls?

I am trying to run a lot of update statements from code, and we have a requirement to summarize what changed for every operation for an audit log. The update basically persists an entire graph consisting of dozens of tables to SQL Server. Right…
Jeremy Holovacs
  • 22,480
  • 33
  • 117
  • 254
1
vote
1 answer

How to deploy an application that uses SqlServer as db server to Azure Batch

I am trying to execute a pre-existing application on Azure Batch. What I have done so far that I have studied about Azure Batch, since I am a beginner for Azure, and I have created a sample application in C# .NET (Console Application) that…
starklord
  • 291
  • 2
  • 6
  • 16
1
vote
1 answer

Incremental control field - Cursor

I'm trying to create a simple restore cursor that will be used when I have the need to restore multiple databases. Each database have simple recovery model and all are named using the following format: DBname_AAAAMMDD_FULL I have came up with a…
1
vote
1 answer

PostgreSQL query equivalent in MS SQL Server

I have one PostgreSQL database. I want to export this PostgreSQL database into MS SQL Server database. For this, first I backup the PostgreSQL database of schema-only using below command and restore this into SQL Server database. I just replace…
1
vote
4 answers

SQL case two conditions two columns

I have the data as follow: "Table" computer data date | property | computer code ---------- -------- ----------- 20160131 | companyA | 256584 20160131 | companyB | 987451 to e.t.c 20171020 | …
1
vote
1 answer

How to generate random nvarchars in sql server

I have created a stored procedure by the help of some links on this site as below: How to insert Huge dummy data to Sql server What is the most efficient way to generate 8 character random alphanumeric string in TSQL? My stored procedure: IF EXISTS…
user5711452
1
vote
1 answer

Convert OUTER APPLY to LEFT JOIN

We have query which is slow in production(for some internal reason), SELECT T2.Date FROM Table1 T1 OUTER APPLY ( SELECT TOP 1 T2.[DATE] FROM Table2 T2 WHERE T1.Col1 = T2.Col1 AND T1.Col2 = T2.Col2 ORDER BY T2.[Date] DESC )…
Imran Qadir Baksh - Baloch
  • 32,612
  • 68
  • 179
  • 322
1
vote
2 answers

MSSQL: Create column based on row when using count

How to create columns based on columns. so for row "EOIVR - SB_Internal_LN - 3 - Operator", it would create a column called "operator" and the value would be the value from "option press" In this sql fiddle the following table CREATE TABLE…
1
vote
2 answers

SQL Unpivot groups of columns

Honestly, I'm not even sure if there is a more appropriate function to use to tackle my problem as I'm not familiar with many functions in SQL 2014 besides basic Select, Update, Delete, Insert... I have this table: RegionID Price1 Price1New …
T L
  • 504
  • 2
  • 11
  • 27
1
vote
1 answer

Date and time change sql

I am using the statement below to separate the date and time from one column into two. I get a result like this. AppointmentDate AppointmentTime 10/11/2017 08:30:00.0000000 10/11/2017 16:50:00.0000000 How do I get the time to be in non…
John Molina
  • 179
  • 3
  • 14
1
vote
1 answer

Rotation of clients in SQL Server 2014

I have a problem with SQL. I have the following table: declare @t table (date datetime, shop VARCHAR(50), client VARCHAR(50) ); insert into @t VALUES ('2016-01-15', 'abc','a1'), ('2016-01-15', 'abc','b1'), …
1
vote
0 answers

SQL Server 2014 SP2 does not start on Windows Docker

I want to install and use SQL Server 2014 SP2 on Windows Docker. But the SQL Server service does not start. Steps to reproduce: Download "Microsoft SQL Server 2014 Service Pack 2 (SP2) Express" English version from…
nodchip
  • 361
  • 1
  • 3
  • 10
1
vote
2 answers

Rather short SQL statement but with many long 'SUBSTRING' statements, can this be optimized better?

This is part of a SELECT statement. The logic is pretty straightforward, however I feel like there's gotta be a way to shorten the 3rd and 4th lines. The 'TR.xType' string will look something like "Users|true|null" most likely. Lines 3 and 4 are…
User124521
  • 63
  • 5
1
vote
2 answers

How to use sub query to list from a count statement?

We have some employees in TOTEMP table who has duplicate CIVILID and now i want to find their names matching from EMP table I tried the following queries SELECT P.FIRSTNAME,ID FROM EMP p where exists (SELECT CIVILID, COUNT (CIVILID) …
aryan
  • 49
  • 6