I would like to change all the values in the column "name" to UPPER case (which is part of the d.* table in the below query):
SELECT d.*, i.*, o.*, scv.* FROM devices..
I'm not sure how to do that correctly without explicitly entering every single column in d.*.
The best I can do is run the query below in PowerShell, then remove column d.name like this:
$mycommand.CommandText = "SELECT UPPER(d.name), d.*, i.*, o.*, scv.* FROM devices..."
if ($DevicesDataTable.Columns.Caption -eq 'name') {$DevicesDataTable.Columns.Remove('name')}
$DevicesDataTable.Columns["UPPER(d.name)"].ColumnName = "name"
The first line from the code above will ultimately create 2 columns...
UPPER(d.name)andnamein the dataset. The first column has all the new uppercase values, the second column is the original (duplicate) column with lower case values.UPPER(d.name)is the name PowerShell creates when processing the UPPER function in the query.The second line removes the original column
name.The 3rd line renames
UPPER(d.name)back toname.
What is the best way to do this without explicitly SELECT'ing every single column from the d table? It's not feasible for me to do this since new columns get added to the table pretty regularly; and, I don't want to constantly change my PowerShell script. Surely there has to be an easy way to handle this.