Thursday, 24 February 2011

Get SQL Server Product Version, Level and Edition

 

SELECT 'SQL Server '
+ CAST(SERVERPROPERTY('productversion') AS VARCHAR) + ' - '
+ CAST(SERVERPROPERTY('productlevel') AS VARCHAR) + ' ('
+ CAST(SERVERPROPERTY('edition') AS VARCHAR) + ')'

Tuesday, 15 February 2011

Trace Levels

Possible values for TraceLevel

0 = Off
1 = Error
2 = Warn
3 = Info
4 = Verbose

Friday, 4 February 2011

CodeRush Xpress for C# Developers

Worryingly few people seem to be aware that DevExpress have released a free version of their CodeRush tool.

Read the original announcement from DevExpress here: http://www.devexpress.com/Home/Announces/CodeRushXpress.xml

Get the tool now: http://www.devexpress.com/coderushx

To quote from the original announcement:

The following Integrated Code Navigation features are available to you and your team free-of-charge:

  • Duplicate Line
  • Highlight All References
  • Increase or Reduce Selection
  • Smart Clipboard Operations
  • Generate from Using (TDD)
  • Quick Navigation Window
  • Quick File Navigation

In addition, CodeRush Xpress Ships with the following 25 Code Refactorings:

Add Block Delimiters -- Combine Conditionals -- Compress to Lambda Expression -- Compress to Ternary Expression -- Convert to Auto-implemented Property -- Convert to Initializer -- Create Backing Store -- Decompose Initializer -- Decompose Parameter -- Expand Lambda Expression -- Expand Ternary Expression -- Extract Method -- Flatten Conditional -- Inline Delegate -- Inline Temp -- Introduce Local -- Make Explicit -- Make Implicit -- Move Type to File -- Name Anonymous Method -- Name Anonymous Type -- Reverse Conditional -- Split Conditional -- Use String.Format -- Use StringBuilder

Microsoft All-In-One Code Framework

Very good centralised code sample library, complete free, covers all Microsoft development technologies and available on CodePlex.

http://1code.codeplex.com/

Check for and resolve minor SQL Database corruption

Check for corruption:
DBCC CHECKDB(‘database_name’)
GO

To fix any errors the database must be in single user mode.

ALTER DATABASE database_name SET SINGLE_USER
GO

DBCC CHECKDB('database_name', REPAIR_REBUILD)
GO

ALTER DATABASE database_name SET MULTI_USER
GO

Further details on DBCC CHECKDB can be found here.