• What if it's LINUX or a variation thereof hence no windows dll's...

    You could try it with Mono but i'm not sure if it will work because of the referenced Microsoft.SqlServer-Assembly which might use PInvoke to native Windows-Specific DLLs.

    [EDIT]

    @Solomon: I think in the following part of the code is a small error which could cause an Exception:

    try

    {

    using (dbConnection = new SqlConnection("Server=localhost;Database=Test;Trusted_Connection=True;"))

    {

    dbConnection.Open();

    SqlCommand importProc = new SqlCommand("CHECKPOINT ; TRUNCATE TABLE dbo.ImportTest ; DBCC FREEPROCCACHE ; DBCC FREESYSTEMCACHE('ALL') ; CHECKPOINT ;", dbConnection);

    importProc.CommandType = CommandType.Text;

    Console.WriteLine("{0} -- Truncating the import table, clearing the caches, etc...", DateTime.Now);

    importProc.ExecuteNonQuery();

    Console.WriteLine("{0} -- Done setting up for the test", DateTime.Now);

    }

    }

    catch (Exception exception)

    {

    Console.WriteLine("Error: {0}", exception.Message);

    }

    finally

    {

    dbConnection.Close();

    }

    If you wrap a object into a using scope it will automatically be Disposed (and therefore closed) if an exception is thrown. The call to the Close() method in your finally block will then cause another excetion because its called on a already disposed object.