Tuesday, March 27, 2018
Thursday, March 15, 2018
Tuesday, March 13, 2018
Monday, March 12, 2018
Windev : Abscisse en lettres dans une feuille Excel
PROCEDURE test(X est un entier)
// Cette fonction renvoie l'abscisse en lettres dans une feuille Excel
// X est le numéro de colonne
// Remarque : Il s'agit de la conversion d'un nombre en base 26
// L'algorithme renvoie un résultat correct en 2 lettres maximum
// Exemples :
// 1 -> A
// ...
// 26 -> Z
// 27 -> AA
// ...
// 702 -> ZZ
// Avec 702 = 27 x 26 <-- nombre de possibilités avec les lettres en majuscule de l'alphabet
nQuotient est un entier
nReste est un entier
sRes est une chaîne
SI efe_IndX > 702 ALORS RENVOYER "" // Valeur à capturer dans la fonction appelante pour éviter le plantage Excel -> Range()
nQuotient = PartieEntière(X/26)
nReste = modulo(X,26)
SI nReste = 0 ALORS
nQuotient--
nReste = 26
FIN
SI nQuotient > 0 ALORS sRes = Caract(64+nQuotient)
sRes += Caract(64+nReste)
RENVOYER(sRes)
// Cette fonction renvoie l'abscisse en lettres dans une feuille Excel
// X est le numéro de colonne
// Remarque : Il s'agit de la conversion d'un nombre en base 26
// L'algorithme renvoie un résultat correct en 2 lettres maximum
// Exemples :
// 1 -> A
// ...
// 26 -> Z
// 27 -> AA
// ...
// 702 -> ZZ
// Avec 702 = 27 x 26 <-- nombre de possibilités avec les lettres en majuscule de l'alphabet
nQuotient est un entier
nReste est un entier
sRes est une chaîne
SI efe_IndX > 702 ALORS RENVOYER "" // Valeur à capturer dans la fonction appelante pour éviter le plantage Excel -> Range()
nQuotient = PartieEntière(X/26)
nReste = modulo(X,26)
SI nReste = 0 ALORS
nQuotient--
nReste = 26
FIN
SI nQuotient > 0 ALORS sRes = Caract(64+nQuotient)
sRes += Caract(64+nReste)
RENVOYER(sRes)
Thursday, March 8, 2018
SQL Server - Replace lowercase strings with uppercase letters
(En Français : Remplacement des chaînes avec minuscules en majuscules)
-- Identification
SELECT Chaine
, UPPER(Chaine)
FROM Table
WHERE Chaine <> UPPER(Chaine) COLLATE FRENCH_CS_AI
-- Update
UPDATE Table
SET Chaine= UPPER(Chaine)
WHERE Chaine <> UPPER(Chaine) COLLATE FRENCH_CS_AI
Remarque : COLLATE FRENCH_CS_AI est nécessaire pour la comparaison des chaînes
Wednesday, March 7, 2018
SQL Server - Calcul des dates
Declare @sMoisCourant Char(6) = Substring(Convert(Char(8), Getdate(),112),1,6)
Declare @s1erJourDuMoisCourant Char(8) = @sMoisCourant + '01'
Declare @sDernierJourDuMoisPrécédent Char(8) = Convert(Char(8), DateAdd(Day, -1, @s1erJourDuMoisCourant),112)
Declare @sMoisPrécédent Char(6)= Substring(@sDernierJourDuMoisPrécédent, 1, 6)
Declare @s1erJourDuMoisPrécédent Char(8) = @sMoisPrécédent + '01'
Select @sMoisCourant
Select @s1erJourDuMoisCourant
Select @sDernierJourDuMoisPrécédent
Select @sMoisPrécédent
Select @s1erJourDuMoisPrécédent
Monday, March 5, 2018
Tools for MySQL/MariaDB
MySQL Compare
https://www.red-gate.com/products/mysql/mysql-compare/
MySQL Compare is free for non-commercial use, personal use, and for those in the charity and education sectors.
The Enterprise Edition costs €219 per user.
- Save time comparing and synchronizing the schemas of two MySQL databases
- Eliminate mistakes by generating scripts to deploy changes from dev, to test, to production
- Find and fix errors caused by differences between databases
- Speed up the deployment of new database schema updates
- Generate SQL scripts that can be manually edited before running
HeidiSQL
https://www.heidisql.com/
HeidiSQL is a useful and reliable tool designed for web developers using the popular MySQL server, Microsoft SQL databases and PostgreSQL. It enables you to browse and edit data, create and edit tables, views, procedures, triggers and scheduled events. Also, you can export structure and data either to SQL file, clipboard or to other servers. ..
Subscribe to:
Comments (Atom)