Link to home
Start Free TrialLog in
Avatar of sanie raphela
sanie raphela

asked on

writes to database

i need to Create code to randomly generate year and month and write to the database.
Generate ID’s and write to the database.
Loop 20 times.
Avatar of ste5an
ste5an
Flag of Germany image

E.g. in SSMS:

INSERT INTO yourTable ( MonthNumber ,
                        YearNumber )
            SELECT CEILING(RAND() * 12) AS MonthNumber ,
                   CEILING(RAND() * 20) + 2000 AS YearNumber;
GO 20

Open in new window

This question needs an answer!
Become an EE member today
7 DAY FREE TRIAL
Members can start a 7-Day Free trial then enjoy unlimited access to the platform.
View membership options
or
Learn why we charge membership fees
We get it - no one likes a content blocker. Take one extra minute and find out why we block content.