本文介紹了來自存儲過程結(jié)果集的 SQL Server 表定義的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學(xué)習(xí)吧!
問題描述
有人知道從存儲過程結(jié)果集創(chuàng)建表定義的方法嗎?
Is anyone aware of a way to create a table definition from a stored procedure result set?
我有一個存儲過程,它生成一個包含 30 多個列的結(jié)果集,我想將其放入一個表中,而無需手動創(chuàng)建所有表列.
I have a stored procedure which produces a result set with 30+ columns, I'd like to get this into a table without having to manually create all the table columns.
是否有內(nèi)置程序可以轉(zhuǎn)儲列名和類型..?
Is there a built in procedure that will dump out the column names and types..?
謝謝.
推薦答案
你可以"做到,但我不知道我是否會推薦它:
You "can" do it but I don't know if I'd recommend it:
EXEC sp_configure 'Show Advanced Options', 1
GO
RECONFIGURE
GO
EXEC sp_configure 'Ad Hoc Distributed Queries', 1
GO
RECONFIGURE
GO
SELECT
*
INTO
#table
FROM
OPENROWSET(
'SQLNCLI',
'SERVER=.;Trusted_Connection=yes',
'EXEC StoredProcedureName'
)
這篇關(guān)于來自存儲過程結(jié)果集的 SQL Server 表定義的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網(wǎng)!
【網(wǎng)站聲明】本站部分內(nèi)容來源于互聯(lián)網(wǎng),旨在幫助大家更快的解決問題,如果有圖片或者內(nèi)容侵犯了您的權(quán)益,請聯(lián)系我們刪除處理,感謝您的支持!