How do I use ROWCOUNT and TOP to limit the query results on Stack Exchange Data Explorer (SEDE)?

For example, fetch me 10 posts tagged JavaScript which have fiddles in them.

Reason - Timeout expired

  • are you asking how to write the TSQL to get those answers, or are you asking us to help you debug a particular bit of TSQL in respect to Stack Exchange Data Explorer to ensure that you're doing the right thing?
    – jcolebrand
    Commented Sep 3, 2012 at 17:03

1 Answer 1


Not really sure how on topic this is but I understand how the timeout's on the Stack Exchange Data Explorer can be annoying. Apparently, a new server is in the offing, which might makes things better.

You're probably looking for PATINDEX, a T-SQL function, which:

Returns the starting position of the first occurrence of a pattern in a specified expression, or zeros if the pattern is not found, on all valid text and character data types.

For instance

  FROM posts
 WHERE PATINDEX('%http://jsfiddle.net%', body) <> 0
   and tags like '%javascript%'

As demonstrated here.

The other option is CHARINDEX; apparently (I have no idea) there's not much difference between them.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .