This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using Oracle.ManagedDataAccess.Client; | |
using OfficeOpenXml; | |
using System.IO; | |
namespace OracleConnectionExample | |
{ | |
class Program | |
{ | |
static void Main(string[] args) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sub ConnectToOracle() | |
Dim conn As Object | |
Dim cmd As Object | |
Dim rs As Object | |
Dim connString As String | |
Dim sqlQuery As String | |
Dim paramValue As String | |
' Set connection string | |
connString = "Provider=MSDAORA;Data Source=YourOracleDB;User ID=YourUsername;Password=YourPassword;" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.Collections.Generic; | |
using System.Data.SqlClient; | |
using System.Linq; | |
class DatabaseSyncApp | |
{ | |
static string sourceConnectionString = "your_source_connection_string"; | |
static string destinationConnectionString = "your_destination_connection_string"; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Function FuzzyPercent(ByVal String1 As String, _ | |
ByVal String2 As String, _ | |
Optional Algorithm As Integer = 3, _ | |
Optional Normalised As Boolean = False) As Single | |
'************************************* | |
'** Return a % match on two strings ** | |
'************************************* | |
Dim intLen1 As Integer, intLen2 As Integer | |
Dim intCurLen As Integer | |
Dim intTo As Integer |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
CREATE FUNCTION dbo.FuzzyPercent | |
( | |
@String1 NVARCHAR(MAX), | |
@String2 NVARCHAR(MAX), | |
@Algorithm INT = 3, | |
@Normalised BIT = 0 | |
) | |
RETURNS FLOAT | |
AS | |
BEGIN |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
CREATE FUNCTION dbo.CompareString | |
( | |
@keyString NVARCHAR(MAX), | |
@ansString NVARCHAR(MAX), | |
@Normalised BIT = 0 | |
) | |
RETURNS NVARCHAR(MAX) | |
AS | |
BEGIN |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- Tested on SQL Server 2019 | |
DECLARE @inputString NVARCHAR(100) = '1,3,2,4,2'; | |
SELECT STUFF(( | |
SELECT ',' + CAST(value AS NVARCHAR(MAX)) | |
FROM STRING_SPLIT(@inputString, ',') | |
ORDER BY CAST(value AS INT) | |
FOR XML PATH('') | |
), 1, 1, '') AS SortedString; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
WITH RankedData AS ( | |
SELECT *, | |
ROW_NUMBER() OVER (PARTITION BY id ORDER BY CASE WHEN type = 'I' THEN 0 ELSE 1 END) AS TypePriority | |
FROM your_table_name | |
) | |
SELECT id, name, type | |
FROM ( | |
SELECT *, | |
ROW_NUMBER() OVER (PARTITION BY id ORDER BY CASE WHEN type = 'E' THEN 0 ELSE 1 END) AS ETypePriority |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
DECLARE @SQL AS VarChar(MAX) | |
SET @SQL = '' | |
SELECT @SQL = @SQL + 'IF EXISTS(SELECT 1 FROM ' + TABLE_SCHEMA + '.[' + TABLE_NAME + ']) SELECT ''' + TABLE_NAME + ''' as TableName;IF EXISTS(SELECT 1 FROM ' + TABLE_SCHEMA + '.[' + TABLE_NAME + ']) SELECT * FROM ' + TABLE_SCHEMA + '.[' + TABLE_NAME + '] --ELSE SELECT ''No records'' AS [' + TABLE_NAME + ']' + CHAR(13) | |
FROM INFORMATION_SCHEMA.TABLES ORDER BY TABLE_NAME | |
EXEC (@SQL) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Dim driver As WebDriver | |
Sub ColetaDadosCorreios() | |
Set driver = New ChromeDriver | |
With driver | |
.Get "http://www2.correios.com.br/sistemas/precosPrazos/" | |
.FindElementById("data").SendKeys Format(DateAdd("d", 1, Now), "dd/MM/yyyy") | |
.FindElementByName("cepOrigem").SendKeys "01310-200" 'MASP - São Paulo | |
.FindElementByName("cepDestino").SendKeys "20021-200" 'Museu Nacional do Rio de Janeiro | |
.FindElementByName("servico").AsSelect().SelectByText ("PAC") |
NewerOlder