Wednesday, 7 December 2016

Preffer IPv4 over IPv6 in Windows

start-->run-->regedit

Navigate to:
HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Tcpip6\Parameters

Create a new 32bit Dword (this works for both x86 and x64 machines) and call it "DisabledComponents"

Right-click and select modify. Fill in the field with all F's.

Reboot.

Thursday, 13 October 2016

Tuesday, 4 October 2016

Fetch the row count for all tables in a SQL SERVER

CREATE TABLE #counts
(
    table_name varchar(255),
    row_count int
)

EXEC sp_MSForEachTable @command1='INSERT #counts (table_name, row_count) SELECT ''?'', COUNT(*) FROM ?'
SELECT table_name, row_count FROM #counts ORDER BY table_name, row_count DESC
DROP TABLE #counts

Wednesday, 29 June 2016

Strip accents with VBA

Create new module and insert:

Function StripAccent(thestring As String)
Dim A As String * 1
Dim B As String * 1
Dim i As Integer
Const AccChars = "ČŠŽšžYAÁÂAÄAÇEÉEËIÍÎI?NOÓÔOÖUÚUÜÝaáâaäaçeéeëiíîi?noóôoöuúuüýyřčťáěů"
Const RegChars = "CSZszYAAAAAACEEEEIIIIDNOOOOOUUUUYaaaaaaceeeeiiiidnooooouuuuyyrcraeu"
For i = 1 To Len(AccChars)
A = Mid(AccChars, i, 1)
B = Mid(RegChars, i, 1)
thestring = Replace(thestring, A, B)
Next
StripAccent = thestring
End Function


use as:
=StripAccent(A1)