SQL Server Export with Column Headers

If you want to copy the contents of a Results window from inside Microsoft SQL Server Management Studio AND include the Column Headers then you need to set the following via Tools -> Options.

Query Results -> SQL Server -> Results To Grid -> Check the box next to "Include column headers when copying or saving the results".

Note that you will need to close your current session and open a new one before this change takes place.

SQL Server tables in one swoop!

This is how to list all tables in a SQL Server Database with one statement, or two.

--Tables by Rows Descending Order
SELECT sysobjects.Name,
       sysindexes.Rows
FROM   sysobjects
INNER JOIN sysindexes ON sysobjects.id = sysindexes.id
WHERE type = 'U' AND sysindexes.IndId < 2
ORDER BY sysindexes.Rows DESC

--Tables by Table Names
SELECT sysobjects.Name,
       sysindexes.Rows
FROM   sysobjects
INNER JOIN sysindexes ON sysobjects.id = sysindexes.id
WHERE type = 'U'AND sysindexes.IndId < 2
ORDER BY sysobjects.Name

Clear Project List for Visual Studio

Have you ever wanted to clear the list of Projects from the Start Page in Visual Studio? Here's how to do it.

Run --> RegEdit  and navigate to: HKEY_CURRENT_USER\Software\Microsoft\VisualStudio\<your version>\ProjectMRUList.

Delete the entries that you don't want.

You can also remove the recent list of files by clearing entries in the HKEY_CURRENT_USER\Software\Microsoft\VisualStudio\<your version>\FileMRUList!

One more thing to mention. If you get those annoying Project names like Project (2), Project (3) and just want to start over then you can do that be deleting the folders in My Documents\Visual Studio 2008\Projects\. Usually these folders will only contain the Soluntion (*.sln) files.

Happy Programming!
Dave

About Me

Dave Stuart

Info about Me....The Blogger

So every blog needs this info...

I'm a Developer/BA with 15+ years in the IT industry. I have worked in the UK and Canada as an IT professional and have more years as a contractor than a full-time employee, which is just the way it has turned out. I currently reside in sunny, but frigid, Calgary and moved here from the UK in 2003.

My company Website is http://www.dafran.ca

Visual Studio 2008 extensions for Windows SharePoint Services 3.0, v1.3

Today I ran into more issue when working with deployment of my very first Web Part using Visual Studio 2008 on a 64bit Windows 2008 OS. One important tip when trying to deploy using a SharePoint WebPart for within Visual Studio as that you MUST add the VSeWSS user to the Sit Collections Administrators list. By default that will be just the Primary and Secondary admins of the Site Collection.

Note that you will probably only run into this issue if you have installed Visual Studio 2008 extensions for Windows SharePoint Services 3.0, v1.3 WITHOUT first creating the VSeWSS Application Pool. Please refer to the Release Notes as it will explain how to add the VSeWSS local user to all the required groups.

CAUTION: if you come across a post on the web that tells you to run this comment, then be VERY CAREFULL as it will knock-out your 64bit WSS SharePoint Web Applications if that's what you have: cscript %SystemDrive%\inetpub\AdminScripts\adsutil.vbs set w3svc/AppPools/Enable32bitAppOnWin64 1. Only Enable 32-bit on the VSeWSS App Pool.

Hope you have as much fun as I did, but it is great when I was finally able to deploy from within Visual Studio. 

aspnet_regiis -ga domain\user

I was trying to run "aspnet_regiis -ga domain\user" from the command prompt today, but it wouldn't work! I was trying to add calsvdafran03\VSeWSS local user to IIS 7.0 on Windows 2008 Server so that I could take advantage of Visual Studio 2008 extensions for Windows SharePoint Services 3.0, v1.3. The 64 bit version that is. Anyway, I ran into difficulties running it and then discovered that I had to navigate to the C:\Windows\Microsoft.NET\Framework64\v2.0.50727 directory in order to successfully execute the command.

 

PL/SQL Tables and Columns

This is how to query an Oracle database for Table and Column information. Obviously, you can change these statements to work for what you need.

SELECT  TABLE_NAME
FROM USER_TABLES
ORDER BY TABLE_NAME;


SELECT U.TABLE_NAME,
           U.COLUMN_NAME,
           U.DATA_TYPE
FROM USER_TAB_COLUMNS U
WHERE U.TABLE_NAME = '<Table Name>'
ORDER BY U.COLUMN_ID;

Create a Content Database for a New Site Collection

I have recently wanted to create individual Content Databases for each new Site Collection that I add to a Web Application. This is excellent for keeping the content separate for backup and restore purposes. If you ever need to restore content then this is the best solution as you will just be restoring ONE Site Collection and not the entire Web Application.

Just as a precuror to this topic, this is what is stored in a Content Database.

  • All documents, news, links, contacts, calendars, and so on.
  • All Web Parts and their settings.
  • All customizations of sites done with SharePoint Designer.

So we are starting with a single Web Application with it's top level Site Collection. This is the Site Collection that is listed a "/" in the Site Collection List via Central Admin. My Top Level Content Database Name is WSS_Content. I now want to create a new Site Collection under /sites/ called sc1, so the first thing I do is create a new Content Database. Central Admin -> Application Management -> SharePoint Web Application Management -> Content databases. Then click on Add a Content database. Once in the next screen ensure that you have the correct Web Application selected, if not then change it now. The only thing you should change in this screen in the Database Name. I usually name the Database WSS_Content_[SiteCollectionName], replacing [SiteCollectionName] with whatever you want.

IMPORTANT STEP: Now put all OTHER Content databases OFFLINE.

Once that is done you will see that the Current Number of Sites is ZERO. Now all you have to do is create a New Site Collection via Central Admin -> Application Management -> SharePoint Site Management -> Create Site Collection for the Web Application you need and there you have it! The New Site Collection latches onto the vacant Content Database. You can double check that by going into the Site Collection List and selecting the new Site Collection that was just created.

COMMENTS: If you do not create a new Content Database first, then the New Site Collection will use the top level Content Database by default, which is fine if that's what you want. Give it a go!

Hope this Helps someone!
Dave Stuart