Data Science

Developing a Windows Service for Data Extraction

This solution was built to supply a third party application developed in a legacy solution called PFX.   That simple Windows application, runs every day, calling a command line that exports the PFX application to Text...

SQL Server Disk Monitoring in Power BI

I'd decided to build that monitoring to prevent any disk space issues, it's the complement from my Power BY Dashboard monitoring I have been enhancing, also, that has been very useful for my daily chores. This is the mobile interface:     My SQL Dashboard...

Developing an ETL in SSIS with C# and Python to Load a Call Centre Data in a complex Excel File

I've decided to build the ETL using Python because of the complexity to read an Excel Spreadsheet with different levels, also, due to the simple way to develop the code.     This is the complex Excel file I need to load every month:   I sorted it out building that Python...

Loading Excel Spreadsheet loading via Python

I've developed that solution in Python through the VS 2017: This is the Excel spreadsheet I'm loading: These are the codes:   #ExcelConnection.py =============================================================================================================   from xlrd...

Python Library Configuration in Windows Command Line

Library: Pandas - SQL Access  Installation: c:\Python\pipi install pandas   Library: Pyodbc- ODBC Drivers  Installation: c:\Python\pipi install pyodbc Library: xlrd- Excel Drivers (Excel Installation is not required with that driver) Installation: c:\Python\pipi...

Python Server Installation in Windows

https://www.python.org/downloads/   Library: Pandas - SQL Access  Installation: c:\Python\pip install pandas   Library: Pyodbc- ODBC Drivers  Installation: c:\Python\pip install pyodbc Library: xlrd- Excel Drivers (Excel Installation is not required with that...

MSFull-Text searching exactly text by CONTAINS

    declare @SearchContent varchar(100) = '4 wheel drive' declare @ModifiedSearchContent varchar(100) = '"'+ @SearchContent+'"'     select SearchContent, * from marsweb_CarIndex where CONTAINS (SearchContent, @ModifiedSearchContent)  AND SearchContent LIKE...

ElasticSearch Post and Get (Samples)

--// Create =======================================================   POST https://localhost:9200/carconfigindex/cartitle/1 {     "title":"Toyota 4x4" }   POST https://localhost:9200/carconfigindex/cartitle/2 {     "title":"Toyota...

Working with Synonyms (Thesaurus) in MSFullText

Before the synonyms, I couldn't find a relative name for the word 4wd that correspond to 4x4 (same meaning), the reason why it's returning only one line:     But once I have configured the MSFullText to use the synonyms, it had increased the results:   To sort it out, I've applied...

ElasticSearch integrated with T-SQL - Using API

This is another way to access the ElasticSearch integrated with T-SQL:   Sample code ===================================================   Declare @Object as Int; Declare @ResponseText as Varchar(8000);   Code Snippet Exec sp_OACreate 'MSXML2.XMLHTTP', @Object...

<< 1 | 2 | 3 | 4 | 5 >>

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