Geeks With Blogs

News Microsoft MVP

Catch me on FaceBook too!

la familia
Title Of Blog SQL
Determine all foreign keys in a database
Quick script to determine all foreign keys in your SQL Server database:SELECT AS ForeignKey, OBJECT_NAME(f.parent_object... AS TableName, COL_NAME(fc.parent_object_id, fc.parent_column_id) AS ColumnName, OBJECT_NAME (f.referenced_object_id) AS ReferenceTableName, COL_NAME(fc.referenced_obje... fc.referenced_column_id) AS ReferenceColumnName FROM sys.foreign_keys AS f INNER JOIN sys.foreign_key_columns AS fc ON f.OBJECT_ID = fc.constraint_object_id ......

Posted On Wednesday, January 9, 2013 9:05 AM

Auto-hydrate your objects with ADO.NET
Recently while writing the monotonous code for pulling data out of a DataReader to hydrate some objects in an application I suddenly wondered "is this really necessary?" You've probably asked yourself the same question, and many of you have: - Used a code generator - Used a ORM such as Entity Framework - Wrote the code anyway because you like busy work In most of the cases I've dealt with when making a call to a stored procedure the column names match up with the properties of the object I am hydrating. ......

Posted On Wednesday, April 11, 2012 9:50 AM

Entity Framework 4 - When you can use Parameterized Constructors in Select
Skip to the bottom if want the quick answer ;-) Just a quick note on something I ran into today... I've taken to utilizing a View Model in which objects are created on a 1 to 1 basis to hold entities supplying data to the View/UI. As such, I modified my existing linq queries such that the View Model objects are created in the select portion of the query resulting in an enumerable list I can supply to the View. Below is an example: IQueryable<sessionfoo> fooquery = ((IEnumerable<sessionfoo... ......

Posted On Thursday, September 22, 2011 3:09 PM

Why is my query soooooo slow?
A stored procedure used in our production environment recently became so slow it cause the calling web service to begin timing out. When running the stored procedure in Query Analyzer it took nearly 3 minutes to complete. The stored procedure itself does little more than create a small bit of dynamic SQL which calls a view with a where clause at the end. At first the thought was that the query used within the view needed to be optimized. The query is quite long and therefore easy to jump to this ......

Posted On Monday, January 31, 2011 10:19 AM

Copyright © Jake Rutherford | Powered by: