Category: Blog

  • Daily Coping 1 Jul 2021

    I started to add a daily coping tip to the SQLServerCentral newsletter and to the Community Circle, which is helping me deal with the issues in the world. I’m adding my responses for each day here. All my coping tips are under this tag. 

    Today’s tip is to share a friendly smile when you encounter someone else today.

    This has been something I’ve tried to do over the last year, but when wearing a mask, it’s tough to know if a smile is received.

    When we stopped wearing masks in the gym (for vaccinated people), one of my yoga instructors noted that it was nice to see faces and smiles after so many months. I felt the same way.

    Not everyone is in the same place, and even though we have people in my area not wearing masks, some are nervous, some struggling with the aftereffects of a year of the world changing, not working, etc.

    As a result, smiles as still important. They help many of us continue to cope with the world.

    I was in Florida recently for a sports event, and while many people were not masked, officials were (by requirement). Some were upset, some didn’t care, and often they pulled them down to talk with me when I was acting as the second official. However, I tried to smile a lot and welcome them when they came over.

    I definitely ended up getting along with them better than some other coaches Winking smile

  • Setup Full-Text using T-SQL–#SQLNewBlogger

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

    I wrote a previous post on how to set up full-text searching (FTS) and indexes in SSMS. This post looks at the T-SQL equivalent.

    Everything in SSMS uses T-SQL under the covers. Often, you can get the code from a dialog in SSMS and use that for repeatable operations. For FTS, that’s not the case. When we get to the end of the wizard, there is no “Script” button.

    2021-06-28 15_04_32-Full-Text Indexing Wizard

    there isn’t one on other screens, either. This is an omission (and bug in) from SSMS, IMHO.

    In any case, we need to do these things:

    • create a catalog
    • create a full text index
    • populate the index

    That’s what we’ll do.

    Create a Catalog

    A FTS catalog is a logical group of FTS indexes. That’s it. This is used to be a way to decide where indexes are stored, as you can choose the filegroup for these. However, after SQL Server 2008, the storage decisions (path or filegroup) have no effect.

    Now we really run this:

    CREATE FULLTEXT CATALOG name

    We can add accent sensitivity or a default setting (or an owner), but really we’re just picking a name here for the most part.I’ll run this:

    CREATE FULLTEXT CATALOG FTSCat

    That gives me a place to put indexes. I can create multiple catalogs, if needed.

    Creating FTS Indexes

    The next step is to actually create an index. The basic syntax uses the CREATE FULLTEXT INDEX DDL, with the table and column. We need a PK on the table for this to work, so make sure your table has one.

    We can add some options for language, statistical semantics to be gathered, and population parameters. All of those are documented in the Docs. To create a basic index you can use, this is what I’ll do. First, here’s my table.

    CREATE TABLE dbo.FTS2
    (   myid INT NOT NULL CONSTRAINT FTS2PK PRIMARY KEY
       , Val  VARCHAR(2000));
    GO

    Next, let’s create the index. I want to index the val column in this table. I’ll use this statement:

    CREATE FULLTEXT INDEX ON dbo.FTS2(Val) KEY INDEX FTS2PK ON FTSCat

    This statement lists the table and the column(s) in parenthesis, much like any other index. I need to provide the unique index used to track rows, which in this case is the PK. I also give the catalog on which I store this index.

    Once this is done, the index is created. This auto populates by default, which means I can query using the CONTAINS() function to search.

    Populating Indexes

    If I had specified manual population for the index, then I’d need to populate it myself. Plenty of people want to choose the time to populate indexes, as this can be resource intensive.

    To do this, the ALTER INDEX can be used to start this. This is simple with the START FULL POPULATION (or UPDATE POPULATION) command.

    ALTER FULLTEXT INDEX ON dbo.FTS2 START FULL POPULATION

    That’s it.

    Summary

    This post essentially duplicates what I did in the previous post, but with direct T-SQL instead of using the GUI. It’s always good to know both ways to accomplish something, especially as the GUI might not contain an option you want to use.

    SQLNewBlogger

    This was easy to do after the previous post. I essentially repeated everything, except I had to look up the T-SQL for each step to check syntax.

    This is a great example of showing some learning, and adding depth to a previous post. Easy to do, another item that can impress an interviewer.

  • Daily Coping 30 Jun 2021

    I started to add a daily coping tip to the SQLServerCentral newsletter and to the Community Circle, which is helping me deal with the issues in the world. I’m adding my responses for each day here. All my coping tips are under this tag. 

    Today’s tip is to make a list of joys in your life over the last 30 days.

    A simple list, things that have gone well in 30 days.

    1. All my kids were together for (Mother’s and) Father’s days.
    2. An exciting and fun time coaching a tournament in a hotel
    3. Another fun time coaching, and traveling out of state, to coach
    4. Vacation in a new place, Key West.
    5. Bucket list item, drive US1 from Miami to Key West
    6. Submission accepted for an event
    7. New lawnmower Winking smile
    8. Put a hitch on my wife’s car, which involved some learning, a new tool, and some time with one son
    9. Fixed my sprinkler system with my son, which was leaking.
    10. New master bathroom after renovation
    11. Got together 3 times with friends to share some time together.
    12. A few date nights with my wife.
    13. Maintenance on 3 vehicles complete.
    14. Moved a trip that would have really jammed me up for time and created stress.

    It’s been a good month

  • Daily Coping 29 Jun 2021

    I started to add a daily coping tip to the SQLServerCentral newsletter and to the Community Circle, which is helping me deal with the issues in the world. I’m adding my responses for each day here. All my coping tips are under this tag. 

    Today’s tip is to notice how positive emotions help you improve your mood.

    Over the years I’ve found that the way I view a situation often affects how I feel about it. I get upset, or angry, or sometimes don’t think about anything other than how the situation affects anyone other than me.

    Often when I view things differently, I feel differently.

    I had planned on going to a user group meeting recently. It was the first in person one, and I was excited. I wanted to see who showed up, and how the organizers ran the event. I let myself get a late start from home and was hungry. I stopped to grab a sandwich, trying to avoid fast food, and ended up waiting a little long. The place was busy, and they were working hard to manage a number of online orders as well as handle the lunch crowd.

    I stood there, stressing a bit. All my cushion to get to the meeting was disappearing. I finally got my sandwich, jumped in the car, and race over. I get there to discover that the meeting is next month. I was so excited, I mistook July for June.

    I could have been upset, angry, etc. Instead, I laughed at myself a bit and was amused that my excitement for a user group caused the issue. I looked at it as a positive thing. I’m ready for live meetings, and that’s good.