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
| "cSpell.enableCompoundWords":true, | |
| "cSpell.userWords": [ | |
| "MSSQL", | |
| "Chrissy", | |
| "gmail", | |
| "cmdlet", | |
| "Maire", | |
| "clemaire", | |
| "dbatools", | |
| "computername", |
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
| $Prod = Get-DbaSpConfigure -SqlInstance PROD -SqlCredential (get-credential -Message "Prod" -UserName MySQLLogin); | |
| $Test1 = Get-DbaSpConfigure -SqlInstance Test1; | |
| Compare-Object -ReferenceObject $Test1 -DifferenceObject $Prod -property ConfigName,RunningValue|Sort-Object ConfigName; | |
| ConfigName RunningValue SideIndicator | |
| ---------- ------------ ------------- | |
| MaxDegreeOfParallelism 6 => | |
| MaxDegreeOfParallelism 4 <= | |
| MaxServerMemory 563200 => | |
| MaxServerMemory 25600 <= |
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
| C:\...\_Projects\Server Config>compare-object $Test1 $Prod | |
| C:\...\_Projects\Server Config> |
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
| Compare-Object -ReferenceObject (Get-DbaSpConfigure -SqlInstance Test1;) -DifferenceObject (Get-DbaSpConfigure -SqlInstance PROD -SqlCredential (get-credential -Message "Prod" -UserName MySQLLogin)) -property ConfigName,RunningValue | Sort-Object ConfigName; |
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
| import-module dbatools; | |
| start-transcript; | |
| $VerbosePreference = "Continue"; | |
| $WhatIfPreference = $False; | |
| $SrcSQLInstance = 'SOURCE\INSTNAME' | |
| $DestSQLInstance = "DEST\INSTNAME"; | |
| Get-DbaAgentJob -ServerInstance $DestSQLInstance | Foreach-object {Remove-DbaAgentJob -serverinstance $psitem.sqlinstance -job $psitem} | |
| get-dbaagentschedule -serverinstance $DestSQLInstance | foreach-object {remove-dbaagentschedule -ServerInstance $DestSQLInstance -schedule $PSItem} | |
| get-dbadatabase -serverinstance $DestSQLInstance | remove-dbadatabase; | |
| Copy-DbaLogin -source $SrcSQLInstance -destination $DestSQLInstance -ExcludeLogin 'DOMAIN\User1','DOMAIN\User2','User3'; |
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
| import-csv './FILENAME.csv' -Header URI,Type,Date|select-object -Unique -Property uri |foreach-object {invoke-webrequest $PSItem.uri} |
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
| import-module dbatools,importexcel; | |
| $DBServer = 'MYSERVER'; | |
| $TableList = Get-Content TableList.txt; | |
| $Tables = Get-DbaTable -ServerInstance $DBServer -Database Satellites -Table $TableList; | |
| foreach ($Table in $Tables) { | |
| $Columns = $Table.columns | Select-Object Name,DataType,Nullable,@{name='Length';expression={$_.Properties["Length"].Value}}; | |
| $Columns | Export-Excel -Path C:\Users\andy\Documents\TableInfo.xlsx -WorkSheetname $Table.Name -FreezeTopRow -BoldTopRow; | |
| } |
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
| Get-Content TableList.txt | Foreach-Object {Get-DbaTable -ServerInstance MYSERVER -Database satellites -Table $PSItem | ForEach-Object {$PSItem.Columns | Select-Object Name,DataType,Nullable,@{name='Length';expression={$_.Properties["Length"].Value}} | Export-Excel -Path C:\Users\andy\Documents\TableInfo2.xlsx -WorkSheetname $PSItem.Name -FreezeTopRow -BoldTopRow}} |
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
| USE Demo; | |
| SET NOCOUNT ON; | |
| SET STATISTICS TIME, IO OFF; | |
| /* Just to prove there's no shenanigans */ | |
| DBCC FREEPROCCACHE; | |
| DBCC DROPCLEANBUFFERS; | |
| GO | |
| DROP TABLE IF EXISTS triggertest; | |
| DROP TABLE IF EXISTS defaulttest; | |
| CREATE TABLE triggertest |
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
| insert into triggertest(Home,Away,LastModified) values(14,17,'2008-02-03 22:05:00 -05:00'); | |
| select * from triggertest; | |
| insert into defaulttest(Home,Away,LastModified) values(14,17,'2008-02-03 22:05:00 -05:00'); | |
| select * from defaulttest; |
OlderNewer