Welcome to MSDN Blogs Sign in | Join | Help
Here is a post I made over on the MSDN Sql Management Tools Forum (http://forums.microsoft.com/MSDN/ShowForum.aspx?ForumID=84&SiteID=1) about opening a query editor window and how it gets server/database context or not and when it asks you for connection or it doesn't.

If you ask for a new query window via File->New->Database Query (or any other), or the toolbar button to the RIGHT of the "New Query" button, we ALWAYS prompt for a connection, you can press cancel and you will get a query window that is disconnected. We will not prompt for a connection until you attempt to execute that query or ask to connect explicitly via the Query->Connection->Connect option, or toolbar button under the New Query button.

If you ask for a new query window via File->New->Query With Current Connection, or the New Query button, or Ctrl+N, then we create a new query window with whatever current connection context you have. If the focus is in a Query Window we will create a new one with the same connection (this is the same behavior as QA). If you have focus in Object Explorer or Registered servers on a server, we will create a query window connected to that server.

Finally if you ask for a new query window with the current connection (as above) but there is NO current context: no query window, focus on a disconnected query window, focus on the server type node in the registered servers window then we will prompt you for a connect and in this case, if you press cancel, the new query window generation is stopped.

If we end up connecting you to a server you didn't want or not connecting you at all you can click on the disconnect toolbar or the re-connect toolbar (or their associated menu's under Query->Connections) and get the query window to the right server.

Finally there are some context menu's to be aware of. From a registered server you can right click and go into the "Connect" menu and select Query Window. This will open a query window connected to this server (regardless if it is connected in Object Explorer).

From a connected server in OE you can right click and use the New Query menu option to open a query connected to that server. If you select a database in the Object Explorer and do a New Query from there, then you will be connected to that server with the selected database as the current database.

These same concepts apply to an Analysis Server connection just as they do to a Relational Server connection.

Play around with it and hopefully it will allow you to achieve what you would like, when you would like it

This is something that I don't think many people are familiar with. I'm a little hesitent to mention them as it is a bit of the "use a screwdriver as a hammer" type solution. But here we go.

SSMS has a number of command line options which allow you to specify a number of things. These can be seen by executing the /? command. Here are the results of that command.

---------------------------
Microsoft SQL Server Management Studio
---------------------------
Usage:
sqlwb.exe [-S server_name[\instance_name]] [-d database] [-U user] [-P password] [-E] [file_name[, file_name]] [/?]

 [-S The name of the SQL Server instance to which to connect]
 [-d The name of the SQL Server database to which to connect]
 [-E] Use Windows Authentication to login to SQL Server
 [-U The name of the SQL Server login with which to connect]
 [-P The password associated with the login]
 [file_name[, file_name]] names of files to load
 [-nosplash] Supress splash screen
 [/?] Displays this usage information
---------------------------
OK  
---------------------------

Of course the first thing to notice is that the command line is sqlwb.exe and not ssms.exe. This is just a left over from the early days where it was called Sql Workbench. Changing the name late in the cycle is much more trouble than you can imagine, so we left it alone.

A serious problem with this is that we don't do wild card expansion of the file name (ugh!) but that is workable.

Now, you may wonder why I'm hesitent to point this out. That is because SSMS is really a tool built to handle visual interaction and not really designed to do much "batch" processing. It can of course do some batch processing and does handle several scenerios well but there are much better tools that support batch.

SqlCmd is a great example of this. This tool provides all sorts of rich macro replacements in scripts so you can write generic scripts and execute them against whatever servers you would like. That being said I do realize that the UI tools need to do a better job in some of these "batch" type scenerios and it something we are looking into to.

Finally you can help us know what you really would like to see by going to the "Send Feedback" menu item under the Community menu in SSMS. This will take you to a site where you can make suggestions and even more powerfull, vote on the sugestions made by others. We do look at this data very seriously and use it as we try and determine what we should be fixing first and foremost.

One of the questions I get a lot is what is "new" in Sql Server 2005. As you can imagine the list is quite large and isn't something that can be rattled off in a few lines. So the easiest thing to do it point you to the Books on Line, or BOL as we call it. The best place to start is the high-level "What's new topic" and then drill in from there.

http://msdn2.microsoft.com/en-us/library/ms170363

Last night we had a bunch of Microsoft folks up front in a room and took questions from the audience. I was pretty pleased with the questions as there weren't many "it is broke...why" type questions which really require a lot of digging to find out the root cause. There were a lot of questions around "how do I do this" or "What is the level of support around that." Good questions. We didn't have many relational engine people there and several of the questions were targeted in that area. I did my best to answer some but I live way up the "food chain" in Sql Server so I wasn't always the best person to ask.

One question that did come up that comes up all the time is sysdepends and will it be better in Sql 2005. The short answer is no. The big problem is that the Database engine uses a run-time binding to determine what objects should be referenced. In a simple example if I have a stored proc which references a table Foo but does not qualify it with a schema then which Foo will get referenced will depend on which user is running the sproc and which schema is their default schema. There are some potential fixes we are looking at for the next release but for Sql 2005. Things are pretty much what they are today in Sql 2000.

The other question that came up was our compliance to ANSI-99. I know we are very close now but not 100%. I'm trying to find out the exact details and will post them here.

I just finished my presentation on Upgrading to Sql Sever 2005 at Sql Connections 2005 in Las Vegas (http://www.devconnections.com/shows/sqlfall2005) . What a great time. I really do enjoy presenting, I'm always a bit nervous at first but get into it after a bit. The room was packed! This was the first session of the morning so lots of enthusiasm. It seems like most other conferences I talk at I'm on the last day and half the attendees have either gone home or are recovering from some event party. Not this time, lots of fun. I have no idea how my scores turned out but I usually do OK. Looking forward to that.

I also wanted to correct something. I think I said that 32-bit could be upgraded to 64-bit and there really isn't anyway to do this via an in-place upgrade. You will need to do a migration. If you think about this is makes some sense you can't really do an inplace upgrade of 32bits up to 64-bits. The detatch/attach mechanism does work quite well however.

Many people were asking for my slides as I didn't get them sent in in-time for the book. They should be here http://www.devconnections.com/updates/lasvegasfall_05/sqlmag_connections.

I also wanted to provide a few more links (a couple which I'm added to the deck).

Here is the link to the UA tool http://go.microsoft.com/fwlink/?linkid=45788

Here is the link to the upgrade matrix http://msdn2.microsoft.com/en-us/library/ms143393

Michael Raheem's excellent web cast (which is roughly the same presentation) is here http://msevents.microsoft.com/cui/WebCastEventDetails.aspx?EventID=1032275514 To view this you have to click on the register link on the left and then follow a bunch of other steps... but you'll get there eventually.

 

Well, I'm going to try this blogging thing again. I like the idea but I've had a tough time in the past. I'm going to give this one a bit more effort.

Might as well start with the required "bio".

I've been making a living with computers since about 1981. I've done everything from sell them, repair them, build them, program them, use them, and throw them... ok that last one didn't pay anything but it did feel good to throw that Atari 800 across my little apartment :)

I've spent most of my time in or around the development side and that is sort of where I find myself now. I say "sort of" because I'm now mostly management and overhead. I'm the new Group Manager for the Sql Management Platform team. I'll write some more about what exactly we do in the bigger world of Sql later.

I started working for Microsoft in 1998 after kicking around on my own for about 4 years. In that time I had my own consulting firm and my own temp placement firm, both did OK, but I was tired of the self-management grind. Growing up in the Seattle area I had been around Microsoft most of my adult life so I decided to take the plunge. I figured if nothing else I'd do the 5 year and retire gig... little did I know the market would tank and I'd love doing what I do and wouldn't have left anyway.

I know this is vauge but hopefully that should leave some room for later posts.

Some possible future posts...

  • I'm speaking at Sql Connections in Las Vegas next week so I'll post about that.
  • I'll give an update on my new team and give some glimpses into what we hope to deliver for the next version of Sql Server.
  • I may go back and post a little on my past as things come up.
  • Now that Sql Server 2005 has shipped I'll post any "best practices" that come up.

So with that... Happy Halloween!

 

 
Page view tracker