Your h-index is the highest number n, such that you have at least n questions/answers, all of which have at least n score.
Q&A for programmers
DECLARE @hindex INT
SET @hindex = 0
WHILE (SELECT COUNT(*) FROM Posts WHERE OwnerUserId = ##UserId## AND Score >= @hindex) > @hindex
set @hindex = @hindex + 1