久久久久久久av_日韩在线中文_看一级毛片视频_日本精品二区_成人深夜福利视频_武道仙尊动漫在线观看

SQL Server 2008:多語句 UDF 能否返回 UDT?

SQL Server 2008: Can a multi-statement UDF return a UDT?(SQL Server 2008:多語句 UDF 能否返回 UDT?)
本文介紹了SQL Server 2008:多語句 UDF 能否返回 UDT?的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學習吧!

問題描述

多語句 UDF 是否有可能返回用戶定義的表類型,而不是在其返回參數中定義的表?

Is it possible that a multi-statement UDF return a User Defined Table Type, instead of a table that is defined within it's return param?

所以代替:

CREATE FUNCTION MyFunc 
(
    @p1 int, @p2 char
)
RETURNS 
@SomeVar TABLE 
(
    c1 int
)
AS

我想做:

CREATE FUNCTION MyFunc 
(
    @p1 int, @p2 char
)
RETURNS 
@SomeVar MyTableType
AS

這樣做的原因是我的函數內部調用了其他函數,必須傳入MyTableType UDT,即使我在RETURN表類型中定義了完全相同的表定義,也會拋出操作數沖突錯誤.

The reason for this is that inside my function I call other functions and have to pass in MyTableType UDT, even if I define exactly the same table definition in the RETURN table type, it will throw an operand clash error.

推薦答案

我能想到的最好辦法是聲明一個您的類型的表變量本地函數,并在整個代碼中使用它.然后在 RETURN 語句之前對參數表執行 INSERT...SELECT 操作.

The best that I could come up with was to declare a table variable of your type local to the function and use that throughout your code. Then do an INSERT...SELECT into the parameter table right before the RETURN statement.

到目前為止,我已經避免使用用戶定義的類型.雖然它們看起來很有前景,但由于能夠在一個位置更改類型而不是在任何地方更改數據類型,但由于此類問題,它們在生產力和維護方面似乎從未實現過.

I've avoided user-defined types so far. While they seem promising, with the ability to change the type in one location instead of changing data types everywhere, they just never seem to deliver when it comes to productivity and maintenance because of issues like these.

這篇關于SQL Server 2008:多語句 UDF 能否返回 UDT?的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網!

【網站聲明】本站部分內容來源于互聯網,旨在幫助大家更快的解決問題,如果有圖片或者內容侵犯了您的權益,請聯系我們刪除處理,感謝您的支持!

相關文檔推薦

Converting Every Child Tags in to a Single Column with multiple Delimiters -SQL Server (3)(將每個子標記轉換為具有多個分隔符的單列-SQL Server (3))
How can I create a view from more than one table?(如何從多個表創建視圖?)
Create calculated value based on calculated value inside previous row(根據前一行內的計算值創建計算值)
How do I stack the first two columns of a table into a single column, but also pair third column with the first column only?(如何將表格的前兩列堆疊成一列,但也僅將第三列與第一列配對?) - IT屋-程序員軟件開發技
Recursive t-sql query(遞歸 t-sql 查詢)
Convert Month Name to Date / Month Number (Combinations of Questions amp; Answers)(將月份名稱轉換為日期/月份編號(問題和答案的組合))
主站蜘蛛池模板: 国产精品乱码一区二三区小蝌蚪 | 成人欧美一区二区三区 | 特黄特色大片免费视频观看 | 大象一区 | 一起操网站| 国产成人精品999在线观看 | 亚洲精品99 | 日日日操 | 人成在线视频 | 日韩日韩日韩日韩日韩日韩日韩 | 91精品国产欧美一区二区成人 | 国产在线观看 | 一区在线观看视频 | 九九在线| 麻豆精品久久 | 色婷婷精品 | 一级黄色毛片免费 | 毛片大全 | 激情福利视频 | 亚洲男人天堂2024 | 99久久免费精品国产免费高清 | 日韩中文字幕 | 日本精品999 | 亚洲精品久久久久久久久久久久久 | 国产午夜视频 | 黄色片网此 | 欧美一级www片免费观看 | 午夜久草 | 黑人中文字幕一区二区三区 | 国产精品一区在线观看 | 欧美中文视频 | 久久av综合 | 91麻豆精品国产91久久久久久久久 | 91视频在线 | 亚洲免费视频在线观看 | 欧美精品第一区 | 中文字幕 在线观看 | h在线免费观看 | 久草网址 | 日韩国产在线 | 免费欧美|