SQL SERVER 2008 存储过程传表参数
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了SQL SERVER 2008 存储过程传表参数相关的知识,希望对你有一定的参考价值。
?
最近项目使用到了存储过程传入表类型参数。
--定义表类型 create type t_table_type as table ( id int, name varchar(32), sex varchar(2) ) ? go --创建存储过程 CREATE PROC u_test (@t t_table_type readonly) as begin ???? select * from @t ???? end ? --调用存储过程 declare @t t_table_type ? insert into @t values (1,‘a‘,‘f‘) insert into @t values (2,‘a‘,‘f‘) insert into @t values (3,‘a‘,‘f‘) insert into @t values (4,‘a‘,‘f‘) ? exec u_test @t |
以上是关于SQL SERVER 2008 存储过程传表参数的主要内容,如果未能解决你的问题,请参考以下文章