sqlserver

Name Your Defaults So SQL Server Doesn't

Andy Levy
Something in SQL Server that isn’t always obvious to beginners is that when you create a default value for a column on a table, SQL Server creates a constraint (much like a primary or foreign key). All constraints must have a name, and if one isn’t specified SQL Server will generate one for you. For example: 1 2 3 4 5 CREATE TABLE [dbo].[point_types] ( [typeid] [int] NOT NULL DEFAULT(NEXT VALUE FOR [pointtypeid]) ,[typename] [nvarchar](30) NOT NULL DEFAULT 'Unspecified' ,CONSTRAINT [PK_PointType] PRIMARY KEY CLUSTERED ([typeid] ASC) ) We’ve got a simple table here and both fields have a default value set (the primary key’s value is generated from a sequence object, pointtypeid).

Don't Trust the Wizard

Andy Levy
If you need to move data from one table into a new table, or even tables in a database into another database, the Import/Export Wizard in SQL Server Management Studio looks pretty tempting. Set up a source & destination, click a few buttons, kick back with a cup of tea and watch the progress bars, right? It turns out that the wizard just isn’t as smart as it may seem.

Padding Fields for Fixed-Position Data Formats

Andy Levy
Fixed-position data formats will seemingly be with us forever. Despite the relative ease of parsing CSV (or other delimited formats), or even XML, many data exchanges require a fixed-position input. Characters 1-10 are X, characters 11-15 are Y and if the source data is fewer than 5 characters, we have to left-pad with a filler character, etc. When you’re accustomed to working with data that says what it means and means what it says, having to add “extra fluff” like left-padding your integers with a half-dozen zeroes can be a hassle.

Connecting SQLite to SQL Server with PowerShell

Andy Levy
This post is part of Ed Leighton-Dick’s SQL New Blogger Challenge. Please follow and support these new (or reborn) bloggers. I’m working with a number of SQLite databases as extra data sources in addition to the SQL Server database I’m primarily using for a project. Brian Davis (blog|twitter) wrote a blog post a few years ago that covers setting up the connection quite well. In my case, I’ve got nine SQLite databases to connect to, and that gets tedious.

PASS Summit: Things to Do, People to See

PASS Summit is nearly upon us. I’m excited to be attending my second Summit in Seattle and cannot wait to get there to see everyone. With one Summit and a few SQL Saturdays under my belt I’ve got a laundry list of things and people I can’t miss, and very little time to pack it all into. Let’s Meet! The greatest part of Summit (and SQL Saturday) for me is meeting people and exchanging ideas.

SQL Saturday Trip Report - Cleveland 2014

Andy Levy
This past weekend I made the journey to Cleveland, OH (Westlake, actually) for SQL Saturday #241. I’ve attended two local SQL Saturdays in the past (helping organize/run one), but seeing the list of speakers and knowing a few of the local chapter members, I couldn’t pass up the opportunity to visit. Friday I packed my bags and hit the road. It’s about a 300 mile trip so I gassed up, settled in with my backlog of podcasts and set the cruise control.

My First Windows Update Gone Bad

Andy Levy
I don’t think I’ve ever had a Windows Update go bad - until this week. I recently upgraded to Office 2013 and late Monday afternoon, decided to check in with Windows Update prior to our company’s normal monthly patching to see how bad the damage would be. Nearly 1 GB of updates, thanks to my fresh Office install. But there were also a couple optional updates, including a .NET Framework update.

T-SQL Tuesday #39 - Here's what my PoSH is cooking

Andy Levy
My first official entry for T-SQL Tuesday (my first was a guest post hosted by Kendal Van Dyke (blog|twitter), so I’m not really counting it) is brought to you by PowerShell, or PoSH. Ever since I discovered PoSH and really dove into learning it a couple years ago, my co-workers have gotten a bit annoyed by my insistence upon using it for everything. It is my favorite hammer, and around me I see nothing but acres and acres of nails.