Daily Coping 24 Aug 2022

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 be kind online. Share positive and supportive comments.

“Are you a better version of yourself online?”

I had someone ask this question a few years ago and it struck me as something I should pay attention to often. When I post something, is it something I’d say face to face? Is it something that I might be embarrassed about with my kids or my Mom? Am I improving my reputation with friends or strangers or making it worse?

All things I think about. Since then, I try to mentally behave and be a better person online. I might lightly joke, troll, or pick on friends, but I do make an effort to be positive and supportive.

Posted in Blog | Tagged , , | Comments Off on Daily Coping 24 Aug 2022

Daily Coping 23 Aug 2022

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 if someone annoys you, be kind. Imagine how they may be feeling.

I had the chance to chat with an acquaintance recently at a social event. They were dismayed at the state of the world (politics, finance, and more), as well as how annoying various things in their life had been. I found myself a little annoyed by all the negativity.

However, I’d been thinking about this tip, not specifically, but in general across the last few years. I’ve made an effort to try and understand and empathize with other points of view. My goal is not to argue the point, but put myself in someone’s shoes to better appreciate their reaction.

In this case, I could understand why certain things bothered this person, or why they were negative about things in life. It isn’t the reaction I usually have, nor to I ascribe the same level of importance that this person did. Of course, I wasn’t in the situation, so maybe I’d act similarly at times.

I let their complaints wash over me, and listened, letting them complain. I also thought a bit about how I’d hope I would react differently, find a way to change things or get beyond them rather than just complaining.

Posted in Blog | Tagged , , | Comments Off on Daily Coping 23 Aug 2022

Import a CSV with a Header Row using BCP–#SQLNewBlogger

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

I was demoing something recently and needed to show someone how to grab some data from a CSV text file. Since this was a task the person needed to do regularly, but with different files, they wanted to ensure this was programmatic from a command line call outside of SQL Server. They knew the basics of bcp, but weren’t sure how to deal with a header row.

This is actually fairly simple as you will see.

BCP Basics

I have a simple file that looks like this:

Time,System Production (Wh)
08/01/2022,"58875"
08/02/2022,"61260"
08/03/2022,"60866"
08/04/2022,"66395"

I have a basic table of this structure:

CREATE TABLE [dbo].[Stage](
     [ProdTime] [varchar](20) NULL,
     [ProdValue] [varchar](100) NULL
) ON [PRIMARY]
GO

This is just a demo import from this sample file. If I run a basic bcp command, I’d typically run this:

bcp dbo.stage in export.csv -S Aristotle\SQL2017 -d way0utwest -T -t "," –c

This runs easily, as you see below:

2022-08-17 12_56_58-D__Downloads

However, this is my data:

2022-08-17 12_56_51-solarloading.sql - ARISTOTLE_SQL2017.way0utwest (ARISTOTLE_Steve (69))_ - Micros

That’s not right. The first row is a header row, and while I can quickly and easily fix this, it’s better not to have to process this. Easier to fix this on the import.

To do this, I need to look at the bcp documentation and include a flag. The –F flag is for the first row, which I want to set to 2. If I truncate the table and run this command:

bcp dbo.stage in export.csv -S Aristotle\SQL2017 -d way0utwest -T -t "," -c -F 2

I see these results:

2022-08-17 13_02_04-solarloading.sql - ARISTOTLE_SQL2017.way0utwest (ARISTOTLE_Steve (69))_ - Micros

No header row. There are still issues with this import, but this solves one problem, which is what the SQL New Blogger post is for.

SQLNewBlogger

This is a quick example of a post that is part of my daily work. I was showing a customer this, and I had to mock something up, so I grabbed a little sample data and did that.

I spent about 15 minutes around other work getting this post written and screenshots taken. You could do this as well and show how you import data in a cleaner fashion.

Posted in Blog | Tagged , , | Comments Off on Import a CSV with a Header Row using BCP–#SQLNewBlogger

When Is Technology Good Enough?

I just paid off my mobile phone. In my case, this is a phone from Google Fi, which provides fantastic service for me. The phone works well in any country I travel to, without any extra roaming costs outside the US for data. That works well, since it’s a data device, and not really a voice device for me. Even overseas, lots of my calls are through some data service, like Facebook Messenger.

The decision for me now is whether to upgrade my phone. I’ve been getting some promotions and I’ve seen some deals from other retail outlets on phones, so I’ve been considering changing my Galaxy S20 for an S22 (perhaps plus) or a Pixel 6. There have been some improvements in cameras, and those are really the only change I’d notice.

Mobile devices have mostly become a commodity for me. The screen is a certain size, and the camera has a quality level, but outside of this, I don’t know that I’ve noticed much of a change in how I use the device or what I notice in quite a few years. If the screen and camera are the same, one phone is fairly interchangeable with another. Even the battery doesn’t seem to change that much between phones.

I think the same thing is true for databases for many of us. A lot of applications, and even developer T-SQL, target the basics of what a relational database platform provides. I suspect most of our needs could be served by MySQL or PostgreSQL as well as SQL Server. Apart from changing the dialect of DDL and DML we write, all those systems work well. In fact, I suspect most of what is run against the SQL Servers backing SQL Server Central could work against an older version such as 2005 or perhaps even 2000.

Some of you use newer features. Plenty of people have learned to use Window functions and the OVER() clause. Some of you might use In-memory tables. Others certainly need Availability Groups. However, a majority of code I see uses nothing newer than a CTE, which means they could run in SQL Server 2005.

A new version of SQL Server is coming later this year. SQL Server 2022 is in preview, and there are some neat things in there. Do you need them for your application? Perhaps you could use them, but the better question is will you actually change how you write code to use the new features? Or change how you set up infrastructure? I’d hope that many of you would, but change is hard for humans, and developers struggle as much as others. We get stuck in our habits and tend to work as we have for years.

When is the technology platform, tool, service, or application you use “good enough” for most of your work? I don’t know, but I find myself less excited about newer tech in many cases. Perhaps because I’m old, or perhaps because my needs are relatively simple. Is that the case for your organization?

Steve Jones

Listen to the podcast at Libsyn, Stitcher, Spotify, or iTunes.

Posted in Editorial | Tagged | Comments Off on When Is Technology Good Enough?