--only in case of SQLServer 2005
insert into emp values (388,'ename','last_name',4,null,(select MAX(sal) from emp),300,20);
Then following error is coming :
Msg 1046, Level 15, State 1, Line 5
Subqueries are not allowed in this context. Only scalar expressions are allowed.
Problem:
syntax error,, not supported by sqlserver ver. 2005.
Solution:
insert into emp (empno,ename , last_name , mgrno, hiredate, sal, comm , deptno) select 388,'ename','last_name',4,null, MAX(sal) ,300,20 from emp1 ;
insert into emp values (388,'ename','last_name',4,null,(select MAX(sal) from emp),300,20);
Then following error is coming :
Msg 1046, Level 15, State 1, Line 5
Subqueries are not allowed in this context. Only scalar expressions are allowed.
Problem:
syntax error,, not supported by sqlserver ver. 2005.
Solution:
insert into emp (empno,ename , last_name , mgrno, hiredate, sal, comm , deptno) select 388,'ename','last_name',4,null, MAX(sal) ,300,20 from emp1 ;
http://diethardsteiner.blogspot.in/2010/12/be-careful-with-running-multiple-step.html
ReplyDeletehttp://www.sqlservercentral.com/Forums/Topic1261804-145-1.aspx#bm1261899