以下のステートメントが機能しない理由が不思議です。
insert into #temp (ip, ping) values ('ip', exec xp_cmdshell 'ping ip')
1つの列にIPアドレスがあり、そのサーバーからpingを実行する結果セットを取得したいと思います。上記のクエリはエラーを返します:
Msg 156, Level 15, State 1, Line 1
Incorrect syntax near the keyword 'exec'.
Msg 102, Level 15, State 1, Line 1
Incorrect syntax near ')'.
説明をよろしくお願いします。