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
1
vote
2 answers

How to perform auto-increment with dependency on column in SQL Server

I am trying to figure out how to do an Auto-increment based on change in values in a different column as shown below This is what I am getting right now OtherID | AUTOINCREMENT --------+--------------- A | 1 A | 2 B | 3 C |…
Rbird
  • 13
  • 4
1
vote
1 answer

SQL Sever 2016 Alter Table Valued Function -- Alter Security Policy

I have a table-valued function which is being referenced by a security policy. I want to ALTER the function, but I cannot: Msg 3729, Level 16, State 3, Procedure accessPredicate, Line 1 Cannot ALTER 'rls.accessPredicate' because it is being…
1
vote
3 answers

How to Group By a column - SQL Server

I need to group by an UniqueIdentifier column, the table also contains the XML column. Table schema: StudentMark: CREATE TABLE [dbo].[StudentMark] ( [StudentMarkId] [int] IDENTITY(1,1) NOT NULL, [StudentId] [uniqueidentifier] NULL, …
B.Balamanigandan
  • 4,713
  • 11
  • 68
  • 130
1
vote
1 answer

Deadlock between 2 queries from 2 stored procedures

I have this odd deadlock issue which has been bugging me. The scenario is as follows: As per the photo, the 2nd stored procedure cannot update data for that Tournament Number until it's been first inserted in the table. How is it possible for it to…
Claudio
  • 230
  • 1
  • 2
  • 10
1
vote
1 answer

Using CTE to update multiple columns in table and loop on all rows in table

I'm a SQL newbie and am trying to use a CTE on all rows in a table, to update multiple columns in each row with hierarchical information. I've read lots of examples online but none that describes exactly what I need, so I hope someone can help…
1
vote
2 answers

SQL Server 2016 How to use a simple Regular Expression in T-SQL?

I have a column with the name of a person in the following format: "LAST NAME, FIRST NAME" Only Upper Cases Allowed Space after comma optional I would like to use a regular expression like: [A-Z]+,[ ]?[A-Z]+ but I do not know how to do this in…
user7792598
  • 177
  • 1
  • 6
  • 17
1
vote
2 answers

Subquery returned more than 1 value. This is not permitted when

I want to a statement which would return 1 if diference between two dates (MaturityDate, PaymentDate) is greater than 1 month. Maturity Date is a due date to which a client should made a payment. I've tried: CASE WHEN DATEDIFF(MONTH, …
user5021612
1
vote
2 answers

Using a complex query results to update a table

I have the following query... WITH NoEndJobs AS ( SELECT CustomerID, JobType, Book, Page, NextDocBook = LEAD(Job.Book) OVER (PARTITION BY CustomerID, JobType ORDER BY Book, Page), NextDocPage =…
Arvo Bowen
  • 4,524
  • 6
  • 51
  • 109
1
vote
0 answers

Can we have primary key - foreign key relation ship between normal tables and external polybase tables in one database?

Can we have both normal tables and external tables in one database with primary key - foreign key relation ship between them? The external table is backed by blob storage and the file format is parquet. If we can have relation what if some one…
1
vote
1 answer

Tool to convert queries with Non-ANSI syntax to ANSI syntax in SQL Sever 2008 R2

As a background, our system was working from SQL 2000 and was using the Non-ANSI syntax to write the queries. When we migrated to SQL 2008 R2, we have modified the "= * " and " * =" with RIGHT as well as LEFT joins. But now we are planning to…
1
vote
2 answers

Creation of stored procedures in SQL Server

I'm working on a fairly large application in which a database schema (tables, stored procedures, etc) is created by running a SQL script. The script is invoked from a stored procedure via xp_cmdshell like this. CREATE PROC CreateNewScheme AS BEGIN …
1
vote
2 answers

SQL Server : how do I prevent a record from being deleted if one of its columns is equal to a certain value

Let us say that I have a straightforward master - detail relation between two tables (OrderHeaders and OrderDetails for example). If I want to allow detail records to be deleted at the same time as a master record is deleted, I can set the delete…
Dom Sinclair
  • 2,458
  • 1
  • 30
  • 47
1
vote
1 answer

SQL Server 2016 TDE: Database encryption scan for 'DB_name' was aborted

When I executed Alter database set encryption on;, the error message such the subject was appeared in Error.log, and encryption_state has been kept 2 (Encryption in progress). The DB has only few records because it is just test…
deathcape
  • 31
  • 4
1
vote
1 answer

Getting unique months using group by

I have a table called tbl_points with the following columns: [key] identity [fkey] int -> forign key from other table [points] int -> number [inputdate] datetime -> getdate() And values…
Jixaw
  • 11
  • 1
1
vote
2 answers

SQL Server skip duplicate relations (parent child) in recursion

I have a tree, where specific node in tree can appear in another node in tree. (2 in my example): 1 / \ 2 3 / \ \ 4 5 6 …
Makla
  • 9,899
  • 16
  • 72
  • 142