Thursday, July 28, 2011

SSIS Import/Export Wizard: “Unexpected Unrecoverable Error” in SQL 2008 R2.

In my last class I was teaching Import/Export feature for SQL 2008 on windows 7 thru  SQL Server Management Studio’s import and export wizard. I am getting “Unexpected and Unrecoverable Error” message with Abort,Retry and Cancel button. Any button you press it just abnormally close the import export wizard. This was very annoying and I was not able to get my work done.  


After some research I have found that you need to install the Extended .Net Framework 4. After installing this everything works as expected. You need to make sure to do windows update after the install as there is security patch for it.

Some people also suggest different method to edit “C:\Program Files\Microsoft SQL Server\100\DTS\Binn\DTSWizard.exe.config"  and comment out/delete . I tried this option but in my case it not works. 

I suggest to install .Net framework 4.



Thursday, July 14, 2011

How to select / delete/update NULL record?


You cannot use  = NULL , you have to use IS NULL
e.g
-- Create temporary table
CREATE TABLE #TempSP (eid INT IDENTITY, Value1 varchar(10))

-- Insert sample values
INSERT INTO #TempSP values ('Value1')
INSERT INTO #TempSP values ('Value2')
INSERT INTO #TempSP values ('Value3')
INSERT INTO #TempSP values (NULL)

-- Select query for check what's in table
SELECT * FROM #TempSP

-- Select query where value1 is NULL
SELECT * FROM #TempSP
WHERE value1 IS NULL -- WHERE value1 = NULL won't work

-- Delete rows where value1 is NULL
DELETE FROM #TempSP
WHERE Value1 IS NULL  -- WHERE Value1 = NULL won't work

-- Select query for check what's in table
SELECT * FROM #TempSP

-- Drop temporary table
DROP TABLE #TempSP