Indexing is the fast way to be faster The problem is, though … how do you choose the right indexes? How do you choose the right index keys? It’s very easy to choose the wrong indexes, in this case bad performance. FILLFACTOR and PAD_INDEX FILLFACTOR and PAD_INDEX are only used when the index is being built or rebuilt....

When there is no more space Compress folders to Save Storage Space 1 2Invoke-WmiMethod -Path "Win32_Directory.Name='C:\Test'" -Name compress Command line 1echo Uninstall all previous versions of components 2DISM.exe /online /Cleanup-Image /StartComponentCleanup 3 4echo Remove files needed for uninstallation of service...

Find all CLRs on all databases can be hard work, this code help to find these CLRs. Select all CLRs on a database: 1-- Select all CLRs on a database 2SELECT distinct 3 DB_NAME() AS DatabaseName, 4 udf.type AS Type, 5 udf.name AS Name, 6 udf.object_id AS ID, 7 udf.create_date AS CreateDate, 8 udf.modify_date AS...

SQL Script to export table data in xml files, or export schema data to xsd files This use OLE Automation Stored Procedures (Transact-SQL), and maybe, you need to change the global configuration settings of SQL Server. It can be an issue in production environment, and this case. The SQL Script have three stored...

This PowerShell script generates an html report listing all accounts used as logon account by services on servers in an Active Directory domain. The script has filters to ignore accounts : NT Service, NT AUTHORITY and LocalSystem https://github.com/sozezzo/Powershell/blob/master/Report/report-service-server.ps1 Apply...

This query returns list of tables and their columns with details. 1 2SELECT @@Servername AS ServerName 3 , DB_NAME() AS DatabaseName 4 , DB_ID() AS DatabaseId 5 , sc.name AS SchemaName 6 , tab.schema_id AS SchemaId 7 , tab.NAME AS TableName 8 , tab.object_id AS TableId 9 , col.NAME AS ColumnName 10 , col.column_id 11 ,...

Disable all triggers on a table, you do what you have to do, after enable only the triggers that have been disabled. Step 1 : Disable all triggers 1 2--#region Disable triggers 3 4DECLARE @triggers TABLE (SqlEnableTrigger NVARCHAR(MAX)); 5DECLARE @SchemaName VARCHAR(128) = 'mySchema'; – ** TO DO ** 6DECLARE @TableName...

A jobSql Job was changed. The questions are: When? by Who? We suppose you always have a copy of yours jobs. ** Check the SQL Script for shared folder, your e-mail and SMTP server. Delete old audit configuration – make sure you want to do that. 1 2print @@servername 3 4USE [master] 5 6GO 7 8BEGIN TRY ALTER SERVER AUDIT...

Get Job name when you are executing job. This is useful when you need to make reference to the job being executed. 1 2DECLARE @jobname sysname, @jobid uniqueidentifier 3 4SELECT @jobname=b.name,@jobid=b.job_id 5FROM sys.dm_exec_sessions a,msdb.dbo.sysjobs b 6WHERE a.session_id=@@spid 7AND...

How create a file with 1 GB of data using the command line in Windows Server 2019, you can use the fsutil command. Here’s an example: 1fsutil file createnew filename.txt 1073741824 In this command, filename.txt is the name of the file you want to create and 1073741824 is the size of the file in bytes (1 GB). Note that...

you are already in trouble and it is too late when … The transaction log becomes full, SQL Server Database Engine issues a 9002 error. The SQL Server Database Filegroup is Full. Run out of disk space You must have the answer to theses questions: Who many times the database base can still growth? Do we use the best...

Why do I need to change it? Joining VM to the domain when we clone VMs… A SID, short for security identifier, is a number used to identify user, group, and computer accounts in Windows. SIDs are created when the account is first created in Windows and no two SIDs on a computer are ever the same. The term security ID is...

A collection of awesome browser-side JavaScript libraries, resources and shiny things. Package Managers# Host the javascript libraries and provide tools for fetching and packaging them. npm - npm is the package manager for javascript. Bower - A package manager for the web. component - Client package management for...

The big thing is … Mongo BD is NOT RDBMS! In OOP are not tables and rows, objects use polymorphism, inheritance, and it is not uniform. Use objects with RDBMS can be hard. Mongo DB has no schema to define, no tables and no relationships between collections of objects. Each document can be flat, simple, or complex as we...

Easy steps to install PHP on Windows Server 2016 This tutorial was create for Windows Server 2016 x64, but you can do it on Windows Workstation x86, but you just need to use x86 everywhere. # REQUIREMENTS# Windows Server 2016 IIS PHP bin files WinCache VC++ IIS service with CGI extension.# Before to install, verify if...

Step by step how you can change ‘root’ password You must have rights to stop/start services, and kill process. Step 1: Stop MySql service run: services.msc … Step 2 : Create file to reset password You can use your password and your file name. We use password : Pass1Word2 and file name : C:\temp\reset.txt 1 2USE mysql;...

This code create a table to log all connections. It is very simple, it just logs when, who, from where and which database. For this we use “master.dbo.sysprocesses” https://docs.microsoft.com/en-us/sql/relational-databases/system-compatibility-views/sys-sysprocesses-transact-sql?view=sql-server-2017 Create table to log...

When we write a query than is running for every database in the instance of SQL Server, we use Sp_msforeachdb. If your query is bigger than 2000 chars, the query cannot work because Sp_msforeachdb has a character limitation of 2000 chars. The solution is to re-create MySp_myforeachdb. We use sp_helptext to see the...

This script remedy index fragmentation by reorganizing or rebuilding an index. Small tables, small indexes, low fragmentation, we do not care, and keep simple & easy We are talking about the guidance which is: •if a table has less than 10000 rows, to do nothing •if an index has less than 1000 pages, to do nothing •if...