0

suppose i have the following statement

Invoke-Sqlcmd -Query "UPDATE [$Table]
SET [size] = '$newSize.Size $newSize.Unit'
WHERE [cname] = '$cube'" -ConnectionString $CS

this doesnt work and throws the following error:

Invoke-Sqlcmd : String or binary data would be truncated. The statement has been terminated.

in the table, i see this in the field:

@{Size=919.8; Unit=MB}.Size

this is because im setting two variables in one statement, but what is the proper syntax for that?

i am trying to store the following value: 919.8 MB

i tried this: '$estimatedSize.Size','$estimatedSize.Unit'

but it doesnt work either

more info related to this thread: https://stackoverflow.com/a/57531267/8397835

Cataster
  • 2,521
  • 2
  • 15
  • 48

1 Answers1

0

This is the right syntax:

SET [size] = '$($newSize.Size) $($newSize.Unit)'
Andronicus
  • 24,333
  • 17
  • 47
  • 82
Cataster
  • 2,521
  • 2
  • 15
  • 48