il faut du texte aussi ici pour expliquer le script
select * from table1
-- Change DB Owner, Compatibility Level and Page Verify | |
use master | |
go | |
declare @cmptlevel int | |
select @cmptlevel = compatibility_level from sys.databases where database_id = 1 | |
select 'ALTER DATABASE ['+name+'] SET COMPATIBILITY_LEVEL = ' + cast(@cmptlevel as varchar) + ';' | |
from sys.databases |
Function Copy-IfNotPresent { | |
<# | |
.SYNOPSIS | |
Copy file only if not present at destination. | |
.DESCRIPTION | |
This is a one file at a time call. It's not meant to replace complex call like ROBOCOPY. | |
Destination can be a file or folder. | |
If it's a folder, you can use -Container to force Folder creation when not exists. | |
If it's a file, you can provide a different name. | |
.LINK |
Find-DbaCommand | Select-Object -ExpandProperty Tags -Unique -ErrorAction SilentlyContinue | Sort-Object |
function Get-DbaMaintenanceSolutionVersion { | |
param( | |
$SqlInstance, | |
$Database = 'master' | |
) | |
$query = "select object_definition(object_id) as SQLtxt from $Database.sys.procedures where name = 'DatabaseIntegrityCheck'" | |
foreach ($sql in $SqlInstance) { | |
$sp = Get-DbaDbStoredProcedure -SqlInstance $sql -Database $Database -Name DatabaseIntegrityCheck | |
if ($sp) { | |
$version = if ($sp.TextBody -match '--// Version: ([\d-]+ [\d\:]+)') { |
# Powershell Functions for MS Access :) | |
# Here are several functions that cover tasks I tend to do most often in Access (hopefully more to come soon). These are mostly | |
# just wrappers around Access VBA methods, but this helps me avoid constant googling every time I need to do something in Access. | |
# example usage is provided at the bottom of the script | |
# Import CSV file into MS Access database | |
# office vba documentation: https://docs.microsoft.com/en-us/office/vba/api/access.docmd.transferspreadsheet | |
function Import-MsAccessCsv |
# Remove empty lines (raw text) | |
-replace '(?m)^(?:[\t ]*(?:\r?\n|\r))+' | |
# Add a GO line every 5000 lines (in a SQL script file) | |
-replace '((INSERT.*\r\n){5000})', "`$1GO`r`n" |