0
mysql을 SQL 문을 SQL 서버 2008로 변환하는 중 오류가 발생했습니다. 한계 및 별칭이 작동하지 않기 때문에 누구나 내가 다음 쿼리에서 잘못하고있는 것을 말해 줄 수 있습니다.mysql insert 문을 SQL 서버 insert 문으로 변환 하시겠습니까?
insert into account (product_cd, cust_id, open_date,
last_activity_date, status, open_branch_id,
open_emp_id, avail_balance, pending_balance)
select a.prod_cd, c.cust_id, a.open_date, a.last_date, 'ACTIVE',
e.branch_id, e.emp_id, a.avail, a.pend
from customer c cross join
(select b.branch_id, e.emp_id
from branch b inner join employee e on e.assigned_branch_id = b.branch_id
where b.city = 'Woburn' limit 1) e
cross join
(select 'CHK' prod_cd, '2000-01-15' open_date, '2005-01-04' last_date,
1057.75 avail, 1057.75 pend union all
select 'SAV' prod_cd, '2000-01-15' open_date, '2004-12-19' last_date,
500.00 avail, 500.00 pend union all
select 'CD' prod_cd, '2004-06-30' open_date, '2004-06-30' last_date,
3000.00 avail, 3000.00 pend) a
where c.fed_id = '111-11-1111';
오류
Msg 102, Level 15, State 1, Line 9
Incorrect syntax near 'limit'.
Msg 102, Level 15, State 1, Line 14
Incorrect syntax near 'a'.
Msg 102, Level 15, State 1, Line 24
Incorrect syntax near 'limit'.
Msg 102, Level 15, State 1, Line 29
Incorrect syntax near 'a'.
Msg 102, Level 15, State 1, Line 39
Incorrect syntax near 'limit'.
Msg 102, Level 15, State 1, Line 46
Incorrect syntax near 'a'.
Msg 102, Level 15, State 1, Line 56
Incorrect syntax near 'limit'.
Msg 102, Level 15, State 1, Line 59
Incorrect syntax near 'a'.
Msg 102, Level 15, State 1, Line 69
Incorrect syntax near 'limit'.
Msg 102, Level 15, State 1, Line 74
Incorrect syntax near 'a'.
Msg 102, Level 15, State 1, Line 84
Incorrect syntax near 'limit'.
Msg 102, Level 15, State 1, Line 87
Incorrect syntax near 'a'.
Msg 102, Level 15, State 1, Line 97
Incorrect syntax near 'limit'.
Msg 102, Level 15, State 1, Line 102
Incorrect syntax near 'a'.
Msg 102, Level 15, State 1, Line 112
Incorrect syntax near 'limit'.
Msg 102, Level 15, State 1, Line 119
Incorrect syntax near 'a'.
편집 :
create table account
(account_id integer not null identity,
product_cd varchar(10) not null,
cust_id integer not null,
open_date date not null,
close_date date,
last_activity_date date,
status char(5) not null check(status in ('ACTIVE','CLOSED','FROZEN')),
open_branch_id smallint ,
open_emp_id smallint ,
avail_balance decimal(10,2),
pending_balance decimal(10,2),
constraint fk_product_cd foreign key (product_cd)
references product (product_cd),
constraint fk_a_cust_id foreign key (cust_id)
references customer (cust_id),
constraint fk_a_branch_id foreign key (open_branch_id)
references branch (branch_id),
constraint fk_a_emp_id foreign key (open_emp_id)
references employee (emp_id),
constraint pk_account primary key (account_id)
);
나는 당신이'메시지 8152, 레벨 16, 상태 14, 라인 1이 나타나지 않는다고 도망쳤다. 문자열 또는 바이너리 데이터가 잘릴 것이다. 명세서가 종료되었습니다. '오류가 발생했습니다. –
@ViswanathanIyer - 이제는 쿼리가 실행되는 것과 완전히 다른 문제이지만 대상 테이블과 쿼리의 열 사이에 다른 데이터 형식이 있기 때문에 데이터를 삽입 할 수 없습니다. – Lamak
create table 명령문으로 업데이트 된 질문. –