Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
Author |
Topic |
learntsql
524 Posts |
Posted - 2010-10-04 : 03:08:45
|
create table T1(A int)create table T2(B int)insert into T1 values(1)insert into T2 values(2)select *from T1where A =(SELECT A FROM T2)drop table T1drop table T2TIA. |
|
Transact Charlie
Master Smack Fu Yak Hacker
3451 Posts |
Posted - 2010-10-04 : 04:25:42
|
What??? Weren't you involved in exactly this question before?It wasn't you who asked.There was a very similar post raised recently. Here's the link:http://www.sqlteam.com/forums/topic.asp?TOPIC_ID=150951The inner query (SELECT A FROM T2) is implicitly getting the value from T1 (because T1 is in it's scope from the outer query)Change the query tocreate table T1(A int)create table T2(B int)insert into T1 values(1)insert into T2 values(2)select *from T1where A =(SELECT tab2.A FROM T2 AS tab2)drop table T1drop table T2 And you'll get the failure you were expecting.Charlie===============================================================Msg 3903, Level 16, State 1, Line 1736The ROLLBACK TRANSACTION request has no corresponding BEGIN TRANSACTION |
|
|
|
|
|