I'm trying to call a system command within a procedure that also carries parameters. I get the following error:
Procedure expects parameter 'command_string' of type 'varchar'
Code:
ALTER PROCEDURE [dbo].[AddMSTRUser]
@LoginID nvarchar(120),
@Country nvarchar(120),
@FullName nvarchar(120)
AS
DECLARE @cmd varchar(max);
SET @cmd = CONCAT('MASysMgr.exe -w C:\User.smw -l "C:\cache.txt" -p "LoginID=' , @LoginID , '" "Country=',@Country,'" "FullName=',@FullName,'"')
EXECUTE master..xp_cmdshell @cmd;
This is how I call it:
EXEC AddMSTRUser @LoginID = 'Ugurcan.Kaya', @Country = 'VHQ', @FullName = 'Ugurcan Kaya'