erreor in insert value from Get-DbaDbBackupHistory

  • abdalah.mehdoini

    SSC Eights!

    Points: 873

    Good morning all ,

    I need to trace the history of all the backup sql of all my servers

    for this I use the command dbatools

    Get-DbaDbBackupHistory

    attached my powershell script

    $sqlservers ="DESKTOP-95KKMMH","DESKTOP-95KKMMH\production"
    $serveur="DESKTOP-95KKMMH"
    $database="msdb"
    foreach($sqlserver in $sqlservers)
    {
    $history=Get-DbaDbBackupHistory -SqlInstance $sqlserver
    $history | Select-Object -Property SqlInstance , Database,Type,TotalSize,DeviceType,Start,Duration,End |
    Write-SqlTableData -DatabaseName msdb -TableName History_backup -ServerInstance "DESKTOP-95KKMMH" -SchemaName "dbo"
    }

    the history table is as follows

    CREATE TABLE [dbo].[History_backup](
    [SqlInstance] [varchar](50) NULL,
    [databasename] [varchar](20) NULL,
    [type] [varchar](10) NULL,
    [Total_size] [nvarchar](10) NULL,
    [devicetype] [varchar](10) NULL,
    [start] [datetime2](7) NULL,
    [duration] [varchar](10) NULL,
    [end_backup] [datetime2](7) NULL
    ) ON [PRIMARY]
    GO

    the problem appears during the insertion of the two columns TotalSize, and Duration

    Who has an idea on the root cause of the problem

    Sans titre

    Attachments:
    You must be logged in to view attached files.
  • Site Owners

    SSC Guru

    Points: 80378

    Thanks for posting your issue and hopefully someone will answer soon.

    This is an automated bump to increase visibility of your question.

Viewing 2 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic. Login to reply