Friday, 29 October 2010

C# System Types

The type system in .NET or Common Type System (CTS) divides types into 2 categories:
  • Values Types
  • Reference Types
Value Types

These are simple data types that directly contain their data, for example:
  • Integers
  • Floats
  • Enums
  • Structs
Reference Types

These types store references to objects.  Reference type variables have the ability to refer to the same data, so two variables can point to same object and the object be manipulated by performing operations of both variables.  Examples include:
  • Classes
  • Interfaces
  • Delegates
  • Arrays
Read rest of entry

Thursday, 28 October 2010

SQL: Format Dates

Formatting dates in T-SQL is generally a nuisance as no format date function exists. In the past I have seen many developers (including myself) use the DATEPART() functions to split the dates and then manually build up a date string.



Alternatively I have seen developers CAST() the date to format.



Recently however, I discovered the different date formats that come standard in SQL Server as part of the CONVERT() function.


For an excellent thorough list of date formats please visit  http://www.sql-server-helper.com/tips/date-formats.aspx
Read rest of entry

Wednesday, 27 October 2010

SQL: Get the length of text, ntext & image


Ever needed to find the lengh of a ntext field in SQL only to be met with the following error message, whilst using the LEN() function?







This can be achieved by simply using the DATALENGHT() function.  DATALENGTH is especially useful with varcharvarbinarytextimagenvarchar, and ntext data types because these data types can store variable-length data.


Note: Compatibility levels can affect return values. For more information about compatibility levels
Read rest of entry
 

Popular Posts

developer-express Copyright © 2009 Black Nero Blogspot Templatesis Designed by Ipietoon Sponsored by Online Business Journal