This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| CREATE proc [dbo].[sp_MSforeachtable] | |
| @command1 nvarchar(2000), @replacechar nchar(1) = N'?', @command2 nvarchar(2000) = null, | |
| @command3 nvarchar(2000) = null, @whereand nvarchar(2000) = null, | |
| @precommand nvarchar(2000) = null, @postcommand nvarchar(2000) = null | |
| AS | |
| declare @mscat nvarchar(12) | |
| select @mscat = ltrim(str(convert(int, 0x0002))) | |
| if (@precommand is not null) | |
| exec(@precommand) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| SET ANSI_NULLS ON | |
| GO | |
| SET QUOTED_IDENTIFIER ON | |
| GO | |
| -- Note: * Does not use Welford's numerically stable one-pass. | |
| -- This should not be a problem in the majority of cases. | |
| -- | |
| -- Can be run for all tables' columns: | |
| -- exec dbo.CalculateSkewness NULL, NULL, NULL, 50, 0 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /***************************************************************************** | |
| MIT License, http://www.opensource.org/licenses/mit-license.php | |
| Contact: [email protected] | |
| Copyright (c) 2018 SQL Workbooks LLC | |
| Copyright (c) 2024 Mitch Wheat | |
| Permission is hereby granted, free of charge, to any person | |
| obtaining a copy of this software and associated documentation | |
| files (the "Software"), to deal in the Software without | |
| restriction, including without limitation the rights to use, | |
| copy, modify, merge, publish, distribute, sublicense, and/or |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| DECLARE @WorkingSQL VARCHAR(8000) | |
| ,@NewPath VARCHAR(8000) = 'G:\SQL Data\' /* Root location to move files */ | |
| ,@TargetDatabase sysname = '%'; /* Specify a singular database, or % for All Databases */ | |
| SET NOCOUNT ON; | |
| /* Enable xp_cmdshell */ | |
| EXEC sys.sp_configure 'Show Advanced Options', 1; | |
| RECONFIGURE; |