Author: way0utwest

  • Understanding a UK Keyboard for a US developer

    One of the very interesting parts of my job is that I run into UK keyboards on a regular basis. Redgate is a UK company and most of the trade show laptops that they bring to events are UK layouts. Our VMs are built in the UK, and when I use one of those, I need to remember that some of the keys are different.

    I needed to learn the difference between the layouts, because when you’re in a hurry, you can’t scan the keyboard. I found a nice visualization and summary on Wikipedia. I’ve used that a few times, and with Kendra starting as a new Redgate evangelist, I scanned it again. I haven’t worked on a UK keyboard in a few months, so I want to highlight the differences in my memory for upcoming conferences.

    For me, the main differences I need to remember are the at symbol (@ ) and quotes (“) are switched. That means for logging in with emails, I need to smoothly use what I know as quotes for the @. I rarely use quotes, so this isn’t an issue.

    I do use the $ at times, and there isn’t a good way to get this without messing around. The same thing for the hash or pound (#) key. If I really need those, I often just end up changing the keyboard layout.

  • Off to #SQLSat Pittsburgh

    I’ve never been to Pittsburgh. Actually, in all of my speaking and traveling, I don’t think I’ve even flown through the airport. I’ve been wanting to rectify this, and quite a few friends, like Bill and Konstantine, have been asking me to come for years. The timing hasn’t worked out with other events in the past, but this year I kept the weekend free and was accepted to speak.

    If you’re in the area on Saturday, register and come to SQL Saturday #770. It’s at the Pittsburgh Technical College and there’s a great schedule of speakers and sessions to see.  The event is free, though there is a lunch charge.

    I’ll be delivering my popular branding session along with a Database DevOps talk. Hope to see you there.

  • Finding Objects in a Schema #SQLNewblogger

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

    One of the things I needed to do recently was move some objects from one schema to another. I wrote about moving an object between schemas recently, but another part of that process was finding  the objects to move.

    This is a quick post on how to find the objects in a schema. To start, here are a number of objects in a test database.

    2018-09-17 19_25_07-SQLQuery1.sql - dkrSpectre_sql2017.sandbox (DKRSPECTRE_way0u (68))_ - Microsoft

    A schema has a name, which is the way that we would search for related objects. That means I want a parameter for my query, so I’ll start with a variable to store the name. For me, I’ll use a well named variable like this:

    DECLARE @schema VARCHAR(100) = 'SallyDev';

    Now I have a schema name, where do I find schema data? There is a DMV called sys.schemas, which contains a bit of meta data. If I query that, I see this:

    2018-09-17 19_26_25-SQLQuery1.sql - dkrSpectre_sql2017.sandbox (DKRSPECTRE_way0u (68))_ - Microsoft

    I can see my SallyDev schema, so I know I’ll query this DMV.

    The other information I need is the object data, which is in sys.objects. I query that for the various data I want, but I want to limit data by the schema. In sys.objects, there is a schema_id, which is the data I’ll join with from sys.schemas.

    When I do that, I build a query like this:

    DECLARE @schema VARCHAR(100) = 'SallyDev';
    SELECT
            o.type_desc,
            s.name AS 'Schema Name',
            o.name AS 'Object Name',
            o.object_id
    FROM sys.objects o
         INNER JOIN sys.schemas s ON s.schema_id = o.schema_id
    WHERE s.name = @schema;

    I can execute that and I’ll see the objects I need.

    2018-09-17 19_28_57-SQLQuery1.sql - dkrSpectre_sql2017.sandbox (DKRSPECTRE_way0u (68))_ - Microsoft

    SQLNewBlogger

    This was a post related to the one on moving objects and I wrote this write after that one. It was only about 5 minutes longer to put this together, and it gives me a script I can easily search for on my blog if I need to do this task.

    Once again, a quick and easy way to show some skills, practice explaining something, and get some knowledge stored for my own reference.

  • An Open Thank You to the Microsoft SQL Server Team

    Thank you, Microsoft SQL Server Development team. I really am happy with your work.

    I was going through emails and noticed the someone had posted a surprise in the SQL Server 2019 CTP. The post was slightly cryptic, but since I saw the dreaded string-or-binary-data-truncated message, I was intrigued. Digging further, with some help from fellow MVPs, I found that one of the most voted on feature requests was actually implemented. I blogged about this briefly, but in case you wonder, this is the message in SQL Server 2017 and below:

    Msg 8152, Level 16, State 14, Line 8
    String or binary data would be truncated.

    In SQL Server 2019, I get this from the same repro:

    Msg 2628, Level 16, State 1, Line 8
    String or binary data would be truncated in table 'Sandbox.dbo.Customer', column 'CustomerName'. Truncated value: 'Is this th'.

    You do need to enable trace flag 460, but this works and should help you find that problematic data. I’m really glad that Microsoft has implemented the first stages of a fix, and I do appreciate their efforts here. This is a nice step forward.

    I do hope that future versions, or even continued development on SQL Server 2019 will enhance this. Right now I just get the first occurrence, which is good, but I’d love it if we could get a result set back, or maybe an indication of more problems. I know I’m asking for more here, but there is room for improvement.

    If this is all we get for SQL Server 2019, that’s fine. I think this is going to be very helpful for those problematic imports, and at least help us find bad data more quickly in those poorly structured input strings.

    Steve Jones

    The Voice of the DBA Podcast

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