0

Suppose I have the following statement

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

This doesn't 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 I'm 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 doesn't work either

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

halfer
  • 19,824
  • 17
  • 99
  • 186
Cataster
  • 3,081
  • 5
  • 32
  • 79

1 Answers1

0

This is the right syntax:

SET [size] = '$($newSize.Size) $($newSize.Unit)'
Andronicus
  • 25,419
  • 17
  • 47
  • 88
Cataster
  • 3,081
  • 5
  • 32
  • 79