Profile cover photo
Profile photo
vimal lohani
vimal's posts

Post has attachment
Get time for restore or backup a database
SELECT percent_complete,        CAST((estimated_completion_time/3600000) AS varchar) + ' hour(s), ' + CAST((estimated_completion_time %3600000)/60000 AS varchar) + 'min, ' + CAST((estimated_completion_time %60000)/1000 AS varchar) + ' sec' AS est_time_to_go...

Post has attachment

Post has attachment
Hi folks, I got a question from my junior in my organization- Input the name of a person born in   Generation
X   and output the
names of all of their descendants born in   Generation Z , but   only
if these descendants are brother and sister   (have the sa...

Post has attachment
Splitting Data Query
DECLARE @STR VARCHAR ( 100 ) = 'Hi how are you doing? I am good.' DECLARE @dev VARCHAR ( 1 ) = ' ' SELECT Split . a . value ( '.' , 'VARCHAR(100)' ) AS E FROM ( SELECT Cast ( '<M> ' + Replace ( Replace ( @str , @dev , @dev + '</M><M>' ) , '.' , '' ) + ' </M...

Post has attachment
Encrypt And Decrypt Data Using Certificate In SQL Server
CREATE DATABASE Dbavimal GO USE Dbavimal GO -Create MasterKey CREATE MASTER KEY ENCRYPTION BY PASSWORD = 'DBAVimal!' ; GO - Create Certificate CREATE CERTIFICATE [EncryptionCert] WITH SUBJECT = 'DBAEncryption' GO -- Symmetric Key CREATE SYMMETRIC KEY Symm...

Post has attachment
SQL Server T-Sql Performance Tuning Tips : Sargable
In a WHERE clause, the various operators used directly affect
how fast a query is run . This is because some operators lend
themselves to speed over other operators. Of course, you may not have any choice
of which operator you use in your WHERE clauses, but...

Post has attachment
Best Practices & Monitoring Points For SQL Database & Server
Best Practices : 1. Application and Database should be on different servers 2. Proper Backup plan should be implemented (Based on Data size and RPO and RTO)                 Plan :                     i. Full Backup on Sunday                 ii. Differential...

Post has attachment
Important Links for Sql Server scripts
Sql Server Missing Index Script Click Here Sql Server Unused Index Script Click Here  Find Unused Indexes of Current Database Click Here Identify Numbers of Non Clustered Index on Tables for Entire Database Click Here

Post has attachment
Find a column in SQL database tables
SELECT s . NAME AS ColumnName , sh . NAME + '.' + o . NAME AS ObjectName , o . type_desc AS ObjectType , CASE WHEN t . NAME IN ( 'char' , 'varchar' ) THEN t . NAME + '(' + CASE WHEN s . max_length < 0 THEN 'MAX' ELSE CONVERT ( VARCHAR ( 10 ) , s . max_lengt...

Post has attachment
DBA Scenario 1: How to handle 100% CPU Utilization
Hi guys!
Today we shall discuss the hot topic how to handle 100% CPU Utilization. DBA
face this kind of situation often in their daily life. Some time it is must to
solve this situation in production environment as this will hamper the business
activity in ...
Wait while more posts are being loaded