Skip to content
Advertisement

Simplify SQL query with string as array parameters

I’m trying to find a way to simplify my stored procedure. When I try to query using single parameter it went well but when using array, the retrieval process took so long. Any idea how will I simplify this?

Someone suggested to me to put StringAsArray into temp table but I don’t know exactly what they’re trying to suggest. Any help would be very much appreciated. Thank you.

Advertisement

Answer

So with the definition of the TESTDB.StringArray as TABLE ([StringValue] varchar(15)) clarified we can look at the table joins.

Your parameter is in fact already a table. As @Charlieface mentions in the comments, I’ll assume that you already have used TRIM on the values to populate the parameter before calling the Stored Procedure.

I was unable to infer which table the column sapcode came from so I have not aliased it. Likewise for the platform column in the LEFT OUTER JOIN TEST.TESTSU.programs_season condition.

User contributions licensed under: CC BY-SA
3 People found this is helpful
Advertisement