LessThanDot Site Logo

LessThanDot

A decade of helpful technical content

This is an archive of the posts published to LessThanDot from 2008 to 2018, over a decade of useful content. While we're no longer adding new content, we still receive a lot of visitors and wanted to make sure the content didn't disappear forever.

Using WITH RESULT SETS with stored procedures that return multiple resultsets

Yesterday I blogged about using WITH RESULT SETS with the EXECUTE command here: Use WITH RESULT SETS to change column names and datatypes of a resultset. Naomi Nosonovsky left the following comment Can you use this feature to get result sets from the stored procedure returning multiple result sets such as sp_spaceused? If so, can you show this? So today we are going to look at how we can do this.

Read More...

Use WITH RESULT SETS to change column names and datatypes of a resultset

SQL Server 2012 has added WITH RESULT SETS to the EXCECUTE command. You can now override the data types and names that the resultset is returning Here is one example where we change the name of the column from name to TableName EXEC ('SELECT name FROM sys.tables' ) WITH RESULT SETS ( (TableName nvarchar(100)) ); TableName ----------- DimAccount DimCurrency DimCustomer DimDate DimDepartmentGroup Of course we could have just aliased it as well instead.

Read More...

SQL Saturday #187 – Richmond, VA

I attended my very first SQL Saturday in Richmond, VA this past weekend and it was great! I wish I had been better prepared for it but at least I now know what to expect and will be better prepared for the future. That being said, though, it was a terrific experience that I wish I had done sooner and one I do not intend to miss again in the future.

Read More...

Crazy stuff I do with Nancy

No, not that. I had the need to write documentation for my services. I thought having them as html would be nice and good enough. So I made a bunch of vbhtml razorviews because I want my pages to be pretty and use the masterpage I already made for my main site. You know, to be consistent. So I had this. page1.vbhtml page2.vbhtml page3.vbhtml page4.vbhtml index.vbhtml And to show those pages I just have this in my module.

Read More...

Goodbye Google Reader, hello feedly

Yesterday, the following was announced We launched Google Reader in 2005 in an effort to make it easy for people to discover and keep tabs on their favorite websites. While the product has a loyal following, over the years usage has declined. So, on July 1, 2013, we will retire Google Reader. Users and developers interested in RSS alternatives can export their data, including their subscriptions, with Google Takeout over the course of the next four months.

Read More...

Why you should not add formats to Microsoft Access tables

Access Version: All One of the problems with MS Access is that it allows you to do a lot of things that you really should not do, for example adding formats to tables. Here is why adding formats to tables is a bad idea. 1. Create a table This table has an ID and a Date duplicated to provide 4 fields, 2 of which have formats applied, as you can see below.

Read More...

Wrap inserts in a transaction for faster performance

Sometimes you have to insert a bunch of data and you can’t use BCP or another bulk load method. When you do single row inserts, SQL Server wraps these inserts inside an implicit transaction. Did you know that if you use an explicit transaction that the inserts will be much faster? I touched upon this earlier in this post MongoDB vs. SQL Server – INSERT comparison part deux but since someone asked about this today, I decided to take another look with different run sizes as well

Read More...

Nancy, IIS 7 and the PUT command

When you use PUT in your Nancy application and you host your application on an IIS 7 server then you might get a 405 error (Method not allowed). The solution to this problem is very simple but I will put it here for me. The problem is that you might have the webdavmodule installed on your IIS and that is gobbling up all the PUT requests. So the simple solution is to remove the webdavmodule.

Read More...

Triggers affect on SQL System Variables

A while back I ran into an issue where a user was complaining about @@IDENTITY not always returning the value they expected. This was happening on a table that was setup using 3rd party cross database platform replication software. The software used triggers to capture the changes to the table to send them over to an Oracle table and a DB2 table. The issue was caused by the trigger inserting records into another table that also had an identity column and that was being returned instead of the one from the original insert.

Read More...

Using SELECT * in views gotcha

If ever a DBA walked up a mountain and came back down with two stones that had 10 commandments written on them, “thou shalt not use SELECT *” would be one of them. However, that same DBA would turn around and within 5 minutes use it themselves! One place that DBAs use SELECT * is when they create views. The idea is that you do actually want every column available to the view because the query that hits that view should limit which columns it wants returned.

Read More...