# Wednesday, May 10, 2006

There we go. Doors are open for NRW06!

20 Speakers, max. 250 attendees a lot of community and networking.

Signup

After you did you can put this onto your blog or website ;-)

Wednesday, May 10, 2006 12:02:12 PM (W. Europe Standard Time, UTC+01:00)  #    Disclaimer  |  Comments [9]  | 
# Sunday, January 08, 2006

If you try to run a CREATE statement in a query (right click on a database in the Server Explorer) you receive this message.

So i wrote a small utility which will do the job for me.

using System;

using System.IO;

using System.Data.SqlClient;

using System.Collections.Generic;

using System.Text;

using System.Windows.Forms;

 

namespace MdfExec

{

    class Program

    {

        static void Main(string[] args)

        {

            string _cnStr;

 

            if (args.Length == 2)

            {

                _cnStr =

                    "data source=.\\SQLEXPRESS;Integrated Security=SSPI;" +

                    "AttachDBFilename=" + args[1] + ";User Instance=true;";

            }

            else

            {

                OpenFileDialog fd = new OpenFileDialog();

 

                fd.AddExtension = true;

                fd.DefaultExt = ".mdf";

                fd.ShowDialog();

 

                _cnStr =

                    "data source=.\\SQLEXPRESS;Integrated Security=SSPI;" +

                    "AttachDBFilename=" + fd.FileName + ";User Instance=true;";

            }

 

            using (SqlConnection _cn = new SqlConnection(_cnStr))

            {

            using(SqlCommand _cmd = _cn.CreateCommand())

                   {

                    using (StreamReader fs = File.OpenText(args[0]))

                    {

                        _cmd.CommandText = fs.ReadToEnd();

                        _cmd.Connection.Open();

                        _cmd.ExecuteNonQuery();

                    }

                   }

            }

        }

    }

}

 

You can now right click on a *.sql file choose "open with ..." and select MdfExec.exe to execute the SQL statement.

Since there is no second parameter (but needed to define to which database to connect) a OpenFileDialog will prompt:

 

Happy coding

Sunday, January 08, 2006 3:31:55 PM (W. Europe Standard Time, UTC+01:00)  #    Disclaimer  |  Comments [1]  | 
# Saturday, October 08, 2005

Monday: I met Andreas Hoffmann (2nd UG Lead of the VfL Usergrop) and Peter Nowak (Head of FIAEon.net, a community for .NET related vocational education) at Starbucks in Düsseldorf.

Tuesday: Benjamin Mitchell notified me that one of my sessions was voted by the british community and I'll have a session at the Developer Developer Developer Day.

Wednesday: I'm in contact with the Student Partners in Wuppertal now (better said Anselm Haselhoff because Marcel Wiktorin is moving and has not replied yet :-)).

Thursday: Usergroup meeting in Düsseldorf: Sebastian Weber (Developer Evengelist at Microsoft Germany and member of the VfL-UG) answered all our members questions about SQL Server 2005 and Tuan Nguyen (Lead of annos.de and VfL-Member) talked about the Annos project. Great, thanks guys.

Friday: I updated the VfL-Site and fixed a few bugs.

Saturday, October 08, 2005 5:50:30 PM (W. Europe Standard Time, UTC+01:00)  #    Disclaimer  |  Comments [0]  | 
# Wednesday, June 22, 2005
# Wednesday, June 01, 2005

Ok, here is another one:

1. I add a login to my database server:

    EXEC sp_addlogin @Username, @Password, @Database;

This works fine!

2. I add a user, to a database by using the stored prcedure sp_adduser:

    Use [MyDB];
    EXEC sp_adduser @Username;

This also works fine!

3. I want to remove the user from the database. Therefor i use the stored prcedure sp_dropuser:

    EXEC sp_dropuser @Username;

This removes the user BUT what you'll see while digging deeper is that sp_adduser has created an SCHEMA and sp_dropuser don't cares a s%#t about that - it's still there after calling sp_dropuser :-(

Wednesday, June 01, 2005 6:20:47 PM (W. Europe Standard Time, UTC+01:00)  #    Disclaimer  |  Comments [20]  | 

First of all ... wow, yeah, the IDE of SQL Server 2005 is pretty nice with all those grafics and animations but

  • It's more than anoying that i can not paste multiline text into a column of a table opened via right-click | Open Table
  • NOTE: It is possible to add multi-line-texts via an insert/update script - but hey, that takes me 10-30 seconds longer ... raise your hands if ya wanna pay me for that.
Wednesday, June 01, 2005 6:12:56 PM (W. Europe Standard Time, UTC+01:00)  #    Disclaimer  |  Comments [13]  |