Category Archives: Database

Embrace AND! in your way of living.

A good acronym might be..  Abundant  natural  decisions

Activity N___ 🙂  determination.
But I was mainly saying, try to do a little bit of both things you enjoy.

Advertisements

Mad Pass meet up on SQL server temporal tables

Went to this topic this evening and it was great info and good demos to see the features in action too. Depending on the syntax you use, you can hit the normal table only, the history:  dbo_history.tableName, or with by using tableName as system_time.  Check out mean for more in depth info. They explain it way better than I can: https://msdn.microsoft.com/en-us/library/dn935015.aspx

 It’s a newer feature.. And needs sql2016, yet another reason to upgrade 🙂

SqlSaturday Madison, WI 2016 reflection

If you’re in the database sector from time to time, check out in person events (and virtual events) at http://www.sqlpass.org/. It’s a great learning day and networking opportunity as well 🙂 These types of events seem to, without fail, help increase passion for working with IT tools and realize again why we’re in the field – to help end users and customers have a more feature-rich experience and be more quickly able to make business decisions.

I’m thankful I had the opportunity and great pleasure of attending this event. Was my first conference on the database side. I was very pleased by the variety and quality of sessions on topics of database, BI analytic, and reporting tools.

I had picked a mixture of Tuning, Reporting, and Azure sessions, which was great to learn more in depth about cloud based databases through Microsoft. I was surprised of the settings and tooling power shown inside of the Azure portal. Great stuff to be able to set alerts under certain performance conditions.

Have you gone to tech conferences as well, and how did it compare to your expectations? If you haven’t gone to a conference or meetup yet, I’d highly recommend it.

Instructions for Setting up Entity Framework 6 and Data Test Project‏

I had gone through a lot of days of futzing to make this work and thought others may benefit from this as well. Instructions are included for both VS2010 (at the very end) and VS2015.

VS2015

VS2015 is much easier than VS2010, as both the Entity Model and the DBContext generator (pick either version 5 or 6, depending on your needs), as they are right in Add New Item’s dialog box under “Data” subsection.

Project settings modifications

Your DAL project will need to have the app.config set to Your unit test project then needs 2 things:

Adding a Reference to EntityFramework.dll in the Data Test project, to match the same EF reference item from your Data project.

And a post build step to bring in the config, otherwise your EF Integration tests will fail saying it can’t find the connection. Exact command that I’d used is not a perfect outcome compared to a file move, as this does a copy:

copy App.Config $(TargetName).config.

 post20build20step_zpsrrirz1ju

VS2010

If in VS2010, first add a ADO.NET Entity Data Model.
Then search for “Entity” and add the Nuget Package for EntityFramework 6.x.  Note, you won’t be able to use the designer though, so I’d highly recommend getting VS2012 or higher.

 Enjoy, and happy DAL coding!

Deleting a limited amount off records in MSSQL

It’s been awhile since I’ve done it and today had a need for it. Kept getting “incorrect syntax near 5”

I got bit by the fact that parens are needed around the number value.

So what a person needs to do is:
    DELETE TOP (5) FROM YourTableName

Make sure you put an appropriate ORDER BY on your sql statement and also wrap it in a transaction as to not delete haphazardly without verifying.

MSSQL – Selecting from objects listed from sp_help and getting “invalid object name”

Earlier this week I was looking up some tables in SSMS via alt+f1 (the sp_help command) and got invalid object. It was baffling me for several minutes until I looked in object explorer and had a different scheme name.

Goes to show you that the Owner value isn’t always the same as scheme, of course that makes sense as they are 2 different things: owner is more so for security and scheme is a separate location or container for db objects  🙂