Archive for the ‘Database’ Category

C# Tip:Start an application from a C# program

No Comments » by Jon Hibbins on 3 August 2008
Filed under: .NET, C#, Code, MSSQL2005, Software Development

Useful code if you wish to launch an external application:

System.Diagnostics.Process.Start(@"C:\program files\microsoft office\word.exe", @"C:\MyWordDocument.docx");

Check if a SQL Server database exists or not (TSQL)

No Comments » by Jon Hibbins on 1 August 2008
Filed under: Code, Database, MSSQL2005, Software Development, SQL Server, TSQL

Here is a usefull TSQL Script for checking if a database exists :

– Check if the Database Exists
DECLARE @DatabaseCount AS int
SELECT @DatabaseCount=COUNT(*) FROM master.dbo.sysdatabases WHERE name=‘master’
SELECT @DatabaseCount AS [DatabaseCount]