Meta Stack Exchange is where users like you discuss bugs, features, and support issues that affect the software powering all 153 Stack Exchange communities.

What is meta?
Here's how it works:
  1. Any Stack Exchange user can ask a question
  2. The community provides support, votes on ideas, and reports bugs
  3. Your voice helps shape the way Stack Exchange operates

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

share|improve this question
    
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 Sep 3 '12 at 17:03
up vote 3 down vote accepted

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

SELECT TOP 10 *
  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.

share|improve this answer

You must log in to answer this question.

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