I've been working with with TSQL (MS SQLSERVER), lately and 'learned' a lot about it recently. Don't get me wrong, I've been writing sophisticated SQL reports for more than 10 years, and I know a lot about SQL and I'm quite familiar with it. But that's what I was doing writing reports.
As you may know if you are writing a basic report there are three key parts of a SQL statement the SELECT clause, where you output goes, the FROM clause where your table and table relationships go, and the WHERE clause where you choose what data you want to display. (Yes, I know there's ORDER BY, GROUP BY, UNION, etc, but I'm trying to make a point not teach anybody SQL.) What I have discovered is that I've been subtly trapped in this paradigm. If it needs to be output its in the SELECT clause, if it needs to be chosen its in the FROM clause, I may nest SQL statements, but in the end I'm stuck in this single statement framework
I've been able to continue on in with this narrow perspective because, if I may say so myself, I'm pretty good at improvising and finding work arounds, so why should I try something new (its not like I don't know about this stuff), when this works. And besides multiple statements, table variables, where loops, if-then statements, and the like are for something more sophisticated than just reports. And doing it this way does work, but sometimes it's slow, confusing, or just downright frustrating. This week I got past that and wrote a report with multiple statements, table variables, a where loop, and an if-then statements, and it was quite enlightening. I'll never look at SQL the same way, and hopefully I'll remember that there may be more to whatever language I'm using at the time then what I'm working with now. So, perhaps I should climb out of my comfort zone and look around.
P.S. Yes, I'm know I'm a geek because I get excited learning new programming language elements.
Wednesday, March 14, 2012
Sunday, February 26, 2012
A Little Data Validation, Please?
I've been working on an implementation where part of the process is importing about 2 million lines of data using a tool developed by the software vendor. A large part of their data is stored in the database as a sql_variant (dynamic data type). Once the data is imported , the program processes some of this data and expects a specific data type. Unfortunately there is no data validation during the import process, so, when a bad piece of data gets into the database you get a nifty cryptic error line 'unable to convert nvarchar to int'. (Better error messages would be nice, too.) The root cause of this problem, however, was ignoring data validation. When you use dynamic data types you have to do your own input validation, you can't count on database or the user to do it for you. I know this is very obvious but apparently it was missed in this case. Because of this the database is currently unusable, and someone will have to spend a significant amount of time figuring out where the bad data is.
Friday, December 23, 2011
Fixing my foot wound
I just know from outpouring of concern, you are just dying to know how I resolved my Java/SQLServer 2008 issue. So I shall tell you.
I happened to have a 2 month old snapshot of my development Virtual Machine, so I pulled the cached copies of the old install .debs and forced them to install on my current system. Everything works (except for a broken dependency warning ) now.
Now I just have to wait, and test, to see when the problem is really solved and I can update my system.
I happened to have a 2 month old snapshot of my development Virtual Machine, so I pulled the cached copies of the old install .debs and forced them to install on my current system. Everything works (except for a broken dependency warning ) now.
Now I just have to wait, and test, to see when the problem is really solved and I can update my system.
Sunday, November 27, 2011
Shooting Myself in the Foot
I went through a lot of effort recently to create development system to 'isolate' it from my usual pc activities so that my development system would remain stable.
Then what did I do?
I installed a java update without testing it and now a critical process i need (jdbc to sqlserver 2008) is broken.
And, did I have a backup of java ? NO.
So now I will pay the price of having to figure out how to get this to work again.
What did I learn?
1. Backup your programming environment not just your source code (Possibly in git)
2. Test all updates (I'm running a VM so I can make a snapshot)
I guess the moral of the story is "Experience is what you get when you don't get what you want."
Then what did I do?
I installed a java update without testing it and now a critical process i need (jdbc to sqlserver 2008) is broken.
And, did I have a backup of java ? NO.
So now I will pay the price of having to figure out how to get this to work again.
What did I learn?
1. Backup your programming environment not just your source code (Possibly in git)
2. Test all updates (I'm running a VM so I can make a snapshot)
I guess the moral of the story is "Experience is what you get when you don't get what you want."
Saturday, November 19, 2011
7 Reasons Why I still like VI
I cut my teeth on UNIX 25 years ago and the first text editor I ever leaned to use was vi (on AT&T UNIX) . Over the last 25 years computer interfaces have progressed from ASCII to GUI and programming has progressed from command line to IDE's and I've moved along with with then. But recently I moved my development system from Windows to Linux and had rediscovered VI. Here are my 7 reasons that I still like it and one new one:
- It runs in pretty much any terminal environment
- Being able to open and edit multiple files with a wildcard from the command line
- sed scripts for mass edits
- You can delete a word or a series of words with 2 or 3 keystrokes
- The dot (.) repeat last command key
- Never having to touch a mouse
- Being able to impress younger colleagues
One new reason that vim provides:
- Groovy Syntax highlighting
By the way you can install vim on your windows machine too so you can have these advantages anywhere.
Wednesday, September 21, 2011
Is Groovy Relevant Part Deux
One of the discussions at the NFJS conference last weekend was on this very subject. (See my earlier post.)
So maybe I'll move out of my doldrums now.
- I learned that there is more Grails acceptance in the 'back office' than I was aware
- Every Session on Language had references to Groovy (even if it wasn't the subject) and typically they were quite positive.
- Also I saw this article in eWeek (has nothing to do with NFJS).
So maybe I'll move out of my doldrums now.
Tuesday, September 20, 2011
This Years Resolutions
Went to to NoFluffJustSuff in Atlanta this weekend, this is a great conference and I always come out of it with new resolutions to improve my programming. I decided on two major areas to work on: First, start using some kind of version control (I don't even think I need to justify this one). Second, learn a functional programming language since this is a paradigm that I'm not familiar with, and it should help me round out my programming skills.
As for the first item, I downloaded git (its all the rage among the open source folks) and I've started using it. It's surprisingly easy to implement for simple version control that I've tried. You can update and save changes with just two commands. The windows version even has a GUI menu.
As for the second item, I downloaded a copy of clojure which is a lisp-like language that runs on the JVM. While git was easy to figure out, functional programming with clojure is anything but. I have to change my whole perspective form the hybrid OO/procedural method I use now. (And there are way too many list types too) . We will see how that goes.
I'll try to keep you updated on my progress.
As for the first item, I downloaded git (its all the rage among the open source folks) and I've started using it. It's surprisingly easy to implement for simple version control that I've tried. You can update and save changes with just two commands. The windows version even has a GUI menu.
As for the second item, I downloaded a copy of clojure which is a lisp-like language that runs on the JVM. While git was easy to figure out, functional programming with clojure is anything but. I have to change my whole perspective form the hybrid OO/procedural method I use now. (And there are way too many list types too) . We will see how that goes.
I'll try to keep you updated on my progress.
Subscribe to:
Posts (Atom)