I got the solutions....
-- Create a test table
CREATE TABLE [TESTSTATS]( intKey INT, x FLOAT, y FLOAT)
-- Populate the test table with random data
DECLARE @intCount INT
SET @intCount = 1
WHILE @intCount < 11
BEGIN
INSERT INTO [TESTSTATS]
SELECT @intCount, @intCount, 5.12 * @intCount + 7 * rand()
SET @intCount = @intCount + 1
END
--– Get the Slope
SELECT (count(x)*sum(x*y) - sum(x)* sum(y))/(count(x)*sum(x*x) - sum(x)* sum(x))
FROM [TESTSTATS]