StackOverflowDocumentation
.dbo
Tables
(current)
Columns
Constraints
Relationships
Orphan Tables
Anomalies
Routines
usp_insertPosts
Parameters
Name
Type
Mode
Definition
CREATE PROC [dbo].[usp_insertPosts] AS BEGIN /* Determine count of users added within the workload recorded This is a helper to get the workload and the inserts deterministic rather than having random inputs */ DECLARE @count INT = (SELECT COUNT(*) FROM dbo.Posts WHERE CreationDate > '20200512') + 1; INSERT INTO dbo.Posts ( Body, CreationDate, LastActivityDate, PostTypeId, Score, Tags, Title, ViewCount, OwnerUserId ) VALUES ( N'This is just a dummycontent', -- Body - nvarchar '20200512 18:00', -- CreationDate - datetime '20200512 18:00', -- LastActivityDate - datetime 1, -- PostTypeId - int --stands for "Question" @count*100, -- Score - int N'sql-server-2019', -- Tags - nvarchar N'This is just a dummyquestion', -- Title - nvarchar @count*250, -- ViewCount - int 212952 -- ok, well one user gets all the credit for the workload to be deterministic /* --randomly return one of the newly generated users ( SELECT TOP 1 id FROM dbo.Users u WHERE CreationDate > '20200501' ORDER BY NEWID() ) */ ); END