Data Science

Calling Http endpoints in T-SQL using CURL extension for ElasticSearch

This is another way to access the ElasticSearch integrated with T-SQL:   Sample code ===================================================   CREATE ASSEMBLY SqlClrCurl FROM 'C:\GitHub\sql-server-samples\samples\features\sql-clr\Curl\bin\Release\SqlClrCurl.dll' WITH...

C# - ElasticSearch - Basic Search using Nest and ElasticSearch.Net libraries

This is an example using ElasticSearch in C#:   ConnectionToES.cs ===========================================================================   using Elasticsearch.Net; using Nest; using System;   namespace DesktopSearchApp {     class...

ElasticSearch integrated with T-SQL built in C# and SQL CLR

This is the result using ElasticSearch integrated with T-SQL: For that solution, I used C# + ElasticSearch and Nest libraries + CLR.   The execution plans are very fast and light:   SQL Server parse and compile time:     CPU time = 0 ms, elapsed time = 0...

Starting a Visual Studio project in CLR for T-SQL integration

I'm using Visual Studio 2017, first of all, you need to start a new project  After that, create a new class in CLR: To publish it in production:   We can publish in production, but the best recommendation is to copy the files to the destination, also, manually apply the scripts in...

SQL Monitoring in Power BI - Error Alerts (Real-Time)

  To make it possible, I built tables to save only the last status to it earns performance, these are the statements:   --================================================================= --// It saves the last status of Backup (used for Missing...

SQL Monitoring in Power BI - SQL Error Logs

First of all, I prepared the data in SQL, this is the statement:   --=============================================================== --// Created a table to save the last status --===============================================================   USE [DBA] GO   SET...

SQL Monitoring in Power BI - Fail SQL Jobs

First of all, I prepared the data in SQL, this is the statement:   --=============================================================== --// Created a table to save the last status --===============================================================   USE [DBA] GO   SET...

SQL Monitoring in Power BI - Missing Backups

First of all, I prepared the data in SQL, this is the statement:   --=============================================================== --// Created a main view to shows up the differences --=============================================================== USE [DBA] GO   SET...

SQL Monitoring in Power BI - Lock Wait Time

  First of all, I prepared the data in SQL, this is the statement: --=============================================================== --// Created a table to save all the Locks --=============================================================== USE [DBA] GO     SET...

Delta changes for ETL - DW

Is a solution to identify data changes:    --========================================================== --// Create a new Index --========================================================== drop table tbStockIndexTrack go Create table tbStockIndexTrack ( tnz_StockNumber...

<< 2 | 3 | 4 | 5 | 6 >>

Script SQL

Backup Simples de Múltiplos Datafiles

27/06/2014 16:49
  Este exemplo gera backup em múltiplos arquivos de backup   BACKUP DATABASE [CUSTO] TO   DISK = N'N:\MSSQL2005\BACKUP\CUSTO\CUSTO_1_4.bak', DISK = N'N:\MSSQL2005\BACKUP\CUSTO\CUSTO_2_4.bak', DISK = N'N:\MSSQL2005\BACKUP\CUSTO\CUSTO_3_4.bak', DISK =...

Restore de Múltiplos Datafiles

26/06/2014 19:45
  Este script torna indisponível o banco, realiza o restore de múltiplos datafiles e ativa todos os logins existentes nele.     USE [master] GO ALTER DATABASE [CUSTO_PRE_PROD] SET  RESTRICTED_USER WITH ROLLBACK IMMEDIATE GO   RESTORE DATABASE...

Gere o resultado de uma query em uma linha única separado por string TSQL

20/06/2014 13:59
  Este script mostra como gerar um resultado único separado por "|" pipe, substitua a tabela temporária pela sua tabela de trabalho e referencie a coluna correta:     Query Exemplo (Base): ======================= SELECT      ...

Pesquisar via TSQL ignorando acentuação

17/06/2014 17:07
  Segue exemplo para  pesquisar ignorando acentuação: SELECT nome FROM (select 'Carlão' as Nome) X WHERE nome LIKE 'Carlao%' COLLATE SQL_Latin1_General_CP1_CI_AI    

Verifica os últimos status dos Jobs - SQL Server

16/06/2014 10:54
  Este script é utilizado para informar o último status de execução de um    USE msdb GO /* Consulta que informa o status da ultima execução de cada job Esta deve ser executada diáriamente */ SELECT Name,  CONVERT(DATETIME, MAX(lastrun)) AS [LastRun], CASE...