I have a very simple SQL Stored Procedure to get a field from a table. I want to run the stored procedure from a batch file and get the field to a batch variable
create procedure dbo.sp_SelectCustomerCode @ipOrderNo NVARCHAR(50), @outputData Nvarchar(30) output
as
begin
select @outputData = CustomerCode from OrderHeader
where OrderNo = @ipOrderNo
end
I want the Batch File is something like that
sqlcmd -S Server123 -b -d DataBase -U XXXX -P YYYY -Q "EXEC dbo.sp_SelectCustomerCode '10001', @ipOrderNo out " > Test.log
@echo @ipOrderNo
Is it possible to do that? Thank you very much