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
9
votes
1 answer

Using an IIF statement in a where clause

I am trying to add multiple criteria to a Where clause in SQL Server 2014 using the following code and I am getting a syntax error. I have tried a case statement but cannot get that to work based on the examples on this site. Where …
Juni0R
  • 91
  • 1
  • 1
  • 2
9
votes
1 answer

How to declare variables in T-SQL scripts that are common across multiple scripts being run

I have a set of scripts to perform bulk data imports that I am trying to include in a single 'calling' script that uses SqlCmd mode. The issue I have is that each script includes the same set of declared vars that define paths or common objects.…
TravisPUK
  • 1,043
  • 1
  • 14
  • 17
9
votes
1 answer

Best possible ways to disable index before insert operation and enable back Index after insert

I'm planning to create a Non-clustered columnstore index on SQL Server 2014. But non clustered column store index is read-only and cannot perform DML operations, we need to disable before insert and enable back after insert. What are the best…
Jay Nani
  • 105
  • 1
  • 1
  • 6
9
votes
2 answers

SQL Server Query Optimisation - Unexpected slowness in a simple query

Possible explanation is here in the comment In SQL Server 2014 Enterprise Edition (64-bit) - I am trying to read from a View. A standard query contains just an ORDER BYand OFFSET-FETCH clause like this. Approach 1 SELECT * FROM…
9
votes
2 answers

SQL grouping by datetime with a maximum difference of x minutes

I have a problem with grouping my dataset in MS SQL Server. My table looks like # | CustomerID | SalesDate | Turnover ---| ---------- | ------------------- | --------- 1 | 1 | 2016-08-09 12:15:00 | 22.50 2 | 1 |…
Felix
  • 2,670
  • 3
  • 13
  • 21
9
votes
1 answer

Add filestream to an existing table column

I have the following table column: [Content] [varbinary](max) NULL And I want to make it a filestream column so I tried: alter table dbo.Files alter column Content add filestream But I get the error: Incorrect syntax near 'filestream'. I…
Miguel Moura
  • 36,732
  • 85
  • 259
  • 481
9
votes
4 answers

SELECT number of groups resulted from a GROUP BY query

I tried the following query to select the number of groups resulting from a GROUP BY query: SELECT count(*) FROM ( SELECT count(*) FROM MyTable WHERE Col2 = 'x' GROUP BY Col1 ) Unfortunately, this query is not…
D.R.
  • 20,268
  • 21
  • 102
  • 205
9
votes
4 answers

Perform a Case insensitive Like query in a case sensitive SQL Server database

This is my scenario. SQL Server 2014 Standard edition, I have a database with a collation SQL_Latin1_General_CP437_BIN2 which is case sensitive. I want to perform a LIKE query which should return the output irrespective of case sensitive. Ex: if i…
9
votes
7 answers

Referenced table is not coming in my model through entity framework 5.0

I am using MVC 4 and entity framework 5.0, i have a database and this database contains 6 tables named as following. tblUser_family tblUser_location tblUser_info tblUser_photo tblUser_settings tblUser_social when i am creating the .edmx file then…
9
votes
2 answers

Full-text search does not find some prefixes

I'm using SQL Server 2014's full-text search capabilites to find documents in a database that start with a given prefix. Some queries, however, do not yield any results, while they should. Take the following example: SELECT * FROM…
Mathias Becher
  • 703
  • 8
  • 20
9
votes
2 answers

Why CAST('20140904 23:59:59.999' AS datetime) equals '2014-09-05 00:00:00.000'?

Try it for yourself, maybe it is somehow related to my environment: The query: SELECT CAST('20140904 23:59:59.999' AS datetime) The result: 2014-09-05 00:00:00.000 Please explain this phenomenon. UPDATE: Alex mentioned that datetime values are…
anar khalilov
  • 16,993
  • 9
  • 47
  • 62
9
votes
3 answers

Indexed views in SQL Server 2014 object explorer without index node

In the SQL Server 2014 Management Studio's object explorer indexed views with schemabinding don't have an index node. Thus, you can create and drop Indexes for views only via T-SQL. The SQL Server Management Studio 2012 still shows the index…
user1291867
  • 121
  • 7
8
votes
1 answer

Custom code similar to DATEDIFF_BIG in SQL Server 2014

I am using SQL Server 2014. I am facing a problem when I want to compare previous row date time with current row in second. The error states: The datediff function resulted in an overflow. The number of dateparts separating two date/time…
Majedur
  • 3,074
  • 1
  • 30
  • 43
8
votes
1 answer

Deterministic string replace and collate

I have a persisted computed column which calls a Scalar Valued Function. As you know, this function needs to be deterministic in order to persist the value. Even if REPLACE function behaves in a deterministic way(I can't think a case where it's…
yakya
  • 4,559
  • 2
  • 29
  • 31
8
votes
1 answer

Why select top ... order by indexed column still sort?

I created the following index to cover the select top statement. -- Column A, B have type of int create unique index ix_ on T (A, B) with (data_compression = page) -- tried to create non-unique index too and the execution plan is the same select…
ca9163d9
  • 27,283
  • 64
  • 210
  • 413