Articles

Affichage des articles du mai, 2012

The 'Microsoft.ACE.OLEDB.12.0' provider is not registered on the local machine

When trying to import data from Excel 2007/2010 file using the import wizard in Management Studio 2008, you receive the following error message: SQL Server Import and Export Wizard The operation could not be completed. Additional information: The 'Microsoft.ACE.OLEDB.12.0' provider is not registered on the local machine. (System.Data) This can be easily solved by installing  "2007 Office System Driver: Data Connectivity Components" which can be found here .

Displaying the Web Site ID and the Description in IIS

Image
In IIS 6 and later, the Web Site ID is a randomly generated number for each site that is created other than the Default Web Site which has an Web Site ID of 1. Knowing which web site uses which ID requires you to manually look at each of them. The following script will allow you to output the ID and description. Save the script to a file with a .VBS file extension and then run using this command: cscript MyFile.VBS Here is the code... Function ProcessWebSite (ServiceType, SiteNumber)   Set IISWebSite = getObject("IIS://localhost/" & ServiceType & "/" & SiteNumber)   Set IISWebSiteRoot = getObject("IIS://localhost/" & ServiceType & "/" &    SiteNumber & "/root")   ProcessWebSite = IISWebSite.ServerComment   Set IISWebSiteRoot = Nothing   Set IISWebSite = Nothing End function Function ShowSites (ServiceType, ClassName, Title)   Set IISOBJ = getObject("IIS://localhost/" & Service

How to combine multiple rows into one column?

A few days ago, I found a very smart usage of both STUFF and FOR XML PATH clauses, in order to combine multiple rows in one column. Just to remember it and to share the info, I wrote a small sample. Not very well known, the STUFF function inserts a string into another string. It deletes a specified length of characters in the first string at the start position and then inserts the second string into the first string at the start position. On the other hand, the new PATH mode allows you to use an XPath-like syntax as a column name which then is mapped into an attribute or element or sub element of the XML as per you specify and you can have multiple level of hierarchy and can mix elements n attributes. Not clear? Let's take a look at a few lines of codes... First, we are going to create a small test table: IF object_id('tempdb..#SampleData') IS NOT NULL BEGIN DROP TABLE #SampleData END SELECT ID, NAME INTO #SampleData FROM ( SELECT 91, 'Tupolev'       UNION ALL