I am trying to create a stored procedure in SQL Server which will be used from C# Entity Framework.
My main focus is take a input of long string text then split that data by characters and return list of values of matching data.
In detail:
-
is separator between name of data type and its value:
is separator between Type and ASIN,
is separator between two different value
I want to get List of data filtered by ASIN
and Type
from this stored procedure. I am getting full text string in the @DataString
variable but I don't know how I can split my text and run SELECT
to return all of data.
Any idea to do it? Ask any question you may have.
Example of long text string:
Type-1:ASIN-NsQf8,ASIN-YhQfu,ASIN-dpQf9,ASIN-rsWf3
The unfinished SQL code:
CREATE PROCEDURE dbo.lk_GetMatchingDataOfThirdparty
@DataString VARCHAR(MAX)
AS
BEGIN
SET NOCOUNT ON;
SELECT *
FROM ThirdPartyData
WHERE ASIN = '@value_get_from_string'
AND Type = '@value_get_from_string'
END