_대문 | 방명록 | 최근글 | 홈피소개 | 주인놈
FrontPage › RowConstructors
한 번에 여러 Row를 입력할 수 있다. 직접 예제를 보면 이해가 빠르다.
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)
);

--drop table audit
create table audit(
	action varchar(50)
,	insert_id varchar(10)
,	insert_pw varchar(10)
,	delete_id varchar(10)
,	delete_pw varchar(10)
);

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

/*참고로 이런것도 가능하다.
select *
from (
	values
		('dwa', '1234')
	,	('yasi', '4567')
	,	('lk', 'lk123')
) t(id, passwd)


;with test
as
(
	select * 
	from (
		values
			(1, 'aaa')
		,	(2, 'bbb')
	) t (id, name)
)
select * 
from test a
	cross join (values (1), (2)) b (id)
*/

댓글 남기기..
이름: : 오른쪽의 새로고침을 클릭해 주세요. 새로고침
EditText : Print : Mobile : FindPage : DeletePage : LikePages : Powered by MoniWiki : Last modified 2018-04-13 23:12:52

가장 위대한 사랑의 실천은 작은 친절을 습관처럼 행하는 사람들에 의해 이루어진다.