Passing and taking out values from Open Query
DECLARE @TSQL nvarchar(1000), @VAR varchar(50)
--Formate Date and year like CDR201106
SELECT @VAR = 'CDR' + convert(varchar(4),YEAR(getdate())) + left('000', 2- len(month(getdate()))) + CONVERT(varchar(2),month(getdate()))
SELECT @TSQL = 'SELECT @RepCount= [rows] FROM OPENQUERY([LEB-ODSREP01],''SET FMTONLY OFF EXECUTE DEUView.dbo.SP_SPACEUSED ''''' + @VAR + ''''''')'
EXEC sp_executesql @TSQL, N'@RepCount int out' , @RepCount out
select @ODSCount,@RepCount