Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- This is my query name
- -- This is my description
- -- I can span multiple lines
- SELECT 1
- DECLARE @UserId int = 1 --<-- Change this by your user ID.
- DECLARE @UserId int = ##USER_ID##
- CREATE PROCEDURE WebQuery
- @QueryText nvarchar(1000),
- @IPHash binary(16)
- AS
- BEGIN
- --Log query
- INSERT INTO Logs (QueryText, IPHash, QueryHash) VALUES (@QueryText, @IPHash, HashBytes('md5', LTrim(RTrim(Upper(@QueryText))))
- -- no writing allowed, so no need to lock on select
- SET TRANSACTION ISOLATION LEVEL READ UNCOMMITTED
- -- throttles
- SET ROWCOUNT 500
- SET QUERY_GOVERNOR_COST_LIMIT 500
- exec (@QueryText)
- END
- User Link,Reputation,Days,RepPerDays
- {
- "title": "John T",
- "id": 1931
- },56421,288,195
- {
- "title": "Wil",
- "id": 4386
- },35724,270,132
- {
- "title": "unknown",
- "id": 8672
- },23661,246,96
- {
- "title": "nik",
- "id": 263
- },20317,289,70
- {
- "title": "quack quixote",
- "id": 12786
- },13409,212,63
- DECLARE @start INT
- DECLARE @limit INT
- DECLARE @page INT
- SET @page = 1
- SET @start = 1+35*(@page-1)
- SET @limit = 35
- SELECT * FROM
- (
- SELECT row_number() OVER (ORDER BY Reputation DESC) AS i, *
- FROM users
- ) AS T
- WHERE T.i BETWEEN (@start) AND (@start + @limit)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement