Posts

Showing posts from 2026

Donate

How To Use FontAwesome Icons In jsTree Using ASP.NET MVC And JavaScript

Hello, Here's a tutorial on how to integrate FontAwesome Icons In jsTree Using ASP.NET MVC And JavaScript. First is to install the FontAwesome Nuget package using package console manager. Make sure to target the web project. Install - Package FontAwesome Then we add custom css styles for the icon color that corresponds to a file type. /* icon implementation */ . pdf-icon-color { color : red !important ; } . word-icon-color { color : blue !important ; } . xls-icon-color { color : green !important ; } . ppt-icon-color { color : orange !important ; } . img-icon-color { color : DodgerBlue !important ; } . txt-icon-color { color : gray !important ; } . video-icon-color { color : royalblue !important ; } . default-icon-color { color : black !important ; } Once we have the css styles in place, we then proceed with the essential JavaScript functions. The functions below will update the jsTree icons based on their types. T...

How To Shrink Database Log Files In SQL Server Using T-SQL

Hello! Below are the scripts to shrink a specific log file assuming log files take up so much disk space. -- View all log files in db and their log sizes DBCC SQLPERF(LOGSPACE); -- Backup log file first before shrinking BACKUP LOG [SandboxDb] TO DISK = 'Z:\SQL\Backups\Customer_DB\SandboxDb_Log.trn' WITH INIT, COMPRESSION; GO -- View Log File name of DB USE SandboxDb GO SELECT name FROM sys.master_files WHERE database_id = db_id() AND type = 1 /* Commands to shrink the db */ USE [SandboxDb]; GO CHECKPOINT ; GO -- Change the database recovery model to SIMPLE if FULL is the current recovery mode. ALTER DATABASE SandboxDb SET RECOVERY SIMPLE ; GO -- Shrink log file to 10240 MB. -- 10240 means 10,240 MB = 10 GB. DBCC SHRINKFILE (SandboxDb_Log, 10240 ); GO -- Reset the database recovery model. ALTER DATABASE SandboxDb SET RECOVERY FULL ; GO Cheers!

SQL Server System Versioned Table Scripts

Hello, Here's some of my compiled T-SQL scripts to convert ordinary tables to System Versioned and data manipulation scripts. See below the scripts using ficticious tables and columns. How To Convert An Ordinary Table To A System Versioned Table Use TEST_DB GO ALTER TABLE dbo.tblFileFolders ADD StartTime DATETIME2 GENERATED ALWAYS AS ROW START CONSTRAINT DF_tblFileFolders_StartTime DEFAULT SYSUTCDATETIME(), EndTime DATETIME2 GENERATED ALWAYS AS ROW END CONSTRAINT DF_tblFileFolders_EndTime DEFAULT CONVERT (DATETIME2, '9999-12-31 23:59:59.9999999' ), PERIOD FOR SYSTEM_TIME (StartTime, EndTime); ALTER TABLE dbo.tblFileFolders SET ( SYSTEM_VERSIONING = ON ( HISTORY_TABLE = dbo.tblFileFoldersHistory ) ); How To A Drop System Versioned Table Use TEST_DB GO -- 1. Disable system versioning ALTER TABLE [dbo].[tblFileFolders] SET (SYSTEM_VERSIONING = OFF ); GO -- 2. Dr...

Donate