Tag: SQLNewBlogger

  • Getting a List of Tags from the Microsoft Container Registry–#SQLNewBlogger

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

    I needed to write this post because I keep forgetting this. I’m hoping this will help me remember.

    I easily remember that the container registry is at mcr.microsoft.com. This isn’t helpful. On Firefox, I get a redirect.

    2020-07-07 15_22_22-Azure Container Registry _ Microsoft Azure

    In Chrome, I get less help

    2020-07-07 15_22_05-Window

    I know that the image path is under /mssql/server, but again, on Firefox, I get to to product home page. On Chrome, I get the same thing.

    2020-07-07 15_24_32-Window

    On StackOverflow, someone suggested a /v2 in front of the image path, and adding a /tags/list to the end. I did that and got redirected to this long URL: https://mcrflowprodcentralus.data.mcr.microsoft.com/mcrprod/mssql/server?P1=1594158334&P2=1&P3=1&P4=Aszj4JeNRzzbgvYq1xWs5CNXVSSIubeP%2FOko5OfNcpk%3D&se=2020-07-07T21%3A45%3A34Z&sig=ZVZdW1JcHuONk7pFh%2BGo%2FV8V6I7HKaLDsrAz0ru6dIA%3D&sp=r&sr=b&sv=2015-02-21

    2020-07-07 15_29_26-Mozilla Firefox

    That works since it apparently gets me the Docker API with the v2.

    The main problem for me was that I wanted to get the latest 2019 image, without using latest. I tried this:

    docker pull mcr.microsoft.com/mssql/server:2019-CU1-ubuntu

    However, that doesn’t work. Apparently, since there are now two versions for Ubuntu, I need to add a – with that. Either a 16.04 or an 18.04.

    Maybe I’ll remember that.

    SQLNewBlogger

    Containers are going to be important at some point and knowing how to work with them will be a desired skill. As I try different things, taking 10 minutes to document some knowledge is good. In this case, I give an interviewer a good reason to ask me if I actually remember this.

  • Getting the Proc Code–#SQLNewBlogger

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

    I saw a question recently about getting the code in a stored procedure. I’ve become dependent on SQL Prompt, which gives me a nice preview of code when I see a proc:

    2020-06-30 16_42_34-ObjectDefinitionBox

    The main way I’ve gotten code is right clicking a proc in Object Explorer and clicking Modify. That opens up an ALTER statement for the proc.

    2020-06-30 16_42_44-

    However, there’s one more way to do this: sp_helptext.

    2020-06-30 17_26_18-SQLQuery2.sql - ARISTOTLE_SQL2017.Sandbox (ARISTOTLE_Steve (82))_ - Microsoft SQ

    Not the best solution, but it gives me a quick look from SQL without futzing through a big list in the OE.

    SQLNewBlogger

    This is a quick example of some knowledge that I can use in my regular work. When someone asked the question, I knew the code for procs was stored somewhere, but I wasn’t sure what the proc to get this was. I tried sp_help, but that wasn’t right, so I had to go look up sp_helptext.

    This took about ten minutes to write.

  • Delete a 2020 GitHub Repository–#SQLNewBlogger

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

    I have a lot of GitHub repos, sometimes just set up to test something. Recently I wanted to delete one, but most of the docs on the Internet were out of date. So I wrote this one.

    The help docs say to find the Danger Zone for your repo. I didn’t see this as an item under Settings. Instead, I see this.

    2020-06-09 19_35_56-Options

    However, the docs talk about access, so I decided to check the “Manage Access” item on the left. I see options, and since this is a public repo, I see the “Manage” link.

    2020-06-09 19_37_12-Manage access

    This actually scrolls me down, which I might have figured out, but in my view, I didn’t see any obvious idea that there was more below the settings. Instead, I find the Danger Zone.

    2020-06-09 19_37_54-Options

    Here I can click “Delete this repository” and it’s gone. Well, it’s gone if I confirm I know bad things happen here.

    2020-06-09 19_38_52-Options

    Be super sure and super careful with this. Be sure you know what happens. If you do this to a private repo, forks go away. That could be really bad in an org.

    SQLNewBlogger

    If you build software, employers want to know how you build software. This post took me 10 minutes to write, and gives someone interviewing me the chance to ask me questions. How, why, etc.

    You can do this for your own reasons.

  • Where are Sequences?–#SQLNewBlogger

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

    I created a few sequence objects lately to test some things. Since I tended to create and use these, I knew the names. Coming back a few days later, with new queries, I wondered where these were stored. This post shows a few things I learned.

    SSMS

    Where would you think Sequences are stored. They are a weird object, with the NEXT VALUE FOR syntax being used. This feels DDL-ish. However, if we look at the Object Explorer, there aren’t a lot of choices here.

    2020-05-12 10_36_03-SQLQuery7.sql - ARISTOTLE_SQL2017.way0utwest (ARISTOTLE_Steve (56))_ - Microsoft

    The area that seems most promising is Programmability, and when I check here, I see them.

    2020-05-12 10_37_00-SQLQuery7.sql - ARISTOTLE_SQL2017.way0utwest (ARISTOTLE_Steve (56))_ - Microsoft

    If I look at the properties, I can see the settings, which is good. I especially like seeing the current value.

    2020-05-12 10_37_20-Sequence Properties - MyKey

     

    T-SQL

    Since this is an object, it ought to be query-able from T-SQL. sys.objects is a good place to start, and when I query, I see this:

    Sequence object results from sys.objects

    Good, but not a lot of information here. With SQLPrompt, I do see there is another choice, sys.sequences.

    SQL Prompt Intellisense with sys.sequences

    If I query this DMV, I now see the same information from sys.objects at the top of the result set.

    First few columns of sys.sequences

    If I scroll, I can see more of the metadata I am looking for. Last_used_value is important, though I wonder what caching does here. A post for another day.

    metadata for the sequence from the DMV

    ADS

    Azure Data Studio has an Object Explorer, but it’s not as useful, as you can see. No options to get data. In ADS, I’d query the DMV.

    Azure Data Studio Object Explorer with just a Refresh option

    SQLNewBlogger

    This was a quick post, as I tried to find information. Once I did, which took just a minute, I decided to spend 5-10 minutes assembling this post and trying the various tools to get information.

    A quick look at how I find the information. You could focus a small post in this way on some learning effort you make.