Bulk delete in MS-SQL server

If you want to simulate bulk-deleting in Microsoft SQL-server this can do the trick. I use it to avoid getting a transaction log that fills up the harddisk.
The example uses a stored procedure, but you don’t have to do this. The stored procedure is given a year-variable that is used in the SQL-sentences that selects what has to be deleted.




— SET NOCOUNT ON added to prevent extra result sets from
— interfering with SELECT statements.


— Insert statements for procedure here
Declare @for_delete INT
Declare @chunk_size INT

SELECT @chunk_size=100000
SELECT @Count = 0
select @for_delete=count(*) from [YOUR_TABLE] where [YOUR_VARIABLE] in (@ActionYear)

While (@Count < @for_delete)
SELECT @Count = @Count + @chunk_size
DELETE top(@chunk_size) from [YOUR_TABLE] where [YOUR_VARIABLE] in (@ActionYear)

It’s excecuted in the following manner: exec sp_BULK_DELETE_AREA_YEAR ‘2011’

I haven’t figured out how to use a variable that contains the tablename. So I don’t think it’s possible. You have to write the table name.
The solution was found here.

Enable xp_cmdshell in Microsoft SQL-server

Disclaimer: Beware of the possible security threat when you enable xp_cmdshell usage. You can also take a look at this article, it’s at bit more complicated, but a lot safer.
The article pretty much walks you through, what you need to do to use SQLCLR. I tried it out and got stuck when i got a security threat. I got the threat because you have to give the assemblies that you use (‘alter assemblies…’) a given state – safe, unsafe and external in the SQL-server.

EXEC master.dbo.sp_configure ‘show advanced options’, 1
EXEC master.dbo.sp_configure ‘xp_cmdshell’, 1

It’s also possible to use ‘sp_oacreate’.

Problem playing MKV on WDTV (Gen1)

If your WDTV (Gen1) freezes when you want to play a MKV-movie you can try the following.

  1. Download and install mkvtoolnix.
  2. Start MKVmerge GUI
  3. Load/Add the MKV-file your having problems playing.
  4. Change the video-stream. Press the video-stream. Go to the ‘Extra options’-tab and change the compression to ‘None’.
  5. Do the same for the audio-stream.
  6. Press ‘Start muxing’

Solution found at here.

Sony Ericsson X10 Mini Pro as WIFI-hotspot eg. for an Ipad

Below is a guide as to how it is possible to turn your Sony Ericsson X10 Mini Pro into a WIFI-hotspot eg. for your Ipad.

Disclamer: You need to root your phone. Read all about the consequences of this action on the Internet before you proceed. The below guide worked for me this doesn’t mean that it will work for you.

  1. On your phone check “debbuging mode” on Setting > Applications > Development
  2. You need to download an install Flashtool.
  3. Go to the folder, where Flashtool gets installed eg. C:\Flashtool\drivers and run Flashtool-drivers.exe to install the correct drivers for Flashtool.
  4. Install the correct drivers for your Sony Ericsson X10 Mini Pro.
  5. Start Flashtool.
  6. Connect your phone to your computer via the USB-cabel and Flashtool will recognize it.
  7. When Flashtool is ready press the open padlock symbol.
  8. Flashtool now roots your Sony Ericsson X10 Mini Pro and reboots it.
  9. After that you will now be able to see the SuperUser icon on your phone.
  10. Go to Android Marked and download ‘Barnacle Wifi Tether’ (http://szym.net/barnacle/).
  11. You probably need to press the ‘Associate’-button in ‘Barnacle Wifi Tether’ on your phone a couple of times when you are connecting with the Ipad before it connects. When it connects ‘Barnacle Wifi Tether’ will notify you and show your connection under ‘Clients’.

I have tried using the WEP-encryption. I doesn’t seem to be able to connect very well. You have to press the “Associate”-button a lot of times. If you leave the connection unencrypted it seems to connect very well. BUT this leaves you with a security issue!
In the settings for ‘Barnacle Wifi Tether’ it is possible to choose ‘Auto Associate’ it will auto associates every 5 seconds until a client connects.

SAS S-Notes

S-Notes from SAS Institute will give you an overview of knowledgebase notes and possible hotfixes for different SAS-products.


The mail that you will receive on a daily basis will look something like this. It is not possible to subscribe to specific SAS-products. All SAS-products is contained in the mail.

SNOTES-L update for 27JAN2012

New or Revised SAS Notes

product = Base SAS

43817  – A %INCLUDE statement for an externally allocated data set might fail in the z/OS environment
Release(s) Reported:
Release(s)    Fixed: 9.3
Date        Created: 25JUL2011
Date   Last Updated: 26JAN2012

45507  – FILEEXIST causes an infinite loop on Unix if path equates to the root directory
Release(s) Reported: 9.21_M3
Release(s)    Fixed:
Date        Created: 26JAN2012
Date   Last Updated: 26JAN2012

45503  – Metaserver and metaport options are not valid with the SAS Information Maps LIBNAME engine when the code is included in a SAS Stored Process
Release(s) Reported: 9.21
Release(s)    Fixed:
Date        Created: 26JAN2012
Date   Last Updated: 26JAN2012

product = SAS Add-in for Microsoft Office

45501  – Information maps with incorrectly truncated data item names cannot be opened in SAS Enterprise Guide and the SAS Add-In for Microsoft Office
Release(s) Reported: 4.3
Release(s)    Fixed:
Date        Created: 26JAN2012
Date   Last Updated: 26JAN2012

product = SAS Enterprise Guide

45501  – Information maps with incorrectly truncated data item names cannot be opened in SAS Enterprise Guide and the SAS Add-In for Microsoft Office
Release(s) Reported: 4.3
Release(s)    Fixed:
Date        Created: 26JAN2012
Date   Last Updated: 26JAN2012

product = SAS Financial Management

45359  – Number formatting styles might be ignored in SAS Financial Management reports or data-entry forms
Release(s) Reported: 5.2
Release(s)    Fixed: 5.3
Date        Created: 11JAN2012
Date   Last Updated: 26JAN2012

45320  – Red/pink cells displayed in SAS Financial Management Web-based data entry form
Release(s) Reported: 5.2
Release(s)    Fixed: 5.3
Date        Created: 09JAN2012
Date   Last Updated: 26JAN2012

45367  – Time dimension is not drillable in a SAS Financial Management Web data entry form
Release(s) Reported: 5.2
Release(s)    Fixed: 5.3
Date        Created: 11JAN2012
Date   Last Updated: 26JAN2012

product = SAS Warranty Analysis

41253  – SAS Warranty Analysis rich client launch fails with Error: Unexpected exception: java.lang.NullPointerException
Release(s) Reported: 4.2
Release(s)    Fixed:
Date        Created: 15OCT2010
Date   Last Updated: 26JAN2012

Search SAS Problem Notes, Usage Notes, and Samples on the Technical Support Web Site:
You can go to SAS Institute’s Technical Support web site search page at:
to search for these and other notes. Alternatively, if your mail program
allows it, you can simply click on the url below the title to view them
via your browser.

===================================================Problem/Question Submission:
You can submit questions or problems SAS Institute’s Technical Support
web site at:
=================================================================================Unsubscribing from the SNOTES-L Listserv:
To unsubscribe you can send mail to LISTSERV@LISTSERV.SAS.COM with:
‘SIGNOFF snotes-l’
as the only text in the body of the message (without the single quotes).
You can also unsubscribe via the web at:
SAS Institute Technical Support



OS Scheduler in SAS Management Console (SMC)

Defining an operating system scheduling server in the metadata repository

  1. In SAS Management Console, right-click Server Manager and select New Server. Fill out the next windows of the wizard with this information:
    a. Scheduling Servers: Operating System Services
    b. Scheduling server name: OS Scheduling Server
    c. SubType: Windows
    d. Control Directory: eg. C:\SAS\Config\Lev1\SchedulingServer
    e. Command: eg. C:\SAS\Config\Lev1\SchedulingServer\SchedulingServer.bat
    f. Object Server Parameters: applevel=2
    g. Authentication Domain: DefaultAuth
    h. Host Name field: <Server>
    i. Port number: 8451
    j. Select Finish when you have entered all the necessary information.

Associating the operating system scheduling server with a spawner definition

  1. In SAS Management Console, right-click the object spawner defined in Server Manager and select Properties.
  2. In the Spawner Properties dialog box, select the Servers tab.
  3. From the Available Servers list, select the operating system scheduling server and move it to the Selected Servers list.
  4. Click OK.
  5. Restart the services for the object spawner eg through services.msc on the OS.

It might also be nessessary to allow inbound connections in OS firewall on port 8451 (this port might be different on your SAS-system).

Partitioning in Microsoft SQL-server 2008

When partitioning tables in Microsoft SQL-server 2008 you could get this error when your trying to move to the next step after mapping your partitions.

The number of filegroups or range values is not valid. Enter an extra filegroup in addition to the number of boundary values.

Your partition mapping will probably look something like this.

The error occurs because you haven’t choosen a filegroup for the last empty partition (the one after 2011). Your partition mapping should look like this.

In SQL the partition function will look like this.

CREATE PARTITION FUNCTION [<pf_Year>](varchar(4))
FOR VALUES (N’2007′, N’2008′, N’2009′, N’2010′, N’2011′)