久久久久久久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)(將月份名稱轉換為日期/月份編號(問題和答案的組合))
主站蜘蛛池模板: 亚洲精品91 | 欧美日韩黄色片 | 亚洲黄色精品 | 成人黄色在线观看 | 亚洲第一av | 97国产超碰| 国产精品1区2区3区 国产黄在线观看 | 国产精品不卡视频 | 青青草91 | 亚洲激情五月 | 久久久久国产视频 | 日韩成人在线免费观看 | 免费91网站| 精品久久精品 | 亚洲视频精品 | wwwav在线 | 亚洲欧美视频在线观看 | 久久九九免费视频 | 久久久久久久久国产精品 | 五月天婷婷激情网 | 日韩中文字幕一区二区 | 免费成人在线观看视频 | 色婷婷一区二区三区四区 | 国产三级做爰高清在线 | 美女91网站 | 日本天堂网 | 深夜影院深a | 91麻豆精品 | 在线观看网址你懂的 | 老司机精品在线 | 91在线一区| 欧美一级做性受免费大片免费 | 国产黄a三级三级三级看三级男男 | 成人永久免费 | 一级黄色片免费观看 | 蜜臀久久99精品久久久久宅男 | 免费一级片 | 91精品福利| 日日干夜夜爽 | 国产成人免费 | 四虎成人网|