This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.Collections.Generic; | |
using System.Linq; | |
using System.Text; | |
namespace net.datacowboy | |
{ | |
//collection of extension methods to check for compability between .NET value and Microsoft SQL 2005+ data type | |
public static class MsSqlDataTypeExtension |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.Collections.Generic; | |
using System.Linq; | |
using System.Text; | |
namespace net.datacowboy | |
{ | |
public static class StringExtensionMethods | |
{ | |
/// <summary> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public static class DateTimeExtensionMethods | |
{ | |
//get first day of month for a given date | |
public static DateTime FirstDayOfMonth(this DateTime input) | |
{ | |
return new DateTime(input.Year, input.Month, 1); | |
} | |
//get last day of month for a given date | |
public static DateTime LastDayOfMonth(this DateTime input) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//average lat/lon based on http://dev.maxmind.com/geoip/legacy/codes/state_latlon/ | |
public class UsStateInformation | |
{ | |
public string Name { get; set; } | |
public string Abbreviation { get; set; } | |
public decimal Latitude { get; set; } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<log4net> | |
<appender name="rollFile" type="log4net.Appender.RollingFileAppender"> | |
<file value="C:\path\log" /> | |
<rollingStyle value="Date" /> | |
<datePattern value="yyyy-MM-dd'.txt'" /> <!-- added .txt to end of date pattern so that the file extension txt will be used, note that .txt is escaped by single quotes --> | |
<appendToFile value="true" /> | |
<staticLogFileName value="false" /> | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.ComponentModel.DataAnnotations; | |
using System.Linq; | |
sealed public class UsStateTwoCharacterAbbreviationAttribute : ValidationAttribute | |
{ | |
private readonly string[] validStateAbbr = new string[] { "AK", "AL", "AR", "AZ", "CA", "CO", "CT", "DC", "DE", "FL", "GA", "HI", "IA", "ID", "IL", "IN", "KS", "KY", "LA", "MA", "MD", "ME", "MI", "MN", "MO", "MS", "MT", "NC", "ND", "NE", "NH", "NJ", "NM", "NV", "NY", "OH", "OK", "OR", "PA", "RI", "SC", "SD", "TN", "TX", "UT", "VA", "VT", "WA", "WI", "WV", "WY" }; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
SELECT | |
S.name AS SchemaName | |
, T.name AS TableName | |
, C.name AS ColumnName | |
, EP.value AS ColumnDescription | |
, Y.name AS DataType | |
, C.max_length AS MaximumLength | |
, C.is_nullable AS AllowsNulls | |
, C.precision AS Precision | |
, C.scale AS Scale |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.Data; | |
using System.Data.SqlClient; | |
/// <summary> | |
/// Collection of extension methods to convert .NET objects/values to equivalent parameters for MS SQL Server | |
/// For use with ORMs such as NPoco or PetaPoco to provide explicit conversion to parameter rather than defaults such as all strings being treated as nvarchar(8000) fields | |
/// </summary> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
SELECT 'ALTER TABLE ' + QUOTENAME(S.name) + '.' + QUOTENAME(T.name) + ' DROP CONSTRAINT ' + QUOTENAME(FK.name) + ';' | |
FROM sys.foreign_keys AS FK | |
INNER JOIN sys.tables AS T | |
ON ( Fk.parent_object_id = T.object_id ) | |
INNER JOIN sys.schemas AS S | |
ON ( T.schema_id = S.schema_id ) | |
ORDER BY S.name, T.name, FK.name; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
USE ReportServer; | |
SELECT C.Path | |
FROM dbo.Subscriptions AS S | |
INNER JOIN dbo.Catalog AS C | |
ON ( S.Report_OID = C.ItemID ) | |
WHERE ExtensionSettings LIKE '%[email protected]%' | |
ORDER BY C.Path; |
OlderNewer