How to find out which port MS SQL Server is listening on

If you need to quickly find out which port MS SQL Server is listening on, you can run this SQL script –

USE master
GO
xp_readerrorlog 0, 1, N'Server is listening on', 'any', NULL, NULL, N'asc' 
GO

SQL Server port

Advertisements

Retro Gaming Windows 98 setup in VirtualBox

This weekend’s project is setting up retro gaming system for old Windows games. I already use DOSBox for playing old DOS games, but there are a lot of classic that only run under Windows. The easiest (and cheapest) way is to set up a virtual machine running an old copy Windows.

I’ve chosen Windows 98 SE as the OS, since I already have installation media and it is a bit more modern that Windows 95. However, you could also use Window 95 / ME.
Virtual machine that I’m creating will run on VirtualBox, under Mac OS X.

First step is to configure virtual machine. I’ve set it up with 512MB RAM (Windows 98 can’t handle more), 10GB dynamically allocated hard disk, and 128MB of video memory.

Once virtual machine is configured, run Windows setup.

Windows 98 SE Setup

After setup is completed, you’ll need to install new graphics card drivers, as Windows would be running in 16 colour mode and 640×480 resolution. After doing a bit of research, I found that SciTech Display Doctor is the best bet for enabling higher resolution in your VM. You can download it from here. Download is an ISO file, so you can mount the ISO in virtual CDROM.
Once SciTech is installed, open the configuration interface, and enable SciTech video driver. Also change the monitor to one of the generic Super VGA types. Apply changes and restart virtual machine. You should then be able to change number of colours and resolution.

SciTech

Now all you need to do is install some games. To get the files over to the VM, you have two options – over the network, or by creating an ISO file and mounting on the VM. Since Windows 98 will automatically detect VirtualBox network interface, this is probably the easiest way.

T-SQL – How to select data form stored procedure into a table

If you have a stored procedure that returns a dataset, you can insert that data directly into a table.

First, you need to create target table and define columns. Columns need to match the dataset your stored procedure is returning. So for example if your stored procedure returns a dataset that contains integer field followed by two nvarchar(50) fields, target table would look like:

CREATE TABLE #MyTable
(
   Col1 int,
   Col2 nvarchar(50),
   Col3 nvarchar(50)
)

When you’ve defined the table, insert the data by calling your stored procedure:

INSERT INTO #MyTable
EXEC spxMySP @Params