@@ -119,88 +119,90 @@ function New-DbaSqlParameter {
119
119
[string ]$SourceVersion ,
120
120
[ValidateSet (" BigInt" , " Binary" , " Bit" , " Char" , " DateTime" , " Decimal" , " Float" , " Image" , " Int" , " Money" , " NChar" , " NText" , " NVarChar" , " Real" , " UniqueIdentifier" , " SmallDateTime" , " SmallInt" , " SmallMoney" , " Text" , " Timestamp" , " TinyInt" , " VarBinary" , " VarChar" , " Variant" , " Xml" , " Udt" , " Structured" , " Date" , " Time" , " DateTime2" , " DateTimeOffset" )]
121
121
[string ]$SqlDbType ,
122
- [string ]$SqlValue ,
122
+ [object ]$SqlValue ,
123
123
[string ]$TypeName ,
124
124
[string ]$UdtTypeName ,
125
125
[object ]$Value ,
126
126
[switch ]$EnableException
127
127
)
128
+
128
129
$param = New-Object Microsoft.Data.SqlClient.SqlParameter
129
130
130
131
try {
131
- if ($PSBoundParameters.CompareInfo ) {
132
+
133
+ if (Test-Bound - ParameterName CompareInfo) {
132
134
$param.CompareInfo = $CompareInfo
133
135
}
134
136
135
- if ($PSBoundParameters . DbType ) {
137
+ if (Test-Bound - ParameterName DbType) {
136
138
$param.DbType = $DbType
137
139
}
138
140
139
- if ($PSBoundParameters . Direction ) {
141
+ if (Test-Bound - ParameterName Direction) {
140
142
$param.Direction = $Direction
141
143
}
142
144
143
- if ($PSBoundParameters . ForceColumnEncryption ) {
145
+ if (Test-Bound - ParameterName ForceColumnEncryption) {
144
146
$param.ForceColumnEncryption = $ForceColumnEncryption
145
147
}
146
148
147
- if ($PSBoundParameters . IsNullable ) {
149
+ if (Test-Bound - ParameterName IsNullable) {
148
150
$param.IsNullable = $IsNullable
149
151
}
150
152
151
- if ($PSBoundParameters . LocaleId ) {
153
+ if (Test-Bound - ParameterName LocaleId) {
152
154
$param.LocaleId = $LocaleId
153
155
}
154
156
155
- if ($PSBoundParameters . Offset ) {
157
+ if (Test-Bound - ParameterName Offset) {
156
158
$param.Offset = $Offset
157
159
}
158
160
159
- if ($PSBoundParameters . ParameterName ) {
161
+ if (Test-Bound - ParameterName ParameterName) {
160
162
$param.ParameterName = $ParameterName
161
163
}
162
164
163
- if ($PSBoundParameters . Precision ) {
165
+ if (Test-Bound - ParameterName Precision) {
164
166
$param.Precision = $Precision
165
167
}
166
168
167
- if ($PSBoundParameters . Scale ) {
169
+ if (Test-Bound - ParameterName Scale) {
168
170
$param.Scale = $Scale
169
171
}
170
172
171
- if ($PSBoundParameters . Size ) {
173
+ if (Test-Bound - ParameterName Size) {
172
174
$param.Size = $Size
173
175
}
174
176
175
- if ($PSBoundParameters . SourceColumn ) {
177
+ if (Test-Bound - ParameterName SourceColumn) {
176
178
$param.SourceColumn = $SourceColumn
177
179
}
178
180
179
- if ($PSBoundParameters . SourceColumnNullMapping ) {
181
+ if (Test-Bound - ParameterName SourceColumnNullMapping) {
180
182
$param.SourceColumnNullMapping = $SourceColumnNullMapping
181
183
}
182
184
183
- if ($PSBoundParameters . SourceVersion ) {
185
+ if (Test-Bound - ParameterName SourceVersion) {
184
186
$param.SourceVersion = $SourceVersion
185
187
}
186
188
187
- if ($PSBoundParameters . SqlDbType ) {
189
+ if (Test-Bound - ParameterName SqlDbType) {
188
190
$param.SqlDbType = $SqlDbType
189
191
}
190
192
191
- if ($PSBoundParameters . SqlValue ) {
193
+ if (Test-Bound - ParameterName SqlValue) {
192
194
$param.SqlValue = $SqlValue
193
195
}
194
196
195
- if ($PSBoundParameters . TypeName ) {
197
+ if (Test-Bound - ParameterName TypeName) {
196
198
$param.TypeName = $TypeName
197
199
}
198
200
199
- if ($PSBoundParameters . UdtTypeName ) {
201
+ if (Test-Bound - ParameterName UdtTypeName) {
200
202
$param.UdtTypeName = $UdtTypeName
201
203
}
202
204
203
- if ($PSBoundParameters . Value ) {
205
+ if (Test-Bound - ParameterName Value) {
204
206
$param.Value = $Value
205
207
}
206
208
$param
0 commit comments