bitScry - Blog

SQL

About this site

This is a blog to help me remember some of the coding challenges I’ve faced and hopefully help others out if they’re suffering the same problems.

Recent Posts
  • Adding a Sonoff Zigbee Dongle Plus P Router to Zigbee2MQTT
  • Configuring Raspberry Pi 5 with NVME Hat
  • Pass Through an iGPU to Frigate from Proxmox
  • Creating a Frigate VM on Proxmox
  • Enable Remote Root SSH Login
Tag Cloud

.NET .NET Core AAD API appsettings.json ASP.NET Core Authentication Authorization Azure Azure Active Directory Azure Function Azure Storage Blob Bootstrap C# Cloud Storage Console Application CSS CSV DataTable Dependency Injection Dictionary Docker Entity Framework Enum Extension HTML Image JavaScript jQuery JSON List MVC Newtonsoft Raspberry Pi RestSharp Serilog SQL Stored Procedure Stream Table Table Storage Web App Web Application WordPress

Copyright
Creative Commons License Any code within by is licensed under a Creative Commons Attribution 4.0 International License.
Programming

Passing NULL Values to a SQL Stored Procedure from .NET Core

I’ve previously posted about how to cope with nullable values retrieved from a SqlDataReader but it’s also necessary to account for nulls when passing values through to a SQL operation such as a stored procedure. sp__set_completed.sql If you want you’re stored procedure to accept nulls then you first need to Read more…

By Shinigami, 6 years ago
Programming

Finding Entities in Azure Table Storage That Are No Longer in Local Storage

I have a table in Azure Table Storage that I need to keep as a replica of a local SQL table. Adding/updating rows from the local table is simple enough but it is slightly more complicated to find rows that have been removed from the local table and therefore need Read more…

By Shinigami, 6 years ago
Programming

Selecting All Data from a VARCAR(MAX) Column

If you’re using VARCHAR(MAX) columns in SQL then you may occasionally want to view the stored values in SQL Server Management Studio (SSMS) as part of the debugging process. Because a VARCHAR(MAX) field can store up to 2GB of data SSMS truncates the data returned to 8200 characters in the Read more…

By Shinigami, 6 years ago
Programming

Getting a Randomly Generated String in SQL

If you want to get a random string in SQL then you could use newid to generate a GUID and take the alphanumeric characters from it, however while these should obviously be unique from each other they don’t contain the full range of characters that may be desired and sequential Read more…

By Shinigami, 6 years ago
Programming

Inserting Secrets into IdentityServer 4 SQL Tables

I use IdentityServer to manage access to a few client APIs with the configuration details stored in SQL. The one downside to using IdentityServer is that there doesn’t yet seem to be a good option for administration of credentials, though Skoruba.IdentityServer4.Admin certainly looks promising. In order to add new clients Read more…

By Shinigami, 6 years ago
Programming

SQL Table Size Query

Below is a SQL query for getting database sizes borrowed from this post. Unfortunately it doesn’t work on Azure SQL databases unless you’ve been granted VIEW_DATABASE_STATE permissions.

By Shinigami, 6 years ago
Programming

Using IdentityServer4 for API Authentication

IdentityServer4 is an OpenID Connect and OAuth 2.0 framework for ASP.NET Core 2 which can be used to manage authentication for web applications. In my case I wanted to set up OAuth 2.0 authentication using a SQL backend for an API, this isn’t too tricky when you know what you’re Read more…

By Shinigami, 6 years ago
Programming

Using SQL Task Results in a Script Task in SSDT

In SSDT if you want to access the results of a SQL query in a script task you can do this by outputting the results as a full result set into a variable of type Object and then load this into a DataTable within your script task. It’s also possible Read more…

By Shinigami, 7 years ago
Azure

Exporting an Azure SQL Databases Using .NET

It’s possible to export an Azure SQL database to a BACPAC file using the Azure portal and PowerShell among other methods but the documentation makes no mention of doing this directly in .NET, though happily this is also possible. The process detailed below triggers a database export to a specified Read more…

By Shinigami, 7 years ago
Programming

Thread Safe DataTable Inserts and SqlBulkCopy

As part of a project where I was running multiple threads making API calls like this I was making a stored procedure call to log the results to an SQL database for each result returned. This worked fine when a low number of threads was used but then started to Read more…

By Shinigami, 7 years ago

Posts pagination

Previous 1 2 3 Next
  • About
  • Blog
  • Contact
  • Create your website with blocks
  • Sample Page
  • Sample Page
Hestia | Developed by ThemeIsle