Skip to content

Instantly share code, notes, and snippets.

View brunotdantas's full-sized avatar
🏠
Working from home

Bruno Dantas brunotdantas

🏠
Working from home
View GitHub Profile
@brunotdantas
brunotdantas / sqlcmd_batch.bat
Last active March 3, 2020 18:16
Run sql in batches from a folder #sql #SQLSERVER #TSQL
:: Source: https://www.sqlservercentral.com/scripts/run-sqlt-sql-scripts-on-folder
:: A bat script to run all the sql/t-sql scripts in a specific folder.
::
:: Features:
::
:: - Using SQLCMD for running the scripts.
::
:: - Logging the results of your sql to a file per script.
::
:: - Input for scripts and log folders.
@brunotdantas
brunotdantas / Validacao CPF receita federal
Created February 15, 2019 12:25
Validacao CPF receita federal
var foco = "";
var msgstatus = "";
// fonte: http://www.receita.fazenda.gov.br/aplicacoes/atcta/cpf/funcoes.js
/*************************************************
Função que permitir digitar numeros
**************************************************/
function EntradaNumerico(evt) {
var key_code = evt.keyCode ? evt.keyCode :
evt.charCode ? evt.charCode :
@brunotdantas
brunotdantas / read_xml.sql
Created December 3, 2018 13:34
Example of reading a XML using OPENXML in SQL SERVER
DECLARE @XML XML
SET @XML = '<rows><row>
<transacao>
<IdInvernadero>8</IdInvernadero>
<IdProducto>3</IdProducto>
<cars>
<id>z</id>
<test> oi</test>
</cars>
<IdCaracteristica1>8</IdCaracteristica1>
@brunotdantas
brunotdantas / estados_Brasil.sql
Last active November 28, 2018 18:10
Lista dos estados do Brasil com relacionamento de tabelas de País > Estado > Cidade
-- Orinal em Mysql : https://www.ricardoarrigoni.com.br/cidades-brasil-lista-de-cidades-brasileiras-em-sql/
--------------------------------------------
--> Scrip abaixo cria estrutura de Pais > Estado > Cidade
--------------------------------------------
-- < Cria tabela de países > --
IF EXISTS (SELECT * FROM sysobjects WHERE id = object_id(N'[dbo].[paises]') )
DROP TABLE paises; -- < Dropa a tabela se já existir > --
CREATE TABLE paises (
@brunotdantas
brunotdantas / downloadSheet.php
Created November 22, 2018 12:16
Create a spreadsheet with phpSpreadSheet (https://github.com/PHPOffice/PhpSpreadsheet) #Excel #xls #xlsx
<?php
// requiring autoload with the pluguin
require __DIR__ . '/../../vendor/autoload.php';
// invoking needed classes
use PhpOffice\PhpSpreadsheet\Spreadsheet; //class responsible to change the spreadsheet
use PhpOffice\PhpSpreadsheet\Writer\Xlsx; //class that write the table in .xlsx
$spreadsheet = new Spreadsheet(); //instanciando uma nova planilha
<?php
/***********************************************************
MYSQL VERSION
************************************************************/
$username="root"; $password=""; $database="exam_codes";
$con = mysql_connect("localhost",$username,$password) or die( "Unable to Connect database");
mysql_select_db($database,$con) or die( "Unable to select database");
// Table Name that you want
// to export in csv