Thursday, August 21, 2025

.::: Install Microsoft SQL Server 2022 in Centos 9 / Redhat 9 / Almalinux 9 :::.

 

1. disable selinux

2. enable repo 


curl -o /etc/yum.repos.d/mssql-server.repo https://packages.microsoft.com/config/rhel/$(rpm -E %{rhel})/mssql-server-2022.repo

curl https://packages.microsoft.com/config/rhel/8/prod.repo | sudo tee /etc/yum.repos.d/mssql-release.repo

curl https://packages.microsoft.com/config/rhel/9/prod.repo | sudo tee /etc/yum.repos.d/mssql-release.repo

[root@teguhth data]# curl -o /etc/yum.repos.d/mssql-server.repo https://packages.microsoft.com/config/rhel/$(rpm -E %{rhel})/mssql-server-2022.repo
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100   444  100   444    0     0    199      0  0:00:02  0:00:02 --:--:--   199
[root@teguhth data]#
[root@teguhth data]#
[root@teguhth data]# cat /etc/yum.repos.d/mssql-server.repo
[packages-microsoft-com-mssql-server-2022]
name=Microsoft SQL Server 2022
baseurl=https://packages.microsoft.com/rhel/9/mssql-server-2022/
enabled=1
gpgcheck=1
repo_gpgcheck=1
# If installing the bare repo file consider installing the gpg key once and then updating
# this to point to the on-disk location. For example:
# gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-Microsoft
gpgkey=https://packages.microsoft.com/keys/microsoft.asc
sslverify=1
[root@teguhth data]#

Wednesday, August 20, 2025

.::: Install MariaDB 10.6 in Ubuntu 22 :::.

  

1. Tambahkan GPG Key mariadb

sudo apt install -y curl software-properties-common gnupg
curl -fsSL https://mariadb.org/mariadb_release_signing_key.asc | sudo gpg --dearmor -o /usr/share/keyrings/mariadb-keyring.gpg

2. Tambahkan Repository mariadb 10.6

deb [arch=amd64,arm64 signed-by=/usr/share/keyrings/mariadb-keyring.gpg] http://mirror.mariadb.org/repo/10.6/ubuntu noble main
 

Friday, August 15, 2025

Thursday, August 14, 2025

.::: Query Check day, hour & early time, check time, different time in MSSQL, MariaDB MySQL, PostgreSQL EDB, Oracle DB to Get the Start of the Current Hour and the Previous Hour :::.

  


A. MSSQL

1. one day before

select @@servername as ServerName, GETDATE() as Currentdate, CAST(CONVERT(date, GETDATE() - 1) AS datetime) as datebefore , CAST(CONVERT(date, GETDATE()) AS datetime) as datecurrent 

INSERT INTO target_table (col1, col2, col3, tanggal)
SELECT col1, col2, col3, tanggal
FROM source_table
WHERE tanggal >= CAST(CONVERT(date, GETDATE() - 1) AS datetime) 
  AND tanggal <  CAST(CONVERT(date, GETDATE()) AS datetime);

Popular Posts