简体   繁体   English

将表值参数传递到SQL CLR存储过程的值是什么?

[英]What is the value of passing table value parameters into SQL CLR stored procedure?

I have a stored procedure to write where I need only two attributes out of a field. 我有一个存储过程来编写,我只需要一个字段中的两个属性。 Most likely, it will only be working on one, maybe two or three fields at a time. 最有可能的是,它一次只能在一个,两个或三个领域工作。 It's also supposed to be a CLR stored procedure. 它也应该是CLR存储过程。

As a beginner in SQL, it seems to me that passing a table value parameter is overkill, however since this is for work, and a relatively big company, I'm wondering if there are other considerations to make? 作为SQL的初学者,在我看来传递表值参数是过大的,但是由于这是为了工作,而且是一家相对较大的公司,所以我想知道是否还要考虑其他因素? What exactly is the value in using a table value parameter as opposed to a normal one. 与普通参数相比,使用表值参数的确切值是多少。

I don't see the need for CLR outlined in your question, however there are definitely uses for TVPs. 我看不到您的问题中概述了CLR的必要性,但是TVP肯定有用途。

I have seen comma separated lists being passed into SQL stored procedures, TVPs could be utilized there for better type checking and structure. 我已经看到逗号分隔的列表被传递到SQL存储过程中,可以在其中使用TVP进行更好的类型检查和结构化。

It also helps with enterprise level robustness; 它还有助于提高企业级的可靠性。 I worked on something that would attempt 1.5 million inserts within ~1 hour. 我的工作是在大约1小时内尝试插入150万次插入。 Doing this with individual inserts (a proc that accepted a bunch of scalar parameters) was resource intensive and very, very slow; 用单独的插入(一个接受了一系列标量参数的proc)执行此操作会占用大量资源,而且非常非常慢。 when converted to perform bulk inserts with Table Valued Parameters the operation completed in about 1/5 the time. 当转换为使用表值参数执行批量插入时,该操作将在大约1/5的时间内完成。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM