Sr. Content Developer at Microsoft, working remotely in PA, TechBash conference organizer, former Microsoft MVP, Husband, Dad and Geek.
147048 stories
·
33 followers

SQL Concatenate String using Double Pipe (||) Operator in SQL Server 2025

1 Share

Explore SQL Server 2025's new SQL concatenate string with the double pipe operator for efficient data handling.

The post SQL Concatenate String using Double Pipe (||) Operator in SQL Server 2025 appeared first on MSSQLTips.com.

Read the whole story
alvinashcraft
just a second ago
reply
Pennsylvania, USA
Share this story
Delete

Enable Soft Delete in Azure SQL

1 Share

Sometimes applications need to remove data without actually losing it. Soft delete keeps rows in the database while making them invisible to normal application access. This is especially valuable when exposing a database to an AI agent through an MCP server like SQL MCP Server, where safety and reversibility matter.

Learn about SQL MCP Server

Filtering on an IsDeleted column in every query is fragile. One missed filter exposes your data. Row-Level Security enforces visibility rules inside the database so application code cannot bypass them. Let’s take a look.

Working demo: https://gist.github.com

What We Are Building

A Todos table where soft delete is enforced at the database layer.

Step 1: Create the User & Login

This example uses a SQL login for simplicity. In Azure SQL, you would typically use a managed identity. The pattern is the same.

CREATE LOGIN TodoDbUser WITH PASSWORD = 'Long@12345';
GO

CREATE USER TodoDbUser FOR LOGIN TodoDbUser; 
GO

Step 2: Create the Table

CREATE TABLE dbo.Todos
(
    Id        INT IDENTITY(1,1) PRIMARY KEY,
    Title     NVARCHAR(200) NOT NULL,
    State     NVARCHAR(20)  NOT NULL DEFAULT 'pending',
    IsDeleted BIT           NOT NULL DEFAULT 0
);
GO

INSERT INTO dbo.Todos (Title, State) 
VALUES 
    ('Buy groceries', 'pending'), 
    ('Walk the dog', 'completed'), 
    ('Finish report', 'in-progress'), 
    ('Call mom', 'pending'), 
    ('Clean the house', 'completed'); 
GO

Step 3: Define Soft Delete

Instead of issuing a DELETE, the application calls a stored procedure that marks the row as deleted.

CREATE PROCEDURE dbo.DeleteTodo
    @Id INT
AS
    UPDATE dbo.Todos
    SET IsDeleted = 1
    WHERE Id = @Id;
GO

This stored procedure is the only delete mechanism exposed to the application.

Step 4: Grant Permissions

The application can select and update rows, but it cannot delete them directly.

GRANT SELECT, INSERT, UPDATE ON dbo.Todos TO TodoDbUser;
GRANT EXECUTE ON dbo.DeleteTodo TO TodoDbUser;
GO

At this point, the application still sees deleted rows. Let’s fix that.

Step 5: Enforce Visibility

Row-Level Security controls which rows are visible to which users. It applies to SELECT, UPDATE, and DELETE. Filtering happens before the statement executes.

The Predicate Function

CREATE FUNCTION dbo.fn_SoftDeletePredicate(@IsDeleted BIT)
RETURNS TABLE WITH SCHEMABINDING AS
RETURN
    SELECT 1 AS fn_result
    WHERE
        (
            DATABASE_PRINCIPAL_ID() = DATABASE_PRINCIPAL_ID('TodoDbUser')
            AND @IsDeleted = 0
        )
        OR DATABASE_PRINCIPAL_ID() <> DATABASE_PRINCIPAL_ID('TodoDbUser');
GO

Meaning:

  • TodoDbUser sees only rows where IsDeleted = 0
  • All other users see all rows

Bind the Predicate

CREATE SECURITY POLICY dbo.TodosFilterPolicy
ADD FILTER PREDICATE dbo.fn_SoftDeletePredicate(IsDeleted)
ON dbo.Todos WITH (STATE = ON);
GO

From this point forward, deleted rows are invisible to the application user.

Seeing It Work

Admin View

SELECT * FROM dbo.Todos;

Soft Delete a Row as User

EXECUTE AS USER = 'TodoDbUser';

EXEC dbo.DeleteTodo @Id = 2;

REVERT;

User View

EXECUTE AS USER = 'TodoDbUser';

SELECT * FROM dbo.Todos;

REVERT;

The deleted row is hidden from the application user but remains visible to admins.

Why Undelete Does Not Work

EXECUTE AS USER = 'TodoDbUser';

UPDATE dbo.Todos SET IsDeleted = 0 WHERE Id = 123;

REVERT;

The application user cannot undelete a row. Row-Level Security hides deleted rows before the UPDATE executes, so the statement matches zero rows.

Optional: Explicitly Block Undelete Attempts

If you prefer explicit enforcement rather than silent filtering, add a block predicate.

ALTER SECURITY POLICY dbo.TodosFilterPolicy
ADD BLOCK PREDICATE dbo.fn_SoftDeletePredicate(IsDeleted)
ON dbo.Todos AFTER UPDATE;

Using Managed Identity in Azure SQL

To use a managed identity instead of a SQL login:

CREATE USER [my-container-app] FROM EXTERNAL PROVIDER;

Reference that user in the predicate function. Everything else stays the same.

The post Enable Soft Delete in Azure SQL appeared first on Azure SQL Devs’ Corner.

Read the whole story
alvinashcraft
just a second ago
reply
Pennsylvania, USA
Share this story
Delete

Daily Reading List – February 5, 2026 (#715)

1 Share

Another batch of articles today that impacted my thinking. Thanks to today’s reading list, I installed the MCP server for our Google Developer Knowledge API, realized I was thinking about MCP wrong, and felt grateful for the job changes I didn’t make.

[blog] Introducing the Developer Knowledge API and MCP Server. This is the best thing we’ll deliver this week. Developers (and AI tools) can now access a single source of truth for information about Google products.

[article] Three ways AI will change engineering practices. Don’t disagree with this. Have you planned for each?

[article] To Drive AI Adoption, Build Your Team’s Product Management Skills. It’s likely confirmation bias, but I’m noticing a LOT of conversation about the value of a product management discipline when embracing AI.

[blog] Context Management and MCP. Wow, my favorite post of the day. It definitely made me rethink some things token consumption and Skills.

[blog] Forget technical debt. The point here is that focusing purely on technical debt isn’t sufficient to fixing the problems in the system.

[article] What Happens When Technical Debt Vanishes? More thought experiments about technical debt! This was a compelling read.

[article] IT leaders grapple with AI agent sprawl. New source of debt, incoming! Companies need to get a handle on their agents, data, and integrations.

[blog] Easy FunctionGemma finetuning with Tunix on Google TPUs. I learned like four things from this post, and I’m tempted to actually run this example scenario myself!

[article] Anthropic releases Opus 4.6 with new ‘agent teams’. Is it model update season already? We’ve already made this one available on Vertex AI. OpenAI gave Anthropic about ten minutes in the spotlight.

[article] 4 self-contained databases for your apps. Which databases offer you a no-install binary that’s portable? I’m not sure I thought of this whole set.

[blog] Antigravity the Ralph Wiggum style. Turn your agent-building tool loose and let it relentless tackle a problem until it reaches the goal? It’s not for every case, but seeing this approach may spark ideas.

[article] Kilo CLI 1.0 brings open source vibe coding to your terminal with support for 500+ models. Interesting. These types of tools are getting so powerful.

[blog] I left FAANG for a startup and regretted it. We only seem to hear stories of raging successes after leaving a BIG TECH job. It’s useful to see a different perspective.

Want to get this update sent to you every day? Subscribe to my RSS feed or subscribe via email below:



Read the whole story
alvinashcraft
32 seconds ago
reply
Pennsylvania, USA
Share this story
Delete

Welcome to the Blog

1 Share

Welcome to the blog!

For a 31-day series, I had to write much of the content ahead of time. Most of it was completed in November or December 2025. The world of artificial intelligence is moving so quickly, it almost feels like the moment you post something, it’s out of date. This series still stands on its own. I tried not to lean too heavily on any specific agent or technology to keep the perspectives timeless.

Audio Versions of the Series

My friend Sean Kelly decided to do a little vibe coding of his own (a lot of vibe coding, actually), and created audio versions of this entire series. You can read about his experience figuring out how to create audio files from my articles here. I’ve also added a link to each audio file at the top of each article.

The 31 Days series taught you the fundamentals of AI-assisted development. Now this blog continues the conversation with fresh content every Friday.

What to Expect

Each week I’ll share:

  • New techniques I’ve discovered
  • Lessons from real production code
  • Updates on the evolving AI tool landscape
  • Answers to reader questions

The Series Continues

If you haven’t read the 31 Days series yet, start with Day 1: What Is Vibe Coding? to get the full foundation.

The series covers everything from basic prompting patterns to using AI as your security auditor, SRE, and architect. Each article includes real code and honest lessons about what doesn’t work.

Stay Connected

Subscribe to get new posts delivered every Friday. No spam. Just practical AI coding insights.

This Week’s Update

It’s been a busy week. I just got home from Dynatrace’s Perform conference in Las Vegas, and it was definitely a week I will never forget. Had the opportunity to talk about my journey in vibe coding, and how important observability has become as a result. (You can watch it here).

Slideshow of Dynatrace Perform presentation

In addition to that, I’ve also created a new app. While this one is invitation only, I updated the README.md on GitHub to showcase its functionality.

  • BroMadness.com – an app to run all of the contests for a friends trip to watch March Madness. (GitHub)

This was my first introduction into a few new technologies, including Vercel & Supabase. It was also my first time using Twilio Verify to provide SMS verification as a login mechanism. I’ve heard many developers state that using AI to write software makes you a worse developer, but I’m finding that I’m learning more, faster than I ever did before. I’d still be fighting with the Twilio integration and APIs, and instead, my app is already in production!

I also built another app that is for the Super Bowl game this Sunday. My sister and brother-in-law’s last name is Stuber, and they host the “Stuber Bowl” watch party every year. They have dozens of people participate in “prop bets” like “How long will the National Anthem take (in seconds)?” or “Will the first play from scrimmage ba a run or pass play?” It’s always been managed in a spreadsheet, but in just a few hours on Monday night, I was able to build them an app that has:

  • Pick making directly in the app
  • Live Chat with notification
  • SMS verification for login
  • Administrative tools to managing users and payment tracking, as well as the ability to enter results as they happen.
  • Full leaderboard
  • Profile management

I can’t even express how fun software development has become for me again. Until next week!

Some Light Reading

Read the whole story
alvinashcraft
42 seconds ago
reply
Pennsylvania, USA
Share this story
Delete

0.0.405

1 Share

2026-02-05

  • Plugin and marketplace names support uppercase letters
  • /experimental shows help screen listing experimental features
  • Fix SQL tool disconnects
  • Plugins can bundle LSP server configurations
Read the whole story
alvinashcraft
1 minute ago
reply
Pennsylvania, USA
Share this story
Delete

Temporary Issue: Windows ML or ONNX Runtime GPU workloads crashing on some x64 Devices with Microsoft OpenCL Compatibility Pack

1 Share

Overview

We are aware of an issue (starting around 1/28/2026) that caused some applications using GPU-based features of Windows ML, ONNX Runtime, or other components that depend on OpenCL, to crash on some x64 devices that have the Microsoft OpenCL Compatibility Pack. The root cause was a broken update to the Microsoft OpenCL Compatibility Pack, not a defect in developer applications.

A fix has already been released on 2/2/2026 and is currently rolling out automatically to affected devices.

Impact

  • Applications using GPU-based workloads in Windows ML or ONNX Runtime could crash at startup or during model initialization.
  • This is limited to x64 devices that have the Microsoft OpenCL Compatibility Pack.
  • This affected multiple OpenCL‑based workloads on Windows, not just Windows ML.

Resolution

A fixed version of the Microsoft OpenCL Compatibility Pack was released via the Microsoft Store on February 2, 2026, and is currently rolling out automatically to devices. No developer changes are required. Once the updated component is installed, the crash is resolved.

If you or your users are still experiencing crashes, you can manually trigger the update:

  1. Open the Microsoft Store
  2. Go to Updates & downloads
  3. Select Check for updates
  4. Ensure the OpenCL™, OpenGL®, and Vulkan® Compatibility Pack is updated

More details

For technical background on the underlying OpenCL issue, see microsoft/OpenCLOn12#74

Read the whole story
alvinashcraft
1 minute ago
reply
Pennsylvania, USA
Share this story
Delete
Next Page of Stories