CREATE TABLE #tab1(X INT); CREATE TABLE #tab2(Y NVARCHAR...

0

Please login or register to vote for this query.

(click on this box to dismiss)

Drones and Model Aircraft Meta

Q&A for experienced flyers, pilots, and builders of drones and model aircraft

CREATE TABLE #tab1(X INT);

CREATE TABLE #tab2(Y NVARCHAR(12));

INSERT INTO #tab1
VALUES (1), (2), (3), (4);

INSERT INTO #tab2
VALUES ('A'), ('B'), ('C');

SELECT X, Y
INTO #result
FROM #tab1
CROSS JOIN #tab2
ORDER BY X, Y;

SELECT ROW_NUMBER() OVER(ORDER BY (SELECT 1) ) AS rn, *
FROM #result;

Enter Parameters

Options:
Switch to main site
loading Hold tight while we fetch your results