[HELP] Invoke-Sqlcmd

Hey all,

I’m having an issue getting my command the way I desire.

The working command I am using is as follows: ‘SELECT [Document Type], Type, [Document No_], No_, Description FROM dbo.[company.here] WHERE [Document Type] = 1 AND Type = 2 AND [Document No_] = ‘WSO-0108111’’

I need to have the command have it like this the followng but I don’t know how to get it to work with a variable:

The working command I am using is as follows: ‘SELECT [Document Type], Type, [Document No_], No_, Description FROM dbo.[company.here] WHERE [Document Type] = 1 AND Type = 2 AND [Document No_] = ‘$wso’’

$wso = Whatever the user inputs.

In order for the command to properly work, it needs to be surrounded by the quotes ‘$wso’’

"'SELECT [Document Type], Type, [Document No_], No_, Description FROM dbo.[company.here] WHERE [Document Type] = 1 AND Type = 2 AND [Document No_] = '$wso"""
... looks weird for me, but if it's this you want it should work actually.

BTW: Do yourself and us a favor and format your code as code here in the forum, thanks