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 |
|
ConnieXujuan
Starting Member
48 Posts |
Posted - 2011-12-29 : 19:37:10
|
| Hi -,i was trying to do a if clause and I want to express the sort meaning as below:if (select * from table1 ) is not nullbut obviously the grammar is wrong so could anyone let me know what how should my query be?Thanks a lot!Connie |
|
|
Transact Charlie
Master Smack Fu Yak Hacker
3451 Posts |
Posted - 2011-12-29 : 19:44:32
|
Maybe?IF EXISTS ( SELECT 1 FROM table1 )BEGIN ....END Charlie===============================================================Msg 3903, Level 16, State 1, Line 1736The ROLLBACK TRANSACTION request has no corresponding BEGIN TRANSACTION |
 |
|
|
Transact Charlie
Master Smack Fu Yak Hacker
3451 Posts |
Posted - 2011-12-29 : 19:45:33
|
| Assuming that you want to do something as long as table1 has any rows in it?You can add a WHERE clause to the SELECT statement to tune the predicateCharlie===============================================================Msg 3903, Level 16, State 1, Line 1736The ROLLBACK TRANSACTION request has no corresponding BEGIN TRANSACTION |
 |
|
|
ConnieXujuan
Starting Member
48 Posts |
Posted - 2011-12-29 : 20:01:35
|
| Thanks a lot Charlie! |
 |
|
|
|
|
|