How to send SQL from Visual Studio into a User Instance

I really like SQL Express user instances for prototype projects but to send plain SQL commands into them is tricky. I finally found a way:

In Visual Studio create a new SQL file or open an existing one.

With the SQL file open the connect dialog.

Connect to database from Visual Studio

The Connect Dialog will pop up.

Visual Studio 2010 Connect Dialog

Click Options.

Click the “Additional Connection Parameters” tab and type “User Instance=true”.

The connect options User Instance

Click Connect.

Select the appropriate user instance (database name looks like a file path).

Select the User Instance to connect to.

That’s it! Now you can fire plain SQL at your user instance.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s