Created
September 22, 2022 18:13
-
-
Save erikdarlingdata/35b2a83b5ec8ac13cfe9757ae8f91196 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/*Table to modify*/ | |
CREATE TABLE | |
dbo.as_i_am | |
( | |
id int PRIMARY KEY IDENTITY, | |
some_date datetime, | |
some_string varchar(100) DEFAULT 'a' | |
); | |
/*Table to capture previous row versions*/ | |
CREATE TABLE | |
dbo.as_i_was | |
( | |
id int PRIMARY KEY, | |
some_date datetime, | |
some_string varchar(100) | |
); | |
/*Maple Syrup Data*/ | |
INSERT | |
dbo.as_i_am WITH(TABLOCK) | |
( | |
some_date, | |
some_string | |
) | |
SELECT | |
DATEADD(MINUTE, m.n, GETDATE()), | |
REPLICATE(CHAR(m.n % 65 + 90), 50) | |
FROM | |
( | |
SELECT | |
n = | |
ROW_NUMBER() OVER | |
(ORDER BY @@SPID) | |
FROM sys.messages AS m | |
) AS m; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment