Я уже решил использовать цикл for и проходить текст за строкой ... Но когда я использую Invoke-Sqlcmd, я получаю это:
PS H:> $ MeasurementsOlderThanOneWeek = invoke-sqlcmd -Server"ms-sql-1264" -Database "ShellPlus" -Query "SELECT [OrderID], [MasterID], [FamilyName], [GivenName], [DateOfBirth], [AppointmentDateAndTime] FROM [ShellPlus]. [dbo]. [Запросы] LEFT JOIN [ShellPlus]. [Dbo]. [Patients] ON [ShellPlus] .dbo.Requests.PatientID = [ShellPlus] .dbo.Patients.InternalPatientID WHERE AppointmentDateAndTime
At line:2 char:13
+ "ShellPlus" -Query "SELECT [OrderID],[MasterID],[FamilyName],[GivenNa ...
+ ~~~~~~
Unexpected token '-Query' in expression or statement.
At line:2 char:20
+ ... llPlus" -Query "SELECT [OrderID],[MasterID],[FamilyName],[GivenName],
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Unexpected token '"SELECT [OrderID],[MasterID],[FamilyName],[GivenName],
[DateOfBirth],[AppointmentDateAndTime] FROM [ShellPlus].[dbo].[Requests] LEFT JOIN
[ShellPlus].[dbo].[Patients] ON [ShellPlus].dbo.Requests.PatientID =
[ShellPlus].dbo.Patients.InternalPatientID WHERE AppointmentDateAndTime <
dateadd(week,-1,getdate())"' in expression or statement.
+ CategoryInfo : ParserError: (:) [], ParentContainsErrorRecordException
+ FullyQualifiedErrorId : UnexpectedToken
С уважением, Thijs