
Monday, March 21, 2011
Write emails for testing to a directory instead of sending the via SMTP

Monday, February 07, 2011
WinForm -- set the font color of a listbox or combobox while retaining a white background color even when selected
Convert an XmlDocument to XDocument for use with LINQ. Also provided as an extension method.

Friday, November 19, 2010
Bad hosting experience over at ASPNix -- a review

Tuesday, August 10, 2010
Tip of the Day: Creating a control that displays multiple types of messages using the IValidator interface

Monday, August 09, 2010
My first journey through expression trees and dynamic lambda expressions, and an explanation on how I got there. The end result is a case-insensitive search and a wildcard search function.

Thursday, August 05, 2010
Tip of the Day: Extension method to HTML encode a string

Wednesday, August 04, 2010
Tip of the Day: T-SQL Script to rename bulk columns

Tuesday, August 03, 2010
Retrieve the column name which have uniqie constraints on them in a CodeSmith template.

Thursday, March 11, 2010
Explore the INFORMATION_SCHEMA to get more useful metadata information on your database, much simpler than using sysobjects!

Wednesday, March 10, 2010
Retaining employees after this economy changes needs to start now!

Friday, March 05, 2010
Script to ferret out those procs you forgot to create permissions for!

Tuesday, March 02, 2010
Tip of the Day: Manipulating ASP.Net validators client side

Wednesday, January 06, 2010
How to register class based user controls in a web project

Wednesday, December 30, 2009
Extension method for providing dynamic sorting based on field names of a List
collection.

Tuesday, December 29, 2009
Two useful menu items to help eliminate "using" clutter in VS2008.

Wednesday, November 11, 2009
Adding carriage returns to SSIS package annotations

Saturday, November 07, 2009
More promising features of VS2010

Friday, November 06, 2009
Tip of the day: marking routines obsolete, and enforcing it!

Saturday, October 31, 2009
Some of the great features of Visual Studio 2010 which are very appealing to me!

Friday, October 30, 2009
Using generics to simplify getting data from a SqlDataRow or DataRow object.

Thursday, October 29, 2009
Launch another program, and optionally wait for it to complete.

Wednesday, October 28, 2009
A simple validation routine to validate a string meets the minimum and maximum length requirements.

Wednesday, October 14, 2009
WinForm: The base class % could not be loaded.

Tuesday, September 29, 2009
Using the MasterType directive to programatically access you Master Page.

Friday, September 25, 2009
Placing page trace information in a file instead of on the page

Wednesday, September 23, 2009
Interview question -- the virtual keyword
Fancy tooltips in WinForms!

Tuesday, September 22, 2009
Adding a WinForm tooltip without the control..

Wednesday, September 16, 2009
How to enumerate all the shortcut keys in the Visual Studio IDE

Monday, September 07, 2009
Debugging trick for placing a condition on a breakpoint to assist in speeding up debugging.
How to make the Visual Studio debugger break where the error actually occurs.

Friday, September 04, 2009
Tipf of the Day: A brief discussion of the new Extension Methods in .Net 3.5

Thursday, September 03, 2009
Starting a new project, how to approach it?

Wednesday, September 02, 2009
I can't take credit for this, as I took it from the article How To Get Table Row Counts Quickly And Painlessly on SqlServerCentral.com by Kendal Van Dyke. However, it such a good tip, I had to change it a bit, as I tend to use this a LOT.
First, I made the results a little more "printable" but reducing the table name column. Next, I made it a system proc because when I go onto client sites, I am looking at many databases. I probably don't need to create a procedure for it, but there have been many cases where I trend things, and it would be nice to have this handy. Finally, I added a parameter to allow me to change the sorting. By default, it sorts by table name. I added an optional parameter to allow me to pass in an integer (could have done it a million ways, I know, but I chose to do this solely for my preferences -- feel free to change to yours).
Usage: sp_retrieveRowCounts --- sorts by table name
sp_retrieveRowCounts 1 ---sorts by row count, then table name
Here's the proc:
USE master
GO
IF (SELECT OBJECT_ID('sp_retrieveRowCounts','P')) IS NOT NULL
BEGIN
DROP PROC sp_retrieveRowCounts
END
GO
CREATE PROC sp_retrieveRowCounts (@OrderByCount int = null)
AS
BEGIN
DECLARE @OrderByParm int
DECLARE @SQLStatement varchar(700)
DECLARE @OrderByClause varchar(35)
SELECT @OrderByParm = ISNULL(@OrderByCount,0)
IF (@OrderByParm != 0)
SELECT @OrderByClause = ' ddps.row_count DESC, o.NAME ASC'
ELSE
SELECT @OrderByClause = ' o.NAME ASC'
SELECT @SQLStatement = 'SELECT TableName = LEFT(o.name,50), TotalRows = ddps.row_count FROM sys.indexes AS i
INNER JOIN sys.objects AS o ON i.OBJECT_ID = o.OBJECT_ID
INNER JOIN sys.dm_db_partition_stats AS ddps ON i.OBJECT_ID = ddps.OBJECT_ID
AND i.index_id = ddps.index_id
WHERE i.index_id < 2
AND o.is_ms_shipped = 0
ORDER BY ' + @OrderByClause
EXEC(@SQLStatement)
END
--Mark procedure as system object
EXEC sys.sp_MS_marksystemobject sp_retrieveRowCounts
GO
GRANT EXEC ON sp_retrieveRowCounts TO public
GO

Tuesday, September 01, 2009
When I go onto a client site, I usually don't have the luxury of designing everything from scratch. There are times (like on my current engagement) if I were given the choice, I'd say scrap it, but usually it doesn't happen that way. It is what it is... been saying that a lot lately!
So one of the tools I find useful is the ability to search for particular field names in the database. This is very similar to sp_findsp I use, which I have posted in the past off the net, but I have modified it so it gets registered as a system procedure.
So here's sp_findfields. It will return a fairly printable representation of the results of all fields which match the passed in string. It's registered as a system procedure in this script, so it is accessible to all databases.
Usage:
sp_findfields '%Contact%'
This will find all fields with the string 'Item' in it. Note you need to provide the wildcard characters.
USE master
GO
IF (SELECT OBJECT_ID('sp_findfields','P')) IS NOT NULL
BEGIN
DROP PROCEDURE sp_findfields
END
GO
CREATE PROCEDURE sp_findfields
(@searchText varchar(50))
AS
BEGIN
SELECT SchemaName = LEFT(TABLE_SCHEMA,10),
TableName = LEFT(TABLE_NAME, 35),
FieldName = LEFT(COLUMN_NAME, 40),
DataType = LEFT(DATA_TYPE, 13),
DataSize = CHARACTER_MAXIMUM_LENGTH,
AlloysNulls = IS_NULLABLE
FROM INFORMATION_SCHEMA.columns
WHERE column_name like @searchText
ORDER BY TableName, FieldName
END
GO
--Mark procedure as system object
EXEC sys.sp_MS_marksystemobject sp_findfields
GO
GRANT EXEC ON sp_findfields TO public
GO

Saturday, August 29, 2009
The following code snippets make retrieving values from DataRows safely, and properly casts them to the desired values.
/// <summary>
/// Gets the int value from data row.
/// </summary>
/// <param name="fieldName">Name of the field.</param>
/// <param name="dr">The dr.</param>
/// <returns></returns>
public static int GetIntValueFromDataRow(string fieldName, DataRow dr)
{
return (dr[fieldName] == DBNull.Value ? 0 : Convert.ToInt32(dr[fieldName].ToString()));
}
/// <summary>
/// Gets the int value from data row.
/// </summary>
/// <param name="fieldName">Name of the field.</param>
/// <param name="dr">The dr.</param>
/// <param name="defaultValue">The default value.</param>
/// <returns></returns>
public static int GetIntValueFromDataRow(string fieldName, DataRow dr, int defaultValue)
{
return (dr[fieldName] == DBNull.Value ? defaultValue : Convert.ToInt32(dr[fieldName].ToString()));
}
/// <summary>
/// Gets the string value from data row.
/// </summary>
/// <param name="fieldName">Name of the field.</param>
/// <param name="dr">The dr.</param>
/// <returns></returns>
public static string GetStringValueFromDataRow(string fieldName, DataRow dr)
{
return (dr[fieldName] == DBNull.Value ? String.Empty : dr[fieldName].ToString());
}
/// <summary>
/// Gets the string value from data row.
/// </summary>
/// <param name="fieldName">Name of the field.</param>
/// <param name="dr">The dr.</param>
/// <param name="defaultValue">The default value.</param>
/// <returns></returns>
public static string GetStringValueFromDataRow(string fieldName, DataRow dr, string defaultValue)
{
return (dr[fieldName] == DBNull.Value ? defaultValue : dr[fieldName].ToString());
}
/// <summary>
/// Gets the bool value from data row.
/// </summary>
/// <param name="fieldName">Name of the field.</param>
/// <param name="dr">The dr.</param>
/// <returns></returns>
public static bool GetBoolValueFromDataRow(string fieldName, DataRow dr)
{
return (dr[fieldName] == DBNull.Value ? false : Convert.ToBoolean(dr[fieldName].ToString()));
}
/// <summary>
/// Gets the decimal value from data row.
/// </summary>
/// <param name="fieldName">Name of the field.</param>
/// <param name="dr">The dr.</param>
/// <returns></returns>
public static decimal GetDecimalValueFromDataRow(string fieldName, DataRow dr)
{
return (dr[fieldName] == DBNull.Value ? 0 : Convert.ToDecimal(dr[fieldName].ToString()));
}

Friday, August 28, 2009
I am a huge fan of CodeSmith. If you are not familiar with it, and you do any amount of coding at all, you owe it to yourself to check it out.
Below is some template code which loads the foreign keys of a table into a Dictionary object. It stores the name of the table and foreign key field name. As you can see, it generates a notice when it comes across a recursive relationship.
public Dictionary<string,string> GetForeignKeyTables()
{
Dictionary<string,string> dic = new Dictionary<string,string>( );
for (int idx = 0; idx < SourceTable.ForeignKeys.Count; idx ++)
{
string primaryTable = String.Empty;
string primaryKey = String.Empty;
// To get the foreign key columns
ColumnSchema col1 = SourceTable.ForeignKeys[idx].ForeignKeyMemberColumns[0];
primaryKey = col1.Name.Trim();
// To get the foreign key tables
primaryTable = SourceTable.ForeignKeys[idx].PrimaryKeyTable.ToString().Replace("dbo.",String.Empty).Trim();
if (!dic.ContainsKey(primaryKey))
dic.Add(primaryKey, primaryTable);
else
MessageBox.Show("This table may contain recursive relationships. You must set those relationships up manually.");
}
return dic;
}

Thursday, August 27, 2009
Interview question -- non-technical about how I handle release problems.

Tuesday, August 25, 2009
An example of reflection in coding!

Monday, August 24, 2009
Question: What's reflection, and how have you used it to solve a problem?
Answer: Reflection is a way to look at assembly metadata and look in and see what is contained. It also allows you to use late binding and call methods within those assembles.
For the second part, a simple explanation is all you need to show that you understand how it is used.
So what if you've enver used reflection? First, shame on you (kidding!). It DOES serve a very important purpose and allows for some great solutions, especially at an architectural level. If you've never used it, I recommend immediately trying it out, and you'll find many, many uses. Here's a tutorial I found that looks decent. That way, when asked this question (and I get this one a lot) you can answer how you *might* really use it. Honestly, you've probably used it and didn't realize it if you've added certain attributes to your code.
I have used reflection for everything from identifying certain classes and functions. For example, for a coding sample, I used LINQ for Reflection and attributes to identify classes which supported certain calculations. By doing this, I could add more functions dynamically and the UI would pick it without changing code. Since LINQ for Reflection is not discussed much, I'll post some about that later.
There are some costs associated with Reflection though. Speed! Late Binding is slower by it's nature, as well as all the processing looking for methods, so plan and use wisely!

Friday, August 21, 2009
Another interview question of the day -- Access Modifiers

Wednesday, August 19, 2009
Another interview question du jour!

Tuesday, August 18, 2009
I've been doing technical interviews for about 5 years now for .Net, and hired a lot of developers in that time. As a result, I have become proficient at quickly assessing a level of technical expertise as well as how a developer may fit within an organization. I will blog another time about what characteristics I look for in a candidate, but for now, I will go through some of the technical questions I ask, answer them, and explain why I ask the question.
Question: What's the difference between an abstract class and an interface
Answer: They have some similarities in that they both define abstract members which have to be implemented. An interface is really just a contract where you are stating "if I implement this interface, I will implement these methods". However, an abstract class can have an implementation, where an interface cannot. An abstract class can also have constructors and field data.
One advantage of an interface is that you can implement more than one interface per class, but you can only inherit from one class.
Note there's a lot more you could talk about with them both (and you don't want to overtalk any question), but the above will demonstrate you have a good knowledge of OOP design, which is what I was looking for. It's surprising how many developers cannot get this question right.
To learn more, here's a good article which discusses them in more detail (more than you'd need to answer the question for sure, but good knowledge to have!)

Monday, August 17, 2009
I highly recommend the Application Architecture guide from CodePlex.

Saturday, August 15, 2009
I needed to use LINQ to XML to grab some RSS feed information into a BusinessObject I created to save to a database. Here's what I needed:
var activityList = from e in doc.Descendants("item")
select new RubiconPortal.BusinessObjects.Activity
{
ActivityTypeID = ActivityTypes.Blog.Code,
ActivityDate = e.Element("pubDate").Value.RSSDateTime().ToShortDateString() + " " + e.Element("pubDate").Value.RSSDateTime().ToShortDateString(),
ActivitySummary = HttpUtility.HtmlDecode(e.Element("title").Value),
ActivityDetailsURL = e.Element("link").Value
};
Since the pubDate comes across in a format which is different than I wanted, I decided to write an extension method called RSSDateTime() to convert to a DateTime, from which I can format any way I want or work with. Here's the method:
public static DateTime RSSDateTime(this string date)
{
DateTime d;
if (DateTime.TryParse(date, out d))
{
return Convert.ToDateTime(date);
}
return DateTime.Now;
}

Friday, August 14, 2009
Tonight was a very enjoyable night of coding. I created the first phase of my "activity aggregator". I actually had a more clever name for it, but being tired, it slips my mind right now.
Currently, I post several places.. short updates for on Twitter. Longer discussions end up on here, my blog. I have some other sources I plan on integrating over time, such as links I found useful (similar to Digg, but also where I can place why I found it useful). That means growth, and when it comes to design, it's best to design change into it up front.
The first thing I needed to do was create my table and business object to collect these activities. In my table, I store ActivityDate, what type of activity it was (foreign key to another table -- ActivityType), a brief summary of the activity text, and finally the url someone interested could click on to get more information. The internal members of my activity class look like this:
15 #region Private Members
16
17 private int activityID;
18 private int activityTypeID;
19 private string activityDate;
20 private string activitySummary;
21 private string activityDetailsURL;
22
23 #endregion
Each private member has a publically exposed property.
Most of my activities will have XML feeds, such as the RSS feed of my blog, and the Twitter API. Therefore, I enforce a similar implementation by creating an abstract base class, called BaseFeed, which looks like this:
1 using System.Xml.Linq;
2 using RubiconPortal.Common;
3
4 namespace RubiconPortal.BusinessObjects
5 {
6 internal abstract class BaseFeed : BaseClass
7 {
8
9 public abstract int ParseFeed(XDocument doc);
10
11 }
12 }
So now I have a "contract" that I need to use to have a similar method for any activity I want to log. I could have used an interface for this, since there's no true implentation here, and I may refactor it later to do so, but I do have some ideas where I may want to provide some implementation, so that's why I chose an abstract class.
So the first item I wanted to do was implement capturing my Twitter posts in this activity, since I currently don't have a way to capture and post them on my site. I will add the rest of the activities later. In a previous post, I described how I took the Yedda Twitter API and modified it to return XDocuments, and here's another chance to take advantage of that change with LINQ.
When I post to my Twitter feed, I want to make sure my home page automatically reflects this activity. So I implement a TwitterFeed object, which implements the BaseFeed method ParseFeed. Using LINQ to XML, I pull out the pieces of the response I want, and populate the public properties of my Activities class, then save my activity. Here's what my TwitterFeed class looks like:
1 using System;
2 using System.Linq;
3 using System.Web;
4 using System.Xml.Linq;
5 using Rubicon.Common;
6 using RubiconPortal.Common;
7
8 namespace RubiconPortal.BusinessObjects
9 {
10 internal class TwitterFeed : BaseFeed
11 {
12 public override int ParseFeed(XDocument doc)
13 {
14 try
15 {
16 if (doc != null)
17 {
18 var activityList = from e in doc.Descendants("status")
19 select new RubiconPortal.BusinessObjects.Activity
20 {
21 ActivityTypeID = ActivityTypes.Twitter.Code,
22 ActivityDate = (e.Element("created_at").Value.ParseDateTime()).ToShortDateString() + " " + (e.Element("created_at").Value.ParseDateTime()).ToShortTimeString(),
23 ActivitySummary = HttpUtility.HtmlDecode(e.Element("text").Value),
24 ActivityDetailsURL = "http://twitter.com/" + e.Element("user").Element("screen_name").Value
25 };
26
27 foreach (RubiconPortal.BusinessObjects.Activity item in activityList)
28 {
29 item.Save();
30 }
31 }
32
33 return ReturnCode.Success.Code;
34 }
35 catch (Exception ex)
36 {
37 ErrorHandler(ex, "An unexpected error occurred in TwitterFeed.ParseFeed() - " + ex.Message);
38 return ReturnCode.Failure.Code;
39 }
40 }
41
42 }
43
44 }
Within the ParseFeed method I am using LINQ to XML to populate my business object calling the save() method to write it to the database. As you can see, using LINQ to XML can be a lot simpler than using XML/XPath. Once in the database, I can query it in my user control, and display it on my home page here.
Now, when I make my Twitter post, all I need to do is take the XDocument the Twitter API returns, and pass it into the ParseFeed method, which looks like this...
35 //Post my tweet to Twitter
36 TwitterAPI twit = new TwitterAPI();
37 XDocument doc = twit.UpdateAsXML(Settings.TwitterUserName(), Settings.TwitterPassword(), txtPost.Text);
38
39 //Save it to the activity table for displaying the activity
40 TwitterFeed feed = new TwitterFeed();
41 feed.ParseFeed(doc);
Simple and neat! Now when I implement it for my blog, it will be just as quick and easy!
Props go out to this post I snagged an extension method for formatting the Twitter posting date to something a human can use (and my C# class can use to manipulate and save!)

Wednesday, August 12, 2009
Some tools I downloaded today which appear VERY useful, and touching on the ORM topic.

Tuesday, August 11, 2009
Tonight I didn't get as much time to work on the site as I would have liked, so I focused on getting the admin pages up on the production server so I could do some "behind-the-scenes" work remotely. This required some security, which I started last night, but the data migration for that was a bit more daunting, so I needed to finish it tonight. While the authentication providers and controls do handle a LOT, it has an interesting learning-curve, and deployment can be a challenge as well. All-in-all, it sure beats writing all that code by myself.
I tried to use a lot of caching and cached settings to help improve the performance on certain pages, especially my client list. On my admin pages, I made sure to create a means to reset that cache without having to do a complete server reset. Actually, the same approach I took would work well for high availability sites, as the method I used to complete this would not require a server reset to re-load systems. When I was int he banking industry, high-availability was a huge issue, and simple config changes meant waiting for a scheduled system outage or worse, an emergency outage. When I redesigned that site, that was one of the top priorities I had.
It occurred to me how much time it takes to set up the infrastructure of a site: master pages, common libraries, configuration files, CSS, etc. Once those are done, if done properly, the rest of the site should go fast. One thing I have found to speed that up was the use of Visual Studio Project Templates. Combined with code generation like CodeSmith, you can really generate web sites extremely fast, and get on to coding the "fun" items. I will write about both of those in the future (CodeSmith and Project Templates) once the site is stabilized.
Tomorrow night may not have a lot of development, as my parents will be in town. Later this week, I will be coding my next control: the activity feed. When posts and feeds are made or read, this control will snag it, and place a brief "teaser" on the home page.

Friday, August 07, 2009
A plug for my company, Rubicon Computing Solutions, LLC.

Wednesday, August 05, 2009
Using LINQ to XML to work with the Twitter response, and modifying the Yedda Twitter API wrapper.

Tuesday, August 04, 2009
Note: For visitors of your site, this entry is only displayed for users with the preselected language English (United States)/English (United States) (en-US)
How the VS2008 IDE is very helpful to conditional compilation, and also how the site is coming along

Tuesday, June 13, 2006
New Data property of the Exception class is quite useful!

Tuesday, May 16, 2006
Get the name of the current db in t-sql

Friday, April 28, 2006

Tuesday, March 21, 2006
Is it just my installation, or is WinCV missing from the latest version of .Net? Granted, I can still use the old WinCV by changing the config file, but why was such a useful tool pulled from VS2005?
If you've never used WinCV, check it out for VS2003 and prior version. It essentially lets you search the framework for a certain keyword. For example, if you want to find out which namespace "Registry" is in, type it in, and see the entire implementation. By using the configuration file, you can add additional assemblies for WinCV, to search your own libraries or those of third party vendors.

Tuesday, March 14, 2006
Just a little tip, as I didn't read the error message generated as closely as I should have. I was working this weekend on the Microsoft Code Template for Building a Provider Based Feature and was migrating some existing libraries I had for VS2003 to take advantage of the features in VS2005.
First, let me say I love things in VS2005 like Generics, and the implementation of the Provider Model. I was migrating my data access libraries and error handling libraries, and was setting up some tests in nUnit as part of ongoing testing. Although I haven't changed my data and error handling models in a long time, I figured it was a great design idea to be able to change them dynamically using the Provider Model.
To make a long story short, I was running my tests for the data library, and when I invoked my Data Access classes, I was getting a "TypeInitializationException" error. I checked and double-checked my configuration file, and it appeared to all be correct. I looked at the InnerException, and it didn't seem to be much more help. However, I went further to look at the InnerException of the InnerException, and there's where I found the solution. The Rosetta Stone?
- Only one <configSections> element allowed per config file and if present must be the first child of the root <configuration> element.
A quick check indicated that I hadn't made the configSection the first element. Doh!
So there are a few lessons to learn here. 1) Make sure your configSections is first (normally not a problem, just a cut and paste issue here) and 2) Make sure you dig REAL deep into the InnerExceptions for the details and 3) the new Visualizers in vs2005 were too cool and very helpful.
Hats off to the VS2005 IDE team! It's spawned a few visualizers I can think of, so if time permits in the future, I will be publishing those right here!

Friday, October 07, 2005
..or why MS has once again dropped the ball on it's core developer community.

Tuesday, September 20, 2005
"Internal Query Processor Error: The query processor could not produce a query plan. Contact your primary support provider for more information" when passing in C# DateTime value...

Friday, May 27, 2005
(and maybe why Extreme Programming (XP) is also bad?)
Tired of cutting and pasting? Try CodeSmith...

Saturday, April 23, 2005
What the $*#(U$(? Where did the wse version go?

Thursday, April 14, 2005
I am joining the fray....

Monday, April 04, 2005
How to get them to reappear...

Monday, March 21, 2005
Let's talk resume's for a minute. You want that interview don't you? Well, sometimes all you have to get you there is your resume (although personal reference is the best way if you can get it, an area where networking and doing quality work can help).
There's a million places on the internet to help you decide how to structure your resume. I have only gotten one criticizm from my resume, and I am not sure if it's the content or the structure which works best. But here's a couple of pointers which I think have helped out my resume.
- Place a logo of any certifications you have if available (e.g. MCSD). These are real eye catchers. Make the images small though..
- Place your specific skills separate from your experience, preferably near the top. This makes it easy to survive the first pass from the recruiter/manager.
- Sell yourself! Research “power“ words and make any experience descriptions short and chock full of those words.
Now, there's a few easy tips of what to do. I have been helping staff for years, and here's some of the gems I have seen.
- Horrible writing and spelling.
- Obviously exagerated skills and experiences (4 years experience, 10 years at a certain skill)
- Never say you are an expert at anything, even if you are. Humility goes a long way, and if the interviewer knows more, you'll be humbled by them, as I witnessed in the past week.
- Use nice paper if submitting a hardcopy (I received one handwritten on a partial piece of paper -- I kid you not)
It's not tough... just use some common sense!

Saturday, March 19, 2005
OK, so now you know wht might be asked.. how not to blow it.

Friday, March 18, 2005
WTF? Poor documentation...

Thursday, March 17, 2005
wow... what was that? Some observations from helping with some technical interviews.

Wednesday, March 16, 2005
When you need to uniquely identify a file using the time and date stamp, use this!

Friday, March 11, 2005
Someone asked me today if I knew that you couldn't use GETDATE() in functions in SQL Server. Well, I did, so I dug out this solution I had found a while back, and decided to post it, since I am sure others have come across the same issue.
Basically, you use a view to do the work for you... here you go!
CREATE VIEW Function_Assist_GETDATE
/********************************************************
*
* A view to return one row, with one column, the current
* date/time from the built-in function GETDATE(). This
* view allows a UDF to bypass the restriction on access to
* the non-deterministic getdate() function.
*
* Attribution: Based on a newsgroup posting in by Mikhail
* Berlyant in microsoft.public.sqlserver.programming
*
* Common Usage:
DECLARE @dtVar datetime
select @dtVAr = [GetDate] from Function_Assist_GETDATE
**********************************************************/
AS
SELECT getdate() as [GetDate]
GO
GRANT SELECT on Function_Assist_GETDATE to PUBLIC
GO

Wednesday, March 09, 2005
Exception handling analyzed...

Friday, December 31, 2004
Clearing up the confusion when you need the return value from an insert.

Thursday, December 30, 2004
Finding all tables where a field exists in SQL Server

Tuesday, December 28, 2004
How to format a date to a particular format...

Monday, December 27, 2004
How to quickly find out which control caused the postback

Tuesday, December 21, 2004
How to step through your client side code

Monday, December 20, 2004

Saturday, December 18, 2004
Just a tip to remind myself

Wednesday, December 15, 2004
A brief look into the System.Diagnostics namespace...

Saturday, December 11, 2004
A costly mistake to forget...

Wednesday, December 08, 2004
How to cast to a specific type if you have the string value of the type

Monday, December 06, 2004
Quick fix for a "catastrophic" problem!

Thursday, December 02, 2004
Well lookie what else it can do!

Tuesday, November 30, 2004
Let's work with an enum today!
A useful port from something in the old VB6 days...

Monday, November 29, 2004
Hot keys and aliases, oh my!

Saturday, November 27, 2004
A quick function to convert an integer to a Roman numeral

Tuesday, November 23, 2004
Follow me as I configure a client in automated builds

Sunday, November 21, 2004
How to configure log4net to save entries into the database

Friday, November 19, 2004
How to make an ASP.Net page expire

Wednesday, November 17, 2004
How to break on an error in ASP.Net

Thursday, November 11, 2004
Changing the look of thinks client side dynamically...

Wednesday, November 10, 2004
How to search all those assemblies and find just what you need...

Tuesday, November 09, 2004

Monday, November 08, 2004
Allows you to capture the click, dblclick, etc to make a normal form control read only.
How to dynamically change the EntType of an HTML form...

Saturday, November 06, 2004
When you can't create a SQL diagram, use this to print usable field information
How to add client-side javascript to individual listItems in a RadioButtonList

Thursday, October 21, 2004
How to grab a random record which is very useful for testing...

Tuesday, October 19, 2004
DBA Must Haves (IMHO)
First, a little about myself. I have been working with databases since SQL Server 6, and a little back when it was Sybase. Here are two procs I use so much, I have to link them here.
First, there's Narayana Vyas Kondreddi's sp_generete_inserts. It's a great utility/sproc for extracting data from existing tables. I have used it from everything from migrating data to making impromptu backups to text files, all the way to bailing out some hapless developers who run against production and wipe out data they should not be touching. Here's where you can get it:
http://vyaskn.tripod.com/code/generate_inserts.txt
Next, there's sp_findsp. Not the prettiest thing, but if I want to find out where a string (such as a table or proc) is used, I can run this baby and it will return to me a list where I can start looking. It's also very useful to me when I start a new project to do some “mining“ to see what's going on. Here's where this one can be found:
http://databasejournal.com/features/mssql/article.php/1458871
These two follow me everywhere I go!
Note: For visitors of your site, this entry is only displayed for users with the preselected language English/English (en)
Want a good tip?