Quantcast
Channel: Microsoft SQL Server
Viewing all articles
Browse latest Browse all 4871

Can SQL generate repetitive data

$
0
0

I know that this can be done in R but i am vastly more comfortable with SSMS. The issue is that I am converting old excel files into database tables. To do so, demands some interesting manipulation. The excel file is structured as such with each row representing a month

                     State county1 county2

gamingwin     400      60         65

The desired result in SQL is as such

area year month gamewin

000000 (code for state)      2020    06 (june)      400

000001 (county 1)              2020     06                 60

The issue is that this data goes back to 1996 and so for each of the 19 areas, I have to generate (24*12) plus 6. It can be done but hoping to find a way to generate this in a more timely and less error-prone way than copy+paste+manipulate in excel 


Viewing all articles
Browse latest Browse all 4871

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>