SQLTeam.com | Weblogs | Forums

How to get GPNSignature that first part on it start by portion key?

I work on sql server 2012 I face issue i can't get
GPNSignature that have portionkey exactly
so if portion key is 100 then GPNSignature must start by 100
if portion key is 10 then GPNSignature must start by 10
so i need to get correct value

CREATE TABLE [dbo].[checkportions](
	[GPNSignatureID] [bigint] NOT NULL,
	[GroupId] [int] NULL,
	[PortionKey] [nvarchar](50) NOT NULL,
	[PortionId] [int] NOT NULL,
	[GpnSignatureOther] [bigint] NOT NULL,
	[GPNSignature] [nvarchar](38) NULL
) ON [PRIMARY]

GO
INSERT [dbo].[checkportions] ([GPNSignatureID], [GroupId], [PortionKey], [PortionId], [GpnSignatureOther], [GPNSignature]) VALUES (2313151, 1, N'10', 5384866, 2313151, N'100%N%J%')
INSERT [dbo].[checkportions] ([GPNSignatureID], [GroupId], [PortionKey], [PortionId], [GpnSignatureOther], [GPNSignature]) VALUES (2313151, 1, N'100', 5396955, 2313151, N'100%N%J%')

expected result i need

as image above this is correct

because portion key is 100 and gpnsignature start by 100

and portion key 10 and gpnsignature start by 100 so it is wrong

so How to do that please

Something like where GPNSignature like PortionKey + '%'

thanks solved