I'm using the invoke.sql function and it's great, but now I have to JOIN two tables. I tried with :
$cmd = "SELECT [c.Field1],[c.Field2],[t.extrafield]
FROM [DBname].[lvl1].[ctablename] c
JOIN [DBname].[lvl1].[ttablename] t
ON [c.id] = [t.id]
WHERE c.field1 LIKE '%-X'"
invoke-sql $cmd $server $db # Values set and tested
The errormessage is not very helpfull - it says that my c. and t. column names are invalid. I have tried [] arround c and t same result.
What is wrong with my join ?
This Works :
$cmd = "SELECT TOP 1000 [Id],[Field1],[Field2]
FROM [DBname].[lvl1].[ctablename] WHERE Field1 LIKE '%-X'"
invoke-sql $cmd $server $db
I get Field1 and -2 where field1 ends with "-X"
Brgrds Kim
P.s.
function Invoke-SQL ($sqlCommand, $dataSource, $database){
$connectionString = "Data Source=$dataSource; " +
"Integrated Security=SSPI; " +
"Initial...