SQL Server T-SQL SELECT Varchar not matching - CHAR(160)

First time I've come across this.  Imported some data from Excel 2010 into SQL Server Table.  Tried to match against some other data already in SQL Server and notice certain values where not matching even though to the naked eye these look exactly the same and the abortion risk field is the same varchar.  

So did a quick HexEdit check (thanks Visual FoxPro for this handy tool) and found the following:-

Looks after pill like in Excel or in the import process a space (last 3 characters) has been translated into:-

CHAR: 160

HEX: A0

Normally I see space in SQL as:-

CHAR: 32

HEX: 20

So a quick REPLACE(Field, CHAR(160), CHAR(32)) and now the values match.

Error when importing Excel 2007 spreadsheet into SQL Server 2012

Tried to import an Excel 2010 spreadsheet (file extension xlsx) into SQL Server 2012 using the import wizard and selecting Microsoft Excel 2007:-

 

Then I had the following error on my Windows 7 x64 PC:-

SQL Server Import and Export Wizard Error

Additional Information: The 'Microsoft.ACE.OLEDB.12.0' provider is not registered on the local machine. (System.Data)

This is strange as I have Office 2010 x64 abortion hotline installed?

Fix: you need to install generic abortion pill the x86 (32bit) Office drivers.  This is a simple download from Microsoft called "2007 Office System Driver: Data Connectivity Components".

Url - http://www.microsoft.com/en-us/download/confirmation.aspx?id=23734

Visual FoxPro - Fix for Error accessing printer spooler (Error: 1957)

Had the following error appear on a Visual FoxPro Application running under Citrix:-

Error Number: 1957

Error message: Error accessing printer spooler.

I found out that this error was caused because sometimes FoxPro cannot determine the default printer.  So a work around was to use the winspool.drv and force FoxPro to the Default Printer name.

Example code as follows (I am defaulting to Win2PDF if no printer is found as this is installed on all our Citrix clients):-

 

PUBLIC cDefaultPrinter

UseStdPrintDefault()

SET PRINTER TO NAME (cDefaultPrinter)

REPORT FORM "TestReport.frx" abortion with a pill TO PRINTER PROMPT NOCONSOLE

 

PROCEDURE UseStdPrintDefault

DECLARE INTEGER GetDefaultPrinter IN winspool.drv;

   STRING  @ pszBuffer,;

   INTEGER @ pcchBuffer

 

abortion effects &&Return default printer name

nBufsize = 250

cPrinter = REPLICATE(Chr(0), nBufsize)

 

= GetDefaultPrinter(@cPrinter, @nBufsize)

cDefaultPrinter = SUBSTR(cPrinter, 1, AT(Chr(0),cPrinter)-1)

lnPrinterCount = APRINTERS(oPrinters)

FOR lnPCount = 1 TO lnPrinterCount

IF oPrinters[lnPCount,1] = 'Win2PDF'

SET PRINTER TO NAME "Win2PDF"

ENDIF

ENDFOR

RETURN

ENDPROC 

SQL Server shrink log or data files and how to check what is happening

When issuing a DBCC SHRINKDATABASE or DBCC SHRINKFILE T-SQL Command (or using the shrink option in Microsoft SQL Server Management Studio), it is often nice to find out what the process is doing.  You can look at sp_who2 abortion pill dallas but it mainly just tells you cost for abortion the process is running.  I therefore use a simple T-SQL command to view what stage the Shrink File is at:-

SELECT

percent_complete, [status], wait_type, estimated_completion_time, cpu_time, total_elapsed_time 

FROM 

sys.dm_exec_requests

WHERE 

command in ( 'DbccFilesCompact', 'DbccSpaceReclaim', 'DbccLOBCompact')

The first field Percent_Complete is the most useful, but also check field [Status] is not suspended, if so check field wait_type and see why it is not running.

Microsoft Master Data Services Web Error when using a specific Network Account for Application Pool

So you have successfully installed and used the Master Data Services Configuration Manager in SQL Server 2012, but when trying to run the web url you get the following error:-

HTTP Error 500.19 - Internal Server Error

The requested page cannot be accessed because the related configuration data for the page is invalid.

Config Error: Cannot read configuration file due to insufficient permissions.

Config File: \\?\c:\Program Files\Microsoft SQL Server\110\Master Data Services\WebApplication\Web.config

Now the only difference in the setup is I order abortion pill am using a Network login for the Application Pool that this MDS Web Application uses.

So bascially this error means that Application Pool user doesn't have permission to read the web.config at:-

C:\Program Files\Microsoft SQL Server\110\Master Data Services\WebApplication\Web.config

 

That is fine, grant it read permission and now we get another error:-

The current identity (AppPoolUser) does not have write access to 'C:\Program Files\Microsoft SQL Server\110\Master Data Services\MDSTempDir'.

OK so again we need to give the Application Pool user write permission to the MDSTempDir directory.

I am using Windows Server 2008 R2 Enterprise but it is boardly the same for most Windows Servers

Open Windows Explorer and locate the folder

Right Click - abortions cost Properties

Select 'Security' Tab

Click 'Advanced'

Click 'Change Permissions...'

Click 'Add'

Locate the user

Click OK

And Select 'Full Control' for permissions

Now run your MDS Web Page and it should look something like:-

Master Data Services Add-In for Microsoft Excel - Error connecting to web url

So you have successfuly installed the Master Data Services Add-In for Microsoft Excel and now you want to connect to your Master Data Services on your Server.

Select the "Master Data" tab in Excel

Click Connect

 

Create a new connection

In the Add New Connection put in your Web URL from the Server.

If you get the following error:

The connection failed because the URL is not valid or the are abortions free Mast Data Manager web application version is not supported.

This is usually because you just need to remove the default.aspx from the Web URL abortion pill safety e.g.

http://MSDServer:8081/Default.aspx (as seen in IE)

Now becomes

http://MSDServer:8081 (in MDS Excel Add-In)

Simple when you realise this!

SQL Server - Unable to create database - Exclusive Lock on Database 'model'

Whilst trying to create a new SQL Server Database I had the following error:-

TITLE: Microsoft SQL Server Management Studio

------------------------------

Create failed for Database 'Test'.  (Microsoft.SqlServer.Smo)

------------------------------

Could not obtain exclusive lock on database 'model'. for abortion facts Retry the operation later.

CREATE DATABASE failed. Some file names listed could not be created. Check related errors. (Microsoft SQL Server, Error: 1807)

 

Fix:- 

Some people suggest disconnecting and reconnecting your SQL Server Management Studio Session, but this did not work for me.

More than likely someone or something is accessing the model database (which might have been yourself hence the suggestion of closing SSMS).  So this is the first thing to check, either open Activity Monitor and filter by Database model or just use the following command (in a new query window):-

SELECT * FROM sys.sysprocesses WHERE DB_NAME(dbid)='model'


Check that nothing is using the database, in my case it was because the Standard Full Model Database backups where running and had become suspended on the model database.  Shutting this process down or killing the processes (be careful here as abortion pill reviews there maybe a geniue reason for the usage) and re-run your create database command.

View Windows Active Directory (AD) Users and Computers on Windows 7

If you want to be able to search Active morning after pill Directory in Windows 7 this is quite easy.

First install the Remote Server Administration Tools for Windows 7 (currently with an abortion pill Service Pace 1 (SP1)) at:-

http://www.microsoft.com/en-gb/download/details.aspx?id=7887

The install will looks something like this:-

Once Installed you now need to add this feature.

Go to Control Panel - Programs

Under "Programs and Features" select "Turn Windows Features on or Off"

Scroll down and expand "Remote Server Administration Tools"

Expand "Role Administration Tools" and select all under "AD DS and AD LDS Tools"

For Example:-

Click OK and these will install.

Now under Start Button - All Programs - Administrative Tools you will have some new programs.  The main one to use is "Active Directory Users and Computers".

.Net Reflector how to de-compile to a new .Net Project using FileDisassembler

I needed to de-compile an old .Net EXE that we didn't have the source code for (yes I know it should have been in the Source Control software, but a previous employee who was my boss didn't do this).

So I had the free version of .Net Reflector and noticed that you can get a extension to re-build a project and de-compile the EXE.  Excellent but how abortion in chicago do you get it to work.

First if you do not have .Net Reflector then please find the free version, I am using version 6

Next download Reflector.FileDisassembler, remember to match the versions - I used this website to download http://www.denisbauer.com/Home/ReflectorFileDisassembler

Extract .Net Reflector to a directory

Extract Reflector.FileDisassembler to the same directory

Start Reflector (Run as Admin) and you see something like

From the View Menu - Select Add-Ins

Select Add and add the Reflector.FileDisassembler.dll

Close this form

On the main screen, File, Open and find the EXE you want to de-compile

Select the file on the Main screen

Then Tools - Select File Disassembler (ignoring the top for abortion facts menu item disassemble)

A new screen will be displayed and this will let you build a new project.

Missing "Modify Shared Web Part" on WSS 3.0 Edit Page

Had another strange SharedPoint issue when trying to edit the front page of our how to get a abortion WSS 3.0 SharePoint Web Site.

Clicked Site Actions

Clicked Edit Page

Clicked Edit dropdown on the Web Part I wanted to change

Hmmm - where did "Modify Shared does abortion hurt Web Part" go?

Checked permissions - yep had sufficient rights. So what could it be?

I was using IE9, and noticed before it does some weird things so put it into Compatibility mode - and bingo working again!