Author: way0utwest

  • Remember the N

    Another post for me that is simple and hopefully serves as an example for people trying to get blogging as #SQLNewBloggers.

    I saw a post recently from someone that was having trouble with Chinese characters being inserted into a SQL Server table. I’m not sure if they were using an application or just SSMS, but they inserted this:

    insert into mytable select ‘<IDC>亮块(DS3或DS4)-清理/维修显像滚筒</IDC>’

    And they got this in the table:

    <IDC>??(DS3?DS4)-??/??????</IDC>

    That’s a problem that I can see, even if I can’t read Chinese.

    Someone else posted a note that when you insert, you need to let SQL Server know your string is Unicode. That means prefixing your string with an N’.

    I looked in Books Online, and found this note under the nvarchar section:

    “Prefix Unicode character string constants with the letter N. Without the N prefix, the string is converted to the default code page of the database. This default code page may not recognize certain characters.”

    I think this means that the N’ isn’t necessarily required, but it depends on the default code page of your database. For most of us, if we don’t include it, I believe our data gets converted to UTF-16, which might not be what we want.

    SQLNewBlogger

    I ran across the post and spent 5 minutes researching things and looking in BOL. This really took about 5 more minutes to write.

    Reference

    NVarchar –  https://msdn.microsoft.com/en-us/library/ms186939.aspx

  • The History of the VCS

    I’ve been looking for ways to convince more DBAs to use a version control system for their code. I realize that many of you have gotten along without them for years, but that doesn’t mean it’s a good idea. A VCS is like a safety net, and someday you’ll be glad you have one.

    Recently I was reading about the history of VCS, and ran across some interesting posts. One on some amazing things, and another that has a timeline, showing us to be in a Renaissance period. If this is the Renaissance, then what comes next? I can’t even imagine, but I suspect someone will improve the process.

    It’s incredible to think about the ways in which we’ve managed versioning code in the past. I’m sure most of us have used comments to both document as well as preserve old code. Some of us have worked with simple backups of files, one per day (for a week or month), or dealt with a first generation system where only one person could work with a particular file.

    The move to CVCS systems, like TFS or Subversion, was a major improvement, allowing everyone to work on all the code, and merge their code with others when they needed to commit. That’s a system many of us inherently understand. It’s what we would do in an offline system. However the DVCS systems (Git, Mercurial), are much more complex, and they can be confusing. However separating the ability from committing changes to performing the merge can be valuable, especially in distributed development.

    More and more tools are integrating version control, including for database code. Whether you like or hate TFS, it includes lots of additional functionality to allow bugs, features, and other workflow items to link to the VCS items that solve them.

    The choice of which system works well in your environment will probably be driven by arguments from your development staff. Some will prefer one interface over another or feel the need to work offline, but I’m not sure it really matters which system you choose. I’d pick one of the modern CVCS or DVCS systems and use it.

    That’s what’s really important; you need to use the system and track your code. It’s frees you as a developer, allowing you to clean up your code, remove excess comments, and easily find out what worked (or didn’t) in previous code.

    Steve Jones

    The Voice of the DBA Podcast

    Listen to the MP3 Audio ( 2.9MB) podcast or subscribe to the feed at iTunes and LibSyn.

  • Argenis and Ryan

    It’s the time of the year when PASS holds its annual elections for the board of directors. This year we have four candidates for 3 slots: Jennifer Stirrup, Tim Ford, Argenis Fernandez and Ryan Adams. Jennifer and Tim have been serving on the board the last few years, with newcomers, Argenis and Ryan, seeking to join the organization.

    I haven’t been too involved the last few years with PASS formally, though I do try to support the SQL Saturdays as best I can throughout the year. I’m still amazed at how well Karla does in facilitating so many events each year. I can only hope that continues.

    This year I’m writing to endorse two of the candidates. Argenis and Ryan are both members of the community that support both events and people, giving to others where they can. They have strong, and thoughtful opinions, both of which I value. I also like change, and I’d like to see the focus and mission of PASS change a bit to consider its membership more than its profits.

    This isn’t to say that I think Jennifer and Tim haven’t done a good job. They are also fine candidates, well qualified, and thoughtful. If either, or both, of them are elected, the organization will do well.

    I just like change in leadership. I like new ideas and fresh perspectives.

    I do urge all of you to take a few minutes of your time and look at the candidates. Read what they’ve written and then spend a few more minutes voting when elections open. This is a small request that can help us our professional organization continue to thrive.

  • ER Modeling

    I saw someone recently note that an Entity-Relationship model is important for your database development project. That UML is important, and the model should be actively maintained. I agree.

    However, I’ve usually not seen this done. Typically when I’ve seen an ER diagram in a shop, it resides on a wall, printed out on multiple sheets of paper. Often there are as many handwritten additions on the pages as there are marks from a printer. The diagram is also usually out of date, even allowing for handwritten notes.

    Maintaining a diagram is hard. Deciding to actually spend time working on one instead of just talking about a few entities and building them, may be harder. This week, I wanted to ask you if you’re up to the challenge in your organization.

    How many of you maintain an ER model for your database?

    Do you have an ER diagram you’ve built? Whether it’s in ErWin, Visio, or Paint. Is there a diagram that’s actively maintained and that everyone can use for designing changes to the database(s) in use? Do people actually consult this and use it in design meetings? Let us know this week.

    Steve Jones

    The Voice of the DBA Podcast

    Listen to the MP3 Audio ( 1.5MB) podcast or subscribe to the feed at iTunes and LibSyn.