I don't know of an expression or built-in function in T-SQL to do this, but if you have a numbers table it is easy enough. In the code below, I am constructing a numbers table and then calculating the LCD.CREATE TABLE #N(n INT NOT NULL PRIMARY KEY CLUSTERED );
;WITH N(n) AS (SELECT 1 UNION ALL SELECT n+1 from N WHERE n < 1000)
INSERT INTO #N SELECT * FROM N OPTION (MAXRECURSION 0);
DECLARE @x1 INT, @x2 INT;
SET @x1 = 9; SET @x2 = 6;
SELECT TOP 1
@x1*N1.n
FROM
#N N1 CROSS JOIN #N N2
WHERE
N1.n * @x1 = N2.n*@x2
ORDER BY 1;
DROP TABLE #N;