Questions tagged [sql-server-2016]

Use this tag for questions specific to the 2016 version of Microsoft's SQL Server.

Microsoft SQL Server 2016 v.13.0.1601.5 Ready To Manufacture (RTM), was released on June 1, 2016.

There are many editions of SQL Server 2016:

1- Entreprise Edition : Comprehensive, mission-critical in-memory performance with unparalleled security, mission critical high availability, an end-to-end enterprise business intelligence solution with mobile BI built in, in-database advanced analytics at scale, and unlimited virtualization with software assurance. Enterprise edition provides the highest scale and performance for Tier-1 workloads.

2- Standard: Find rich programming capabilities, security innovations, and fast performance for applications and data marts. Easily upgra

3- Developer: Build, test, and demonstrate applications in a non-production environment with this free, full-featured set of SQL Server 2016 SP1 Enterprise edition software.

4- Express: Deploy small databases in production environments with this free, entry-level database that’s ideal for building small, data-driven applications up to 10 GB of disk size.

5- Compact: Free, embedded database app for building ASP.NET websites and Windows desktop applications.

6- Web: Secured, cost effective, and highly scalable data platform for public web sites—available to third-party hosting service providers only.

References

3794 questions
28
votes
5 answers

How to search SQL column containing JSON array

I have a SQL column that has a single JSON array: {"names":["Joe","Fred","Sue"]} Given a search string, how can I use SQL to search for a match in the names array? I am using SQL 2016 and have looked at JSON_QUERY, but don't know how to search for…
paultechguy
  • 2,318
  • 4
  • 25
  • 34
27
votes
7 answers

SQL Server 2016 JSON: Select array of strings instead of array of objects

I am new to JSON in SQL Server and can't figure out how to return a simple array of strings: DECLARE @T TABLE ([value] NVARCHAR(MAX)) INSERT INTO @T ([value]) VALUES ('foo') INSERT INTO @T ([value]) VALUES ('bar') INSERT INTO @T ([value]) VALUES…
nokturnal
  • 2,809
  • 4
  • 29
  • 39
26
votes
3 answers

NHibernate HQL Generator to support SQL Server 2016 temporal tables

I am trying to implement basic support for SQL Server 2016 temporal tables in NHibernate 4.x. The idea is to alter SQL statement from SELECT * FROM Table t0 to SELECT * FROM Table FOR SYSTEM_TIME AS OF '2018-01-16 00:00:00' t0 You can find…
veeroo
  • 752
  • 6
  • 25
26
votes
3 answers

How can I use System-Versioned Temporal Table with Entity Framework?

I can use temporal tables in SQL Server 2016. Entity Framework 6 unfortunately does not know this feature yet. Is there the possibility of a workaround to use the new querying options (see msdn) with Entity Framework 6? I created a simple demo…
cSteusloff
  • 2,487
  • 7
  • 30
  • 51
26
votes
4 answers

Accessing JSON Array in SQL Server 2016 using JSON_VALUE

I am stuck while accessing array inside json using newly introduced JSON_VALUE function. Please consider following code - IF EXISTS(SELECT 1 FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME='JsonData') DROP TABLE JsonData; go CREATE TABLE…
UVData
  • 459
  • 2
  • 6
  • 13
25
votes
7 answers

SQL Server : can you limit access to only one table

I think the answer is no but I'm looking to give someone access to a SQL Server database but I only really want them to have access to one table. It's easy enough to limit someone to only access one database but have no idea if I can limit to a…
Andrew Newland
  • 784
  • 1
  • 9
  • 19
24
votes
5 answers

How to get column-level dependencies in a view

I've made some research on the matter but don't have solution yet. What I want to get is column-level dependencies in a view. So, let's say we have a table like this create table TEST( first_name varchar(10), last_name varchar(10), …
Roman Pekar
  • 107,110
  • 28
  • 195
  • 197
23
votes
7 answers

How to force SQL Server to return empty JSON array

I'm using SQL Server 2016, which supports JSON PATH to return JSON string. I wonder how to get just a simple empty json array, I mean [] when my query or sub-query returns null. I've tried this query: SELECT '' AS TEST FOR JSON…
Saman Gholami
  • 3,416
  • 7
  • 30
  • 71
22
votes
3 answers

Passing JSON type as parameter to SQL Server 2016 stored procedure using ADO.Net in ASP.Net Core project

Can someone give example how to pass JSON type as parameter to SQL Server 2016 stored procedure using ADO.Net in C# ASP.Net Core Web Api project ? I want to see example of SQL Server 2016 stored procedure and pass of JSON type in C# ASP.Net Core…
jump4791
  • 1,203
  • 5
  • 12
  • 17
22
votes
5 answers

Entity Framework not working with temporal table

I'm using database first entity framework 6. After changing some of the tables in my schema to be temporal tables, I started getting the following error when attempting to insert new data: Cannot insert an explicit value into a GENERATED ALWAYS…
21
votes
3 answers

SQL Server bug or feature? Decimal numbers conversion

I am experiencing some strange behavior in SQL Server when working with decimal and numeric data types. I have a formula that calculates a specific value (4.250), and I'm using the same rounding and casting operations in all cases. However, I'm…
21
votes
2 answers

Choosing a binary collation that can differentiate between 'ss' and 'ß' for nvarchar column in Sql Server

As the default SQL_Latin1_General_CP1_CI_AS collation of SQL server can't differentiate between ss and ß, I want to change the collation of a specific column in a table to SQL_Latin1_General_CP437_BIN2, as advised in here. However, I am not sure…
Sayan Pal
  • 4,768
  • 5
  • 43
  • 82
20
votes
1 answer

TSQL RaiseError incorrect syntax, following MSDN's guidelines

MSDN states the following syntax: RAISERROR ( { msg_id | msg_str | @local_variable } { ,severity ,state } [ ,argument [ ,...n ] ] ) [ WITH option [ ,...n ] ] The msg_str expects a string up to 2047 characters but truncates longer strings. It…
Aske B.
  • 6,419
  • 8
  • 35
  • 62
19
votes
10 answers

Query without WHILE Loop

We have appointment table as shown below. Each appointment need to be categorized as "New" or "Followup". Any appointment (for a patient) within 30 days of first appointment (of that patient) is Followup. After 30 days, appointment is again "New".…
LCJ
  • 22,196
  • 67
  • 260
  • 418
19
votes
3 answers

Get multiple rows using FOR JSON clause

Using PostgreSQL I can have multiple rows of json objects. select (select ROW_TO_JSON(_) from (select c.name, c.age) as _) as jsonresult from employee as c This gives me this result: {"age":65,"name":"NAME"} {"age":21,"name":"SURNAME"} But in…
izengod
  • 1,116
  • 5
  • 17
  • 41