Data Science

SSRS - Pie charts with Standard Deviation layout and design

It's an example of layout / template created in SSRS:  

R Studio - SQL Database Connection

This is a database connection sample:    library(RODBC) dbhandle <- odbcDriverConnect('driver={SQL Server};server=SERVERNAME;database=DW;trusted_connection=true')  res <- sqlQuery(dbhandle, 'select * from DW.DBO.Vehicle ')   head(res)    

My first R code embedded in SQL 2019

My first R code embedded in  SQL 2019   EXECUTE sp_execute_external_script @language = N'R', @script = N' a <- 1 b <- 2 c <- a/b d <- a*b print(c, d)'   EXECUTE sp_execute_external_script @language = N'R', @script = N' a <- 1 b...

K-Means in SQL with Cluster in R and visualization in Tableau

========================= SQL R =========================   USE [DW] GO   SET ANSI_NULLS ON GO   SET QUOTED_IDENTIFIER ON GO /*   CREATE TABLE [dbo].[data_1024_kMeans]( [Driver_ID] [varchar](50) NULL, [Distance_Feature] [varchar](50)...

K-Means in Python based on a CSV Source

    import matplotlib.pyplot as plt import pandas as pd import numpy as np from sklearn.cluster import KMeans from sklearn.datasets.samples_generator import make_blobs import seaborn as sns; sns.set() df = pd.read_csv("data_1024_kMeans.csv",...

Loading A CSV Into pandas in Python

  import modules import pandas as pd import numpy as np Create dataframe (that we will be importing) raw_data = {'first_name': ['Jason', 'Molly', 'Tina', 'Jake', 'Amy'], 'last_name': ['Miller', 'Jacobson', ".", 'Milner', 'Cooze'], 'age': [42, 52, 36, 24, 73], ...

Azure Machine Learning - Normalizing and Cleaning Up a Dataset

Normalizing We can specify the fields to be normalized, choosing the Transformation Method that suits the dataset:     Cleaning UP  it's necessary in case of the missing value is greater than "0":     The dataset I'm using is very clean, the reason why it's "0". If it had...

Linear Regression in R

First of all, I had installed RStudio, this is the link for download: https://leandro26.webnode.com/products/download-r-for-windows/   Once we have installed RStudio, load the script below:     --=============================================== --// R...

Relevant Process Monitoring - Database Loading and Business Rules

It's a monitoring to check if it has any relevant jobs, tasks, database loading or business rules  "stopped".   Currently, we are monitoring if it has any issues, but not if it's stopped.   Considering the company has a monitor to show up the monitoring from...

Flash the Window Application if the Monitoring Data is achieving the Threshold in C#

It shows only the method to flash the Windows:     ===================================================== Calling the Class: ===================================================== // One this to note with this example usage code, is the "this" keyword is referring to // the...

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