I have a dynamic store procedure and I would like to know if there are any performance issues while having an nvarchar with empty spaces.
Here is a code for demonstration of the question - in my store procedure I have many other operations that are not relevant and also the way I get the dynamic nvarchar is different.
DECLARE @Query NVARCHAR(255)
CREATE #LocationStatus
(
LocationStatusID INT NOT NULL,
StatusID INT
)
--First Option:
SET @Query = 'INSERT #LocationStatus
SELECT ID AS LocationStatusID,
StatusID
FROM dbo.CalculatedStatuses'
--Second Option
SET @Query = 'INSERT #LocationStatus SELECT ID AS LocationStatusID, StatusID FROM dbo.CalculatedStatuses'
EXEC (@Query)
Is there any performance issues between option 1 to option 2? (even if it is very little).
Thanks in advance :)