It doesn't make any difference.
You need to look elsewhere for the source of your problem (perhaps the column has a case sensitive collation for example).
Trailing white space is only significant to SQL Server in LIKE
comparisons, not =
comparisons as documented here.
SQL Server follows the ANSI/ISO SQL-92 specification (Section 8.2, , General rules #3) on how to compare strings with spaces. The ANSI standard requires padding for the character strings used in comparisons so that their lengths match before comparing them. The padding directly affects the semantics of WHERE and HAVING clause predicates and other Transact-SQL string comparisons. For example, Transact-SQL considers the strings 'abc' and 'abc ' to be equivalent for most comparison operations.
The only exception to this rule is the LIKE predicate...
You can also easily see this by running the below.
USE tempdb;
CREATE TABLE [dbo].[Dim_SomeDimensionTable] (
[SurrogateKey] [int] IDENTITY(1,1) NOT NULL,
[NaturalKey] [nvarchar](128) NOT NULL,
[SomeInt] [smallint] NOT NULL
)
INSERT INTO [dbo].[Dim_SomeDimensionTable] VALUES ('VALUE',8)
exec sp_executesql N'
select *
from (
SELECT SurrogateKey, NaturalKey, SomeInt
FROM Dim_SomeDimensionTable
) [refTable]
where [refTable].[NaturalKey] = @P1
and [refTable].[SomeInt] = @P2'
,N'@P1 nchar(128)
,@P2 smallint'
,N'VALUE '
,8
Which returns the single row