I am writing a Silverlight client that interacts with an SQL database via ASP.NET 2.0 web services, which I am also developing. One of the services needs to return the results of a stored procedure and it works well. However, one parameter of the stored procedure needs to be retrieved from a different location before the stored procedure can be executed and this additional request to the database causes an obvious slowdown (evident when I cache the retrieved value rather than obtaining it every call).
Unfortunately, caching the value isn't valid for my situation and I'd rather combine the retrieval of this value and the subsequent stored procedure execution into a single query so that the the server can optimise the request. However, my SQL is not strong and I haven't the faintest idea how I go about this.
The value, let's call it tasktype
, is referenced via a single key, id
. The stored procedure, getrecords
, takes a few arguments including tasktype
, but it can be assumed that the other argument values are known at the time of calling the query. The stored procedure returns a table of records.
Thanks for any help.