我正在尝试制作一个包含单个命令行输出的 txt 文件。但是由于某种原因,它不想将文本和测试名称添加到其中。这是我的代码:
declare @command AS varchar(200)
declare @cmd AS varchar(200)
declare @input AS varchar(200)
declare @timeinput AS varchar(200)
declare @test AS varchar(1000)
declare @failureid as int
select @timeinput = (select time from inserted)
select @input = (select action from inserted)
select @failureid = (select failureId from inserted)
select @test = (select name from dbo.Alert where FailureId = @failureid)
if (@input = 'start')
BEGIN
set @command = ('EnableTest' + @test)
END
if (@input = 'stop')
BEGIN
set @command = ('DisableTest' + @test)
END
if (@input = 'pauze')
set @command = ('PauseTest' + @test + @timeinput)
END
SET @cmd = 'echo ' + @command + ' > F:\commandfolder\testing.HMS'
EXECUTE Master.dbo.xp_CmdShell @cmd
HMS 文件中的输出是: DisableTest (with the testname missing) @test 没有添加到文件中。
据我所知,我的表格中的数据是正确的有什么想法吗?
在此先感谢和亲切的问候,
戴夫