This file contains 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 TABLE myTable (col1 varchar(2)) | |
INSERT INTO myTable ('ts'); | |
GO |
This file contains 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
$os = Get-ItemProperty 'HKLM:\Software\Microsoft\Windows NT\CurrentVersion' -ErrorVariable $osinfoError | |
$osInfoData = [pscustomobject]@{ | |
"ProductName" = $os.ProductName; | |
"Version Number" = $os.CurrentVersion | |
}; | |
This file contains 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
#region Links | |
<# | |
NOTE: Links are subject to change by Microsoft | |
Server Configuration Options BOL: | |
SQL Server 2014 - http://technet.microsoft.com/en-us/library/ms189631(v=sql.120).aspx | |
SQL Server 2012 - http://technet.microsoft.com/en-us/library/ms189631(v=sql.110).aspx | |
SQL Server 2008 R2 - http://technet.microsoft.com/en-us/library/ms189631(v=sql.105).aspx | |
SQL Server 2008 - http://technet.microsoft.com/en-us/library/ms189631(v=sql.100).aspx | |
SQL Server 2005 - http://technet.microsoft.com/en-us/library/ms189631(v=sql.90).aspx | |
SQL Server 2000 - http://technet.microsoft.com/en-us/library/aa196706(v=sql.80).aspx |
This file contains 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
;WITH xDeadlock (Contents) | |
AS | |
( | |
select CAST(XEventData.XEvent.value('(data/value)[1]', 'varchar(max)') as xml) as DeadlockGraph | |
FROM | |
(select CAST(target_data as xml) as TargetData | |
from sys.dm_xe_session_targets st | |
join sys.dm_xe_sessions s on s.address = st.event_session_address | |
where name = 'system_health') AS Data | |
CROSS APPLY TargetData.nodes ('RingBufferTarget/event[@name="xml_deadlock_report"]') AS XEventData (XEvent) |
This file contains 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
//playing with color settings | |
"workbench.colorCustomizations": { | |
"activityBar.background": "#F0EBD7", | |
"activityBar.foreground": "#C9A735", | |
"activityBarBadge.foreground": "#3F3C3D", | |
"activityBarBadge.background": "#FFFFFF", | |
"panel.background": "#F3F7F2", | |
"statusBar.background": "#BFB297", | |
"statusBar.foreground": "#FFFFFF", | |
"sideBar.background": "#383636", |
This file contains 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
<# | |
.SYNOPISIS | |
Generate an HTML view that will open in an editor for VS Code | |
.NOTES | |
Add this to your Microsoft.VSCode_profile.ps1 file | |
.EXAMPLE | |
$results = Get-DbaSpConfigure -SqlInstance manatarms | |
Out-CodeView $results | |
#> | |
function Out-CodeView { |
This file contains 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
param( | |
[string]$OwnerValue = 'melton', | |
[switch]$Raw | |
) | |
$myEc2Instances = Get-EC2Tag -Filter @{ Name="key"; Values="owner" },@{ Name="value";Values=$OwnerValue}, @{ Name="resource-type";Values="instance"} | |
$data = Get-EC2Instance -InstanceId $myEc2Instances.ResourceId | Select-Object -ExpandProperty Instances | |
if ($Raw) { | |
foreach ($d in $data) { | |
$value = ($d.Tags | Where-Object Key -eq Name).Value |
This file contains 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
{ | |
"New SQL Login": { | |
"prefix": "new-sql-login", | |
"body": [ | |
"CREATE LOGIN [${1:name of the login}] WITH PASSWORD = N'${2:password value}', CHECK_EXPIRATION = OFF, CHECK_POLICY = OFF;", | |
], | |
"description": "Create a new SQL Login" | |
}, | |
"New Windows Login": { | |
"prefix": "new-windows-login", |
This file contains 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 NOCOUNT ON; | |
SELECT distinct t1.name AS 'DatabaseName' | |
,(datediff( ss, t3.backup_start_date, t3.backup_finish_date)) AS 'DurationInSeconds' | |
,t3.user_name AS 'UserResponsible' | |
,t3.name AS backup_name | |
,t3.description | |
,t3.backup_start_date | |
,t3.backup_finish_date | |
,CASE |
This file contains 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
// Place your key bindings in this file to overwrite the defaults | |
[ | |
{ | |
"key": "alt+up", | |
"command": "workbench.action.navigateUp" | |
}, | |
{ | |
"key": "alt+down", | |
"command": "workbench.action.navigateDown" | |
}, |
OlderNewer