Problems displaying this newsletter? View online.
SQL Server Central
Featured Contents
Question of the Day
Redgate Database Devops
The Voice of the DBA
 

Two Important ‘ONLINE’ Column-Level Operations in SQL Server

Today we have a guest editorial from Kendra Little as Steve is away on his sabbatical.

Recently, I wrote a blog post summing up the different ONLINE operations in SQL Server– we’ve moved a long way past simple online index creation and rebuilds.

I wrote the post because I found there was a major ONLINE feature which I didn’t learn about when it became available in SQL Server. I suspect I was distracted by other shiny features in SQL Server 2016 when this first appeared, and it simply didn’t register. The feature is: ALTER TABLE ALTER COLUMN ONLINE.

The ‘ALTER COLUMN ONLINE’ feature is important because it reduces blocking while making schema changes such as changing data types, precision, nullability, and other properties.

The ability to ADD COLUMNs online is separate. It works in some cases for non-nullable columns with default values in SQL Server 2012 and higher. The ADD COLUMN feature is unusual because it doesn’t require (or allow) the use of the ONLINE keyword – it simply kicks in automatically whenever it is available.

It’s now normal for code deployments to occur while databases are online and serving requests – initial data from the 2020 state of DevOps report shows that the majority of respondents report that most or all of their deployments take place while systems are available and serving user requests. This means that ONLINE operations remain a compelling selling point for SQL Server’s Enterprise Edition, which provides these features.

Knowing about these features is useful for a few reasons:

When making licensing decisions, understanding ONLINE operations is needed to help understand if and how Enterprise Edition will help, and if it’s worth the cost

You need to use the ONLINE keyword to take advantage the feature for ALTER COLUMN – are you already paying for Enterprise Edition but forgetting to take advantage of all the ONLINE features? Very few of them kick in without using special syntax.

Because the ADD COLUMN online feature does not require the ONLINE keyword and only works in Enterprise Edition, be cautious when using Developer Edition to estimate the performance impacts of adding a column: Developer Edition will do this online, but if you deploy the change to a Standard Edition instance it will be done offline! (Please consider voting up this User Voice suggestion to change this behavior.)

On the one hand, it’s a shame that it’s tough to keep up with critical features for SQL Server. But then again, that’s not necessarily a bad problem to have.

Kendra Little

Join the debate, and respond to today's editorial on the forums

Redgate Database Devops
 
 Featured Contents

Re-oiling the gears for the data dictionary or catalog

David.Poole from SQLServerCentral

Documentation is never a favorite task for developers. This article describes how you can use database system catalogs to make generating column descriptions less labor-intensive and also jump start a data dictionary or catalog.

The Need for a Data Catalog

Additional Articles from Redgate

In the event of a breach of personal data, any organization must produce proof that they understand what data they hold and where, and how it is being used, and that they have enforced the required standards for access control and security. To make all this possible, it is essential to build a complete model of the data and its lineage, and a data catalog is the first step in this process.

Going Serverless with Azure SQL Database

Additional Articles from SQLServerCentral

Microsoft has a new virtual core offering of Azure SQL database called serverless and this offering optimizes the price performance tradeoff and simplifies performance management for databases with intermittent and unpredictable usage.

From the SQL Server Central Blogs - Using Python And NetworkX To Build A Twitter Follower Recommendation Engine

Bert Wagner from Bert Wagner

Watch this week’s video on YouTube. This week, I want to share my process for analyzing Twitter. Specifically, I want to find who all of my friends follow on...

From the SQL Server Central Blogs - Execution Plans: First Operator

Grant Fritchey from The Scary DBA

The first time you see a new execution plan that you’re examining to fix a performance problem, something broken, whatever, you should always start by looking at the first...

 

 Question of the Day

Today's question (by Steve Jones - SSC Editor):

 

The External Database Principals

What types of external principals can be stored in sys.database_principals besides Windows groups and users?

Think you know the answer? Click here, and find out if you are right.

 

 

 Yesterday's Question of the Day (by Steve Jones - SSC Editor)

More Choice

I have this code in an application:

DECLARE @i INT = 4, @j int
SELECT @j =  CHOOSE(@i, 10,20,30,3.14,50,'Test')
SELECT @j

What is the value returned from this batch?

Answer: 3

Explanation: CHOOSE() acts like an indexing mechanism into an array of values. The data type of the values is not important here, as they can vary. The value of @j will determine the casting. If the data cannot be implicitly cast to the data type, an error is returned. Ref: CHOOSE() - https://docs.microsoft.com/en-us/sql/t-sql/functions/logical-functions-choose-transact-sql?view=sql-server-ver15

Discuss this question and answer on the forums

 

 

 

Database Pros Who Need Your Help

Here's a few of the new posts today on the forums. To see more, visit the forums.


SQL Server 2017 - Development
Query improvement (Index spool) - Hi, I have a query that takes too much time to execute. Query and plan can be seen here: https://www.brentozar.com/pastetheplan/?id=SJWSzileL I believe problem is in this part of the query: CROSS APPLY (SELECT MAX(DATO) AS dato FROM dbo.STDORD ST WHERE DATO <= DS.CLARION_DATE AND ST.KUNDE = sto.KUNDE AND ST.ANN <> 1) CA Any suggestions are […]
SQL Server 2016 - Administration
SP_MSIns_ "stuck" on inserting into a table. - Hello All, I'm having trouble with transactional replication I'm hoping someone can help with. I have Server A (publisher), Distro (Distribution server), and Server B (Subscriber). All servers are 2016. B is our report server. We have a particular table I'll just call 'Sales' that might have 300 records replicated to it in a day. […]
Will adding files to TempDB replicate to 2nd node within an always on group? - I want to add 3 more datafiles to tempdb on a database server that has a second node in an always on high availability group. With MSSQL (I'm more used to Oracle) when I do this on the primary server, does the DDL get ran on the 2nd node and the files created on it […]
Need help with generating random pass for 100s of certificates - All, I am in a process of implementing TDE on all DBs which are on our Dev servers. There are close to 200 DBs and I am creating 1 certificate for each DB. So there are going to be 200 certificates. I am also going to be backing up those certificate using different password. And […]
SQL Server 2016 - Development and T-SQL
Two tables but if 2nd table has one row that is to be ignored - I cannot think of an easy way Two Tables Table 1    PROJECT            Project_ID , Client ID Data Project_ID , Client ID 101000   A00001 101000   A00002 102000  A1111111 Table 2   CLIENT        Client_ID    ROLE Client ID   ROLE A00001    SYS A00002   SYS A1111111   SYS SELECT * FROM […]
import from sql tables into windows event viewer - Dears, I need  some ideas about how to export   from 2-3  sql server tables ( filled with app  messages) and import  into windows event viewer application/security ? Thanks, Hadrian
Grant exec permission but prevent DML operations in proc - Hi I have got a business need where a user can execute a proc but if there are any DML commands in it, then those should not be executed(error can be thrown and is fine with me or message can be printed.) Now I can't create triggers as I don't know which table DML operation […]
Administration - SQL Server 2014
Cluster, HA., replication. what are my options without a static ip address - SQL Server 2014, we have never been asked to provide redundancy until now.  We have servers but they are all virtual and do not have static ip addresses.  I need to know what kind of fail over I can do when I dont have an ip address.  I have spent most of this year researching […]
Change Log Backup Frequency Automatically - During our weekly index rebuilds (using Ola Hallengren's scripts), the log expands considerably.  This isn't unexpected and there's plenty of space into which it can expand.  I do have a task to look at minimising the growth but it's behind other things, including mitigating the growth. The problem we actually have is further downstream.  We […]
Development - SQL Server 2014
Index larger than table - I am looking at the large amount of space taken up by indexes and have a few questions; I have been searching online for a while and can't find seem to find a direct answer.  For context I have more of an Oracle background. On a table with a clustered primary key, is the row […]
SQL Server 2019 - Administration
Saving Maintenance Scripts to Azure DevOps - We have scripts that we use to maintain our data warehouse.  For example, we have a script that will truncate our dimension tables and reset the identity columns.  Anyway, I'm confused on how to save those scripts (simple .sql files) to Azure DevOps.  Can it be done directly from SSMS?   EDIT:  never mind, I […]
SQL Server 2019 - Development
TSQL Help - I need help on SQL Query i have table with 2 column Acol   BCol 1          ABD 1          ACD 1         ADD 2        DEF 2      DDD 2      EEE I want output as 1   ABD,ACD,ADD 2  DEF,DDD,EEE Appreciate your help.
SQL Azure - Administration
Correlation of DTU and RAM in ( GB) allocated to DB - Hi, Azure portal  and DMV providing   % of memory used by database I want to query  MAX  RAM in GB allocated to server assuming  we have only one customer  database per server DTU 500 = ? GB Ram , DTU 1750 = ? GB Ram Is this information secret ?      Thank you Alex
Reporting Services
ssrs 2012 page footer - in an ssrs 2012 report, my user would like a page footer to only be displayed when there is a specific 'group' changes. Basically this would only occur when a school name changes. This request is being made for a large school district that contains a large volume of schools. If this is possible, would […]
Integration Services
[DBNETLIB][ConnectionOpen (SECDoClientHandshake()).]SSL Security error - We are experiencing the following error when attempting to run a SQL Server 2016 SSIS package. Error: 2020-01-07 11:01:19.31 Code: 0xC0202009 Source: InsightMonthlyFile Connection manager "CognitionDB"Description: SSIS Error Code DTS_E_OLEDBERROR.  An OLE DB error has occurred. Error code: 0x80004005.An OLE DB record is available.  Source: "Microsoft OLE DB Provider for SQL Server"  Hresult: 0x80004005  Description: […]
 

 

RSS FeedTwitter

This email has been sent to {email}. To be removed from this list, please click here. If you have any problems leaving the list, please contact the webmaster@sqlservercentral.com. This newsletter was sent to you because you signed up at SQLServerCentral.com.
©2019 Redgate Software Ltd, Newnham House, Cambridge Business Park, Cambridge, CB4 0WZ, United Kingdom. All rights reserved.
webmaster@sqlservercentral.com

 

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -