0

I have got a bunch of SQL Statements. They are in a special order so if the first statement returns a row I am done, if not go to the next Statement and return the result. What would be a fast way to do this? I tried to realize it in T-SQL because I am on a MSSQL Server but it's really slow.

It's really important to make this thing as fast as possible.

4

2 回答 2

1

如果您只需要第一行使用TOP 1

SELECT TOP 1 * FROM ...
于 2013-04-03T15:07:59.693 回答
0

尝试这样的事情

Select column1 from myTable
if @@ROWCOUNT <> 0 return

Select column1 from myOtherTable
if @@ROWCOUNT <> 0 return

... and so on
于 2013-04-03T15:13:27.640 回答