Datatypes and Decimals

Every once in a while I have a numeric field that needs to have the digit or two after the decimal point, even if that number is zero. Last time, this was when I was documenting a software version in a numeric field, and today I ran into the same issue with an A1C value that I took from a “float” field and inserted into a varchar field. This created duplicate values which did not match. (8.0 from a competing source, 8 from this source.)

I’m pretty sure there’s a bunch of fancy stuff I don’t know yet with datatypes and how to format them, but for this one issue, I was able to look back into my email and find Joe Sweeney‘s very helpful response to my question last time:

“A numeric type is defined by numeric(p,s), where p is precision (how many digits total) and s is scale (how many digits after the decimal).”

I have read about scale and precision before, but it was so nice to have it stated so simply.

With this knowledge, I am attempting my very first column. Here goes:

ALTER TABLE DMProject.dbo.AllA1CRegLabResults

Phew! It worked. My data didn’t disappear, and the whole numbers now have a “.0” after them. Hurray!


MVA DML Statements – Adventureworks Queries

Time for me to follow along – perhaps you’d like to as well. I’m working in SQL Server 2014 Express today. I have 2016 Express installed on my personal computer as well. However, I’m using Adventureworks 2014 for both, so my results should be consistent on either computer.

Here is the first Adventureworks-compatible query from MVA’s DML Statements lecture:

Select Specific Columns and Use a Where Clause
Select Specific Columns and Use a Where Clause

(I do add the semicolon at the end of my statements – which the lecturers do not do.)

As you can see, this query returned 50 rows (bottom right-hand corner), and it includes the columns from the SELECT clause.


More to come 🙂


SQL Server 2016 Developer Edition Free

w/ Visual Studio Dev Essentials Program

I ran into this bit of info today and thought I’d pass it along. I don’t know that I need (or will ever need)  this edition or the Visual Studio Dev program, but it seemed a bit exciting.

The article does warn that the free offering cannot be used in production environments, whereas Express can be.

I haven’t decided what I should do yet – I have never even opened up Visual Studio. But I have sent a note  to the smartest person I know on the matter – Joe Sweeney – in hopes for some guidance.

I shall report back.