How can I retrieve the value from the following dynamic SQL and assign it to a variable?
SET @SQLString = N'SELECT TOP 1 D'+CAST(DAY(@dateTime)AS varchar(MAX))
+ ' FROM TabelForMonthCurrent'
+ ' WHERE empContractID=' + CAST(@pEmpContractID AS nvarchar(MAX))
+ ' AND Year=' + CAST(YEAR(@dateTime) AS nvarchar(MAX))
+ ' AND Month=' + CAST(MONTH(@dateTime) AS nvarchar(MAX))