_ | 覦覈襦 | 豕蠏手 | 殊螳 | 譯殊碁
FrontPage › TableValueParameters
朱 ろ碁ゼ 蟆曙 襷れ. 伎螻 螳.
use tempdb
go

--drop table source_table
create table source_table (
	id varchar(10)
,	pw varchar(10)
);

--drop table target_table
create table target_table (
	id varchar(10)
,	pw varchar(10)
);

insert source_table values 
	('dwa', '1234')
,	('yasi', '4567')
,	('lk', 'lk123') --new syntax, T-SQL Row Constructors
go

襷り, 襦 Row Set 襷り覲襦 覦 . 襯 れ 襷り覲襦 '1,2,3,4' 螳 蟲覿襯 螳讌 覓語伎 燕 企 襦 襷れ朱 SQL Server 2008 覦 覃 .
create type id as table --new syntax, Table Value Type
(
	id varchar(10) null
);
go

create proc table_value_param_test
	@table id readonly
as
begin
	declare @i int = 10; --new syntax
	select * from source_table 
	where id in (select id from @table)
end
go

declare @param as id;
insert @param(id) values('dwa'), ('yasi');
exec table_value_param_test @param;
/*
id         pw
---------- ----------
dwa        1234
yasi       4567
*/

蠍 蠍郁鍵..
企: : るジ讓曙 襦螻豺 企Ν 譯殊語. 襦螻豺
EditText : Print : Mobile : FindPage : DeletePage : LikePages : Powered by MoniWiki : Last modified 2018-04-13 23:12:54

苦 蟾 危危覃 襦 譯曙 蠏碁 譴企. (ろ)