Posts Tagged ‘MsSQL’

Friends, I noticed that SQL Server does a case-insensitive string match in a query. Hence in scenarios where passwords are to be validated, using a query as “WHERE Password =@Password” will give valid results if the user enter password as “admin” or “ADMIN” eventhough when the password is set as “aDmiN”. In this post, we […]

Rename SQL Server Database Using TSQL Script

Posted: 27th October 2016 by admin in all
Tags: , , , ,

Using the below TSQL Script a Database Administrator can rename an existing SQL Server Database. USE [master] GO ALTER DATABASE [OLD_DB] SET SINGLE_USER WITH ROLLBACK IMMEDIATE GO ALTER DATABASE [OLD_DB] MODIFY NAME = NEW_DB GO ALTER DATABASE [NEW_DB] SET MULTI_USER GO

Here is MsSQL quere to shrink DB log file: For safity!!! DO BACKUP BEFORE Alter database invcenter SET RECOVERY SIMPLE; Go USE databasename; GO DBCC SHRINKFILE (logfilename); GO Alter database databasename SET RECOVERY FULL; Go