我可以发送参数数组来存储过程吗? [英] Can I send array of parameter to store procedure?

查看:76
本文介绍了我可以发送参数数组来存储过程吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有User表,它具有UserId uniqueidentifier,名称varchar和IsActive bit.

I have User table, it has UserId uniqueidentifier, Name varchar and IsActive bit.

我想创建将许多用户的IsActive设置为false的存储过程,例如,如果要停用2个用户,则要发送这些用户的Guid来存储过程(最好是数组).我想知道该怎么办?

I want to create store procedure to set IsActive to false for many user, for example, if I want to deactive 2 users, I want to send Guid of those users to store procedure (prefer as array). I want to know how can I do it?

P.S.我正在使用Microsoft SQL Azure

P.S. I'm working on Microsoft SQL Azure

推荐答案

与Elian相同,所以请看一下XML参数.一般来说,与解析字符串列表相比,您应该使用xml来实现更简洁/安全的实现. 点击此处查看代码示例

Along the same lines than Elian, take a look at XML parameters. Generally speaking you should have a cleaner/safer implementation using xml than parsing a list of strings. Click here for a code example

这篇关于我可以发送参数数组来存储过程吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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