Create test data in SQL Server

后端 未结 6 933
猫巷女王i
猫巷女王i 2021-02-05 20:50

Does anyone have or know of a SQL script that will generate test data for a given table?

Ideally it will look at the schema of the table and create row(s) with test data

6条回答
  •  猫巷女王i
    2021-02-05 21:09

    Have you tried ApexSQL Generate: https://www.apexsql.com/sql_tools_generate.aspx ?

    I stumbled upon it during my own search for the similar thing, and it did the job quite well. It’s not free, but you get a free trial with all features available, so you can try before you buy.

    I think it will suite your needs quite well, since it keeps track of your relations between tables, column types and even constraints (for a more complex databases).

    One thing I liked (and needed, actually) was that it has built-in values for actual names, addresses etc. It helps so much when querying created test data and not get a random strings.

    Also, you can export to SQL (or few other formats) and use the created data at any time to repopulate the database.

提交回复
热议问题