I use a similar command below to insert into a temp table the result of a large command line call to an exectable with many parameters passed in the command of which the result passed back contains many items. I then parse the response string to get my results...
set @.command = 'dir'
insert into tsverisign(response) exec master..xp_cmdshell @.command
My question is our can I insert two values at the same time to this same table one of which is my "exec master..xp_cmdshell @.command"
similar to insert into tables (field_a, feild_b) values ('1','2')
Something like (and I know this does not work):
insert into tsverisign(response,trans_id)
values (exec master..xp_cmdshell @.command, '123')
Any help would be greatly appreciated ... PS I'm new to MS SQL 2000 and proper syntax etc. etc. so I need full example so I can try. :rolleyes:What you're trying to do is not possible (in any dbms). What you should do is to dump the result of @.command into a staging table. Then insert it into the target table.
e.g.
insert into staging(i)
exec master..xp_cmdshell @.command
insert into target(i,j)
select i, @.other_val
from staging
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment