erreor in insert value from Get-DbaDbBackupHistory

  • 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


    attached my powershell script

    $sqlservers ="DESKTOP-95KKMMH","DESKTOP-95KKMMH\production"
    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]

    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

    You must be logged in to view attached files.
  • 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 1 (of 1 total)

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