Carl Jung quote: “What you resist not only persists but will grow in size.”
Copyright
Related Posts
- Get Column Creation Datatype for Declaration
March 13, 2018
This is quick way to get a string containing the sql datatype required for a column declaration, a create table, a print variables, or convert data to XML and XML to data, based on temp table and column information. How to use: 1. Create your select statement 2. Define if you use or not prefix - you have prefix to...
- How to Print VARCHAR(MAX) Using Print Statement?
March 7, 2018
SSMS default maximum number of characters displayed in each column is 256. You can change this option on: Option/Query Results/SQL Server/Results to Text but, the maximum value is 8192 characters. This is a solution when you need to print more that 8192 characters: 1use master; 2go 3drop proc if exists sp_Print; 4go...
- Rebuild All Indexes for All Tables and All Databases
February 21, 2018
Maintain database indexes You can just create script or run right now the reindex. Verify the configuration to filter databases or to change the FILLFACTOR. 1 2PRINT '-- ***************************************** --' 3PRINT '-- Reindex all tables' 4PRINT '-- on selected databases' 5PRINT '--...
- Create Backup Operator
February 18, 2018
Create backup operator login 1 2PRINT '-- Create backup operator login' 3 4DECLARE @loginName as NVARCHAR(256) = N'UserDbBackupOperator' 5DECLARE @password as nvarchar(128) = N'MyDbBackupStrongPassword' 6 7DECLARE @sql AS NVARCHAR(MAX) 8If not Exists (select loginname from master.dbo.syslogins where name = @loginName )...
- Get List of Linked Servers and Associated Logins
January 23, 2018
Script to get Linked server list. We have repeated linked server name if it has more than one associated remote login. 1 2SELECT @@SERVERNAME AS 'Server Name' 3, sys.servers.server_id AS 'IdLinkedServer' 4, sys.servers.name AS 'Linked Server Name' 5, CASE sys.servers.Server_id WHEN 0 THEN 'Current Server' 6 ELSE...
Comments