有关如何使用从SQL数据库中的PowerShell显示表内容的问题
我正在写一个脚本的目的是从sql数据库中获取运行complie进程的一些信息。 如果我在sql server中作为查询运行下面的行 SELECT Stage.Description as StageDesc,Stage.StageStatusId FROM [Build].[dbo].[WorkflowInstance_View] as Build join [Build].[dbo].[Stage_View] as Stage on Build.Id=Stage.[WorkflowInstanceId]where Stage.ParentId is null and Stage.StageStatusId <>4 and Stage.StageStatusId <>7 order by Build.Id desc 我可以得到这样的表结果,其中的内容XML信息。 : 现在,这是我的代码由powershell,我的目标是获得XML部分: $connection= new-object system.data.sqlclient.sqlconnection $Connection.ConnectionString ="server=SQLShare;database=Build;trusted_connection=True" $connection.open() $SqlCmd = New-Object System.Data.SqlClient.SqlCommand $SqlQuery = "SELECT Stage.Description as StageDesc,Stage.StageStatusId FROM [Build].[dbo].[WorkflowInstance_View] as Build join [Build].[dbo].[Stage_View] […]