Tag: software development

  • Better Test Data Domains with SQL Data Generator

    This is a series on SQL Data Generator, covering some interesting scenarios I’ve run into. If you’ve never tried it, SQL Data Generator is a part of the SQL Toolbelt. Give it a try today with an evaluation today.

    I’ve been working more with SQL Data Generator (SDG) because it solves some problems that many software developers have with test data. Often each developer needs to create their own set of test data, with these being the common actions:

    • Use a backup of production, perhaps old.
    • Randomly insert a few values each developer comes up with
    • Use random data from SDG, a new project each time.
    • Load a known data set from production or test systems

    While I think small amounts of random data work well, I think the data should reflect (somewhat) the types of data in production. Totally random strings don’t work, but similar words, structures, etc. make sense.

    However having a consistent set of data for each developer is a great idea. SDG can consistently generate data sets, but to make them meaningful, you might want to have control over the types of data inserted.

    Using Real Words

    I talked about the difference between random words and real words. However, what if you want to include specific types of items?

    Let’s evolve some data. If I have a varchar(500) column, SDG defaults to this:

    [A-Z0-9]*

    Which gives me this:

    2015-08-28 10_03_55-New notification

    That’s not great if I wanted to examine specific rows and determine if they were being returned by a query. This is just too random and hard to verify.

    However I have options. For example, I could use the “Insert File List” item. This gives me a list of files that could be helpful. In this case, let’s choose “Color”.

    2015-08-28 10_05_33-SQL Data Generator - Fun_Article_Titles_Words.sqlgen

    I see this in the RegEx box.

    ($”Color.txt”)

    Now my test data looks like this:

    2015-08-28 10_06_14-

    What’s in “color.txt”? Let’s see. The file is under the Data Generator 3 folder, in a Config location. I see lots of XML and text files.

    2015-08-28 10_08_09-Config

    If I open Color.txt, I see what I expect.

    2015-08-28 10_08_17-Get Started

    Now, let’s experiment. Let’s create a SQL Server file. I’ll put values in like this:

    2015-08-28 10_08_17-Get Started

    I need to change permissions on the config folder to allow saving, but I put it there.  I also had to close and re-open SDG to pick up the new file.

    Now I’ll add that to the RegEx box.

    2015-08-28 10_15_44-SQL Data Generator - Fun_Article_Titles_Files.sqlgen _

    That’s cool. What if I made a file with a number of random words in it. Like a dictionary of sorts. I could do this. I create dictionary_small.txt.

    2015-08-28 10_22_10-Get Started

    Now I include that a number of times.

    2015-08-28 10_23_17-New notification

    Those are some great descriptions. I’m sure I could have fun with this in other ways as well. Let’s create some good and bad data for a cleaning operation.

    2015-08-28 10_28_38-New notification

    The ability to include data from flat files is a great option in SDG for putting together a data set that developers can actually use, understand, and count on for loading up new databases or tables, especially when creating quick code branches to test something out.

  • Building Rollback Scripts with SQL Compare

    SQL Compare is a core product from Redgate and I’ve got a series on some of the interesting things I’ve found. Download a trial today if you haven’t tried it.

    There’s a neat switch in SQL Compare that lets you build rollback scripts. It looks like this:

    sc_button-switch

    I’ve used this before to help with deployments, as many of you have. The idea is that when you finish with your code in your dev environment, you run a comparison with production, doing something like this:

    sqlcomparedeploy_a

    I’ve set the source as my development place, and the destination as production. I click “Compare Now”, get a script that will deploy the changes from development to production, and save it. I can use that script as part of my deployment process.

    However as soon as I’ve saved that script, I return to this screen, and I click the “Switch” button at the bottom.

    sqlcomparedeploy_b

    If you look closely, you’ll see that my source (on the left) and destination (on the right), have changed places. This means I’ll now generate a script that takes my production environment and generates the script to get back production from development.

    This is a rollback script.

    It doesn’t work in all situations, and you really have to think about what you’re changing, but if you’re just doing views/procedures/functions, this is a great way to get that quick rollback script that you store alongside the deployment script in case things go badly.

  • Here’s a Reason to Document

    A search engine for code

    This editorial was originally published on Feb 17, 2006. Steve is traveling in the UK this week and we are re-printing some old pieces.

    A new search engine, Krugle, set to launch next month, is supposed to focus on code. Mostly open source code, but also places like SQLServerCentral.com, which has scripts and other types of code available. Wired has a good article on the idea behind this search.

    It’s an interesting idea, though given the types of comments and the wide range of ways that things are described, I wonder if it will work. I know that we get lots of posts in the forums that I easily find answers for using Google when other don’t. I suspect that I am just searching on better terms than others. Course that doesn’t always work for my own questions, so perhaps it’s a second set of eyes that really help.

    However this also depends on the actual coders spending some time to properly describe their system. That’s always a difficult task. But even assuming that they will describe their code well, how will you know if it will “plug in” easily to your system? I’ve seen lots of code that wouldn’t easily integrate with something I was writing.

    And if I checked out 3 or 4 of these incompatible, or not easily integrated systems, from a search engine, I’d be tempted to just write my own. Actually I think lots of developers write their own code, or build on a base and then do everything themselves because it takes so long to integrate disparate code at times.

    Still it’s a great idea and I hope it works.

    Update Jul 13, 2011: Has anyone used, or is using, Krugle?

  • Greed Is Good (for IT)

    I think that the lottery mentality that so many executives of companies have these days is bad for business. The idea that someone can be promoted from a director or vice president to CEO and then earn enough money in bonuses, benefits and stock options to retire is silly. People that lead a company should make more, but their jobs should be no more secure than anyone else’s in the company, and they shouldn’t be paid multiples more than their direct reports. If they lose their jobs, they should have to get a new one, just like the rest of us.

    Last week LInkedIn had an initial public offering (IPO), which was very successful. The company raised money, which hopefully will help it grow, and many stockholders and investors became rich. That might not be important to data professionals, but the news may have caught the attention of your management, and that could be good for IT.

    The CEO of TheLadders.com wrote a blog about the event, and he brought up an interesting point. Executives and management in many companies probably are thinking that social networking, or just online engagement with customers,  has an impact on their business. How do they get better engagement? Better Information Technology.

    While I’m not sure this will be pervasive throughout all companies and industries, there will be executives that want to build new systems and move faster. They will want new applications, which means new databases, and for some of us, this will be the chance to get a better job, build a strategic application, or just get a little more budget for our group.

    It’s also potentially an opportunity for you to be pro-active. Maybe you can suggest a few new ideas for projects or enhancements that you might want to tackle which would improve customer engagement. Maybe you’ll even get the chance to have some fun at work.

    Steve Jones


    The Voice of the DBA Podcasts