如何将字符串传递给过程 [英] how to pass strings to a procedure
本文介绍了如何将字符串传递给过程的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
你好!
我创建了一个过程,每次"where"条件发生变化时,该过程
所以当我调用该过程时,我想从c Sharp那里传递两个字符串以及
程序名称,例如
querry_string("proc_myprocedure",string1,string2)
在程序中
创建过程proc_myprocedure
选择......
.....
....
..............其中unmae =字符串1和uid =字符串2
你能帮我吗
解决方案
创建程序MyProc(@ var1 nvarchar(max),@ var2 nvarchar(max))
如
开始
从xxx中选择*,其中unmae = @ var1和uid = @ var2
我建议阅读一些有关SQL的文章.
此处 [ http://sharpertutorials.com/calling-sql-server-stored-procedures/ [ ^ ]
>
hello!
i have created a procedure in which every time the "where" condition is changed
so from c sharp when i call the procedure i want to pass two strings along with
procedure name e.g
querry_string ("proc_myprocedure", string1, string2)
in procedure
create procedure proc_myprocedure
select ......
.....
....
.............. where unmae = string1 and uid = string2
can you help me please
解决方案
CREATE PROC MyProc(@var1 nvarchar(max), @var2 nvarchar(max))
as
begin
select * from xxx where unmae = @var1 and uid = @var2
I suggest reading some articles on SQL.
Here[^] is one on how to call your proc.
Check this link.
http://sharpertutorials.com/calling-sql-server-stored-procedures/[^]
这篇关于如何将字符串传递给过程的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文