Problems & Concerns

Google it, and you’d find out a lot of suggestions that showing with all messy SQL code as SQL function, but it works really!? What is the logic behind the scene?

Let’s explore it in this article.



Let’s pick the English one —…

Q1: What is it?


Beginning with the version of 2016 (13.x) SP1, the “new” feature called Columnstore Indexes has been added to SQL Server all editions (before that, this feature was only available in the editions: Enterprise, Developer) to enhance the analytical querying performance and to optimize the way of storing indexes.

Columnstore index is the new type of the Indexes introducing in SQL Server, so we are now having:

  • Rowstore index: The tranditional indexes which we’re normally using. …


A mock data generated tool comes to be a BIG need.


Let’s see how TSQL can do this job!


Now let’s go…


No, no native option existing in TSQL. But, ways to do it by TSQL code, there are many ones:

  • WinSCP commands
  • Batch script (cmd, powershell)
  • Python code?

Let’s exploring them…


P/s: I won’t talk about the option using CLR functions as I don’t like it much.



Yes, that’s right, and Python’s power can be achieved by the extended stored procedure named: sp_execute_external_script

SQL and Python?

Let’s say “Hello World!” and prepare the “show”!


Before you start:


“YES, there is!” — As the previous article about How to call API by using TSQL?, we hence can use it to call SendGrid API to send email.

TSQL loves SendGrid Email API

Go Playing…!

Sample usage to POST SendGrid Email API:

@Method = ‘POST’,
@Url = '',
@ContentType = 'application/json',
@Authorization = 'Bearer your-api-key',
@BodyData = 'your-body-data'


Calling an API using T-SQL, is it possible?
The answer is completely YES.

But, why to call API at the database level?
Well, it could be to build a data crawler, to import data which the source is provided as API only, to be any reasons under requirements you would have.

Let’s go!

In this article, we will assume you’re all got a know of API with all kinds of its methods


We’re going to use a C/C++ librabry supported in Windows named WinHttp which version of 5.1 (v5.0 is no longer supported), and to use some extended…

Dat Nguyen

You know who I am ;)

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store