Replace the data set with the storage process

xiaoxiao2021-03-06  39

Http://expert.9cbs.net/expert/topic/3016/3016902.xml?temp=.9715082

Problem proposing: ghosthjt (Tianzhishi Solitary)

Solution: yang_ (sailing), J9988 (J9988)

If it is convenient to get the table structure of the stored procedure result set. The use of the memory process is much convenient. such as:

INSERT INTO #TMP EXEC SP_WHO

To perform this sentence, the premise must know the table structure of the result set of sp_who.

Such a statement cannot be running: SELECT * INTO #TMP from EXEC SP_WHO

answer:

1:

Select * into # z from OpenRowSet

'Sqloledb',

'Server = server; uid = sa; pwd = sapwd; database = master', 'exec sp_who') AS A

2: If you use a temporary table during the store, use set fmtonly off

Select * into # z from OpenRowSet

'Sqloledb',

'Server = server; uid = sa; pwd = sapwd; database = master', 'set fmtonly off; exec storage process name') AS A

转载请注明原文地址:https://www.9cbs.com/read-68923.html

New Post(0)