sql server - UDF - Return a table from a custom sql string execution with "Exec 'select * from ....' " -


How can I return a table from a UDF that executes a custom query string? Example:

  function FX_AdvancedSearch (
@keywords varchar (255), (..... other paramours ....)) Start as Reset Table @ SQL Entry Varchar (1000) ..... SET @SqlQuery = 'My favorite selection string first generated' EXEC (@SqlQuery)

END < / Code>

I was thinking that I can make a temporary one in the memory table and then return it, but I do not want to allocate additional memory to the server for this purpose.

And .. Can I use SP or UDF to fulfill this goal? I am running this in a SP but can not determine the Linq2SQL return type and so I have to properly execute this function myself. Can not use in NET code.

Thank you! TER

Erland has documented many different ways to accomplish this (but the function's Along with, as someone else has not already been told), see: ... also may need to read your two dynamic SQL articles.


Comments

Popular posts from this blog

asp.net - Javascript/DOM Why is does my form not support submit()? -

sockets - Delphi: TTcpServer, connection reset when reading -

javascript - Classic ASP "ExecuteGlobal" statement acting differently on two servers -