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.

mssql-num2words

Solution

Let’s pick the English one —…


Q1: What is it?

columnstore-indexes-overview

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. …


Problems\Concerns

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

tsql-to-generate-mock-fake-data

Let’s see how TSQL can do this job!

Solution

Now let’s go…


Prolems\Concerns

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…

T-sql-and-FTP-files?

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

Solution


Problems\Concerns

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”!

Solution

Before you start:


Problems\Concerns

“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…!

https://github.com/datnguye/SQL-Server/blob/master/web-call/API.sql

Sample usage to POST SendGrid Email API:

EXEC dbo.API 
@Method = ‘POST’,
@Url = 'https://api.sendgrid.com/v3/mail/send',
@ContentType = 'application/json',
@Authorization = 'Bearer your-api-key',
@BodyData = 'your-body-data'


Problems/Concerns

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

Solution

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