表变量在 SQL Server 中可以拥有的最大记录数 [英] Maximum Number of Records a table variable can have in SQL Server

查看:46
本文介绍了表变量在 SQL Server 中可以拥有的最大记录数的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否有任何约束来限制我们在表变量中可以拥有的记录数?如果是,表变量可以容纳的最大记录数是多少?我必须编写一个存储过程来处理大约 1000 条记录.我需要使用表变量还是临时表?

Is there any constraints to limit the number of records we can have in a table variable? If yes, what will be the maximum number records a table variable can hold? I have to write a stored procedure to process around 1000 records. Do I need to go with table variable or temporary table?

推荐答案

因此,SQL Server 的最大容量规范 没有为表变量定义这样的上限,因为它取决于数据库大小和可用于存储的可用内存.您也可以参考讨论相同内容的 MSDN 论坛;表变量的最大容量

As such the official MSDN site where the Maximum Capacity Specifications for SQL Server there is no such upper limit defined for table variables because it depends on the database size and the free memory available for the storage. You can also refer the MSDN forum discussing the same; Maximum Capicity of Table Variable

我需要使用表变量还是临时表?

Do I need to go with Table Variable or Temporary Table?

您可以使用它们中的任何一个,因为对于何时应该使用表变量以及何时使用临时变量没有黄金法则.有一些参考资料可以帮助您进一步了解它:

You can use any of them as there is no such golden rule as to when you should use Table variable and when to use Temporary variables. There are some references which can be helpful to understand it more:

这篇关于表变量在 SQL Server 中可以拥有的最大记录数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆