ALT+V, E, S - Launch Source Control Explorer
ALT+V, E, H - Show Pending Changes
CTRL+T, CTRL+H Show History
Once in Source Control Explorer
Renaming a db fails in MSSQL as it is not in single user mode by default and hence exclusive lock cannot be obtained. Use the following script to put the DB in single user mode -> rename it and then restore it to multiuser mode.
USE master
ALTER DATABASE [Original DB Name] SET SINGLE_USER WITH ROLLBACK IMMEDIATE
ALTER DATABASE [Original DB Name] MODIFY NAME = [Renamed DB Name]
-- Run this against the database from which you want the row counts | |
-- Ref https://msdn.microsoft.com/en-us/library/ms190324.aspx | |
SELECT | |
QUOTENAME(SCHEMA_NAME(sysObjects.schema_id)) + '.' + QUOTENAME(sysObjects.name) AS [Table] | |
, SUM(sysPartitions.Rows) AS [Rows] | |
FROM | |
sys.objects AS sysObjects | |
INNER JOIN sys.partitions AS sysPartitions | |
ON sysObjects.object_id = sysPartitions.object_id | |
WHERE |
-- Convert Down Level Logon format e.g. domain\username to User Prindipal Name (UPN) format [email protected] | |
-- The formats are explained here https://msdn.microsoft.com/en-us/library/windows/desktop/aa380525(v=vs.85).aspx | |
IF OBJECT_ID (N'[dbo].[uFnGetDomainAtFromDomainSlash]', N'FN') IS NOT NULL | |
DROP FUNCTION uFnGetDomainAtFromDomainSlash; | |
GO | |
CREATE FUNCTION [dbo].[uFnGetDomainAtFromDomainSlash](@AccountNameWithDomainSlash VARCHAR(MAX), @DomainExtension VARCHAR(MAX)) | |
RETURNS VARCHAR(MAX) | |
AS | |
BEGIN | |
DECLARE @AccountName VARCHAR(MAX), |
-- VARCHAR TO Base64 | |
IF OBJECT_ID (N'[dbo].[uFnStringToBase64]', N'FN') IS NOT NULL | |
DROP FUNCTION uFnStringToBase64; | |
GO | |
CREATE FUNCTION [dbo].[uFnStringToBase64] | |
( | |
@InputString VARCHAR(MAX) | |
) | |
RETURNS VARCHAR(MAX) | |
AS |
Add-AzureRmAccount | |
Set-AzureRmContext -SubscriptionId '<Enter SubscriptionId here only if you have more than one subscriptions for the same email address/identity>' | |
$firewallRuleName = '<firewalll rule to remove/update if it already exists>' | |
$serverName = '<Database Server name for which rule is to be added>' | |
$resourceGroupName = '<Resource group of database server>' | |
$myIp = (Invoke-WebRequest ifconfig.me/ip).Content.Trim() | |
Write-Host 'Creating firewalll rule for ip',$myIp | |
Remove-AzureRmSqlServerFirewallRule -FirewallRuleName $firewallRuleName -ResourceGroupName $resourceGroupName -ServerName $serverName -WarningAction Continue -Force -ErrorAction Continue | |
New-AzureRmSqlServerFirewallRule -ResourceGroupName $resourceGroupName -ServerName $serverName -FirewallRuleName $firewallRuleName -StartIpAddress $myIp -EndIpAddress $myIp |
SELECT t.name as TableName, s.row_count as NumberofRows from sys.tables t | |
JOIN sys.dm_db_partition_stats s | |
ON t.object_id = s.object_id | |
AND t.type_desc = 'USER_TABLE' | |
AND t.name not like '%dss%' | |
AND s.index_id IN (0,1) |
class SPThumbnailPathGenerator { | |
_SPThumbnailPath: string; | |
constructor(path: string) { | |
this._SPThumbnailPath = path; | |
} | |
SPThumbnailPath_W () | |
{ | |
let imgPath = this._SPThumbnailPath; | |
let pathWithOutFileName = imgPath.substring(0, imgPath.lastIndexOf("/") + 1); |
$Password= -join ((33..63) + (65..90) + (97..122) | Get-Random -Count 12 | % {[char]$_}) | ConvertTo-SecureString -AsPlainText -Force |