如何10000多参数添加到一个SQL命令 [英] How to add more than 10000 parameters to a single sql command

查看:105
本文介绍了如何10000多参数添加到一个SQL命令的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我要10000多参数添加到一个SQL命令。怎么可能?
据我所知2100参数的单个SQL命令。

I want to add more than 10000 parameters to a single sql command. How it possible? As far i know 2100 parameters a single sql command.

推荐答案

我觉得你退一步,以为什么而不是跳跃的权利如何做。它听起来像也许你正在做一些巨大的插入/更新,在这种情况下,更合适的解决方案是表值参数

I think you step back to the "why" rather than jumping right to the "how". It sounds like maybe you are doing some huge insert/update, in which case a more appropriate solution would be table-valued-parameters.

其他选项包括:


  • 传递XML和使用SQL Server解析XML(正是在这个相当不错的)

  • 装载数据的第一个的的东西,如 SqlBulkCopy的到一个临时表中,然后执行命令(原始TSQL或存储过程),从临时表推数据进入事务性表

  • 如果它仅仅是ID的列表,在服务器上写了一个分裂函数(UDF),并通过了 [N] VARCHAR (最大值)

  • 批量操作成若干个更明智的命令

  • passing in xml and using SQL server to parse the xml (it is quite good at this)
  • loading data first with something like SqlBulkCopy into a staging table, then executing a command (raw TSQL or a SPROC) to push the data from the staging table into the transactional tables
  • if it is just a list of ids, write a "split" function (udf) at the server and pass in a [n]varchar(max)
  • batch the operations into a number of more sane commands

您真的不想做一些与一个命令10K参数;疯狂的方式摆在。

You really don't want to do something with 10k parameters on one command; that way madness lies.

这篇关于如何10000多参数添加到一个SQL命令的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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