วันพฤหัสบดีที่ 26 มีนาคม พ.ศ. 2569

Search Table Name of all database [ ค้นหาชือ Table ใน Database server ทั้งหมด ]

 --------------

-- Search Table Name inside database server
-- 1.
--------------
DECLARE @SearchTerm NVARCHAR(100) = '%TableName%';

EXEC sp_MSforeachdb '
USE [?];
SELECT 
    DB_NAME() AS DatabaseName,
    s.name AS SchemaName,
    t.name AS TableName,
    t.create_date AS CreateDate
FROM sys.tables t
JOIN sys.schemas s ON t.schema_id = s.schema_id
WHERE t.name LIKE @SearchTerm';
--------------
-- Search Table Name inside database server
--2.
--------------
DECLARE @TableName NVARCHAR(256) = 'TableName'; -- Table to find
DECLARE @Query NVARCHAR(MAX) = '';

SELECT @Query = @Query + 'SELECT ''' + name + ''' AS DatabaseName, s.name COLLATE Latin1_General_CI_AS, t.name COLLATE Latin1_General_CI_AS 
FROM [' + name + '].sys.tables t 
JOIN [' + name + '].sys.schemas s ON t.schema_id = s.schema_id 
WHERE t.name = ''' + @TableName + ''' UNION ALL '
FROM sys.databases 
WHERE state = 0; -- Only online databases

-- Remove the last 'UNION ALL'
IF LEN(@Query) > 0
BEGIN
    SET @Query = LEFT(@Query, LEN(@Query) - 10);
    EXEC sp_executesql @Query;
END
--------------

วันพุธที่ 18 กุมภาพันธ์ พ.ศ. 2569

Install SonarQube on windows 11 and scan quility source code on local machine

 Download SonarQube on web www.sonarsource.com





Extract File






Copy Folder to new directory , If you want to move.


Go to Dowload load jdk ver 17 (SonarQube using only version 17) on www.oracle.com


After download success , Install jdk 17

Set Environtment Path on commamd promt
Set > set "SONAR_JAVA_PATH=C:\Program Files\Java\jdk-17\bin\java.exe" 
Check > echo %SONAR_JAVA_PATH% 


Running SonarQube
Command Promt Enter > StartSonar.bat

Working on local url http://localhost:9000


Enter first time using tool
User : admin
Pass : admin



Must Re - New Password by YourSelf


Login by 
User : admin
Pass : Your New Password

This time to scan source code on local machine

Enter name project to scan




Get command script and key for using scan on local source code
Go to directory local source code

Enter cmd to call commamd promt to running on this path
Enter command script and key to scan

End as success message

Aftet scan must show summary quility of your source code 

You can check why it high impact
After you fixing , re-scan agin.


Good Luck ^_^






























Search Table Name of all database [ ค้นหาชือ Table ใน Database server ทั้งหมด ]

  -------------- -- Search Table Name inside database server -- 1. -------------- DECLARE @SearchTerm NVARCHAR ( 100 ) = '% TableN...