Quantcast
Channel: kristofdba – kristof dba
Browsing all 26 articles
Browse latest View live

Image may be NSFW.
Clik here to view.

t-SQL to replace a part of a value

Did you know you could easily change a part of a string in a value ? Lets say , on day 1 your document database had links to server ‘\\server01\documents’ and, the storage guys decided you should now...

View Article


Image may be NSFW.
Clik here to view.

Check users

this nifty little query will show you who’s logged on and is using a lot of CPU for example, or has High IO activity etc. … You probably know sp_who and sp_who2 , this is just a variation on those...

View Article


Image may be NSFW.
Clik here to view.

Analysis services: Check Connections

You can execute the following query to list current connections to your olap cubes SQL 2008 SELECT * FROM $System.DISCOVER_CONNECTIONS

View Article

Image may be NSFW.
Clik here to view.

t-sql Time queries

–get past hour records WHERE date > DATEADD(HOUR, -1, GETDATE()) –Get past day records where ([date] > DATEADD(dd,-1,GETDATE()))

View Article

Image may be NSFW.
Clik here to view.

JOBS queries and susch

get the owner of the SQL jobs In this example, only if the job is enabled! select s.name,l.name from msdb..sysjobs s left join master.sys.syslogins l on s.owner_sid = l.sid where enabled = 1

View Article


Image may be NSFW.
Clik here to view.

IMDB powershell Function

I have no clue who wrote this but it does work ! i do advise you to only search every 30 sec’or so.. Otherwise you’l get (503) Server Unavailable Function IMDBSearch ($MovieTitle) { $MovieTitle =...

View Article

Image may be NSFW.
Clik here to view.

sys.dm_exec_requests => check your requests progress!

Some nice DMV’s exists to check what is running. It used to be somewhat hard to retrieve this kind of info from SQL server. those days are over ! This script gives you the progress of any restore...

View Article

Image may be NSFW.
Clik here to view.

Search for a string in your tables

Need to find a value in your database but have no clue in which table it resides? http://stackoverflow.com/users/880904/timlehner Wrote this one, without any proc and such, nice ad hoc no nonsense...

View Article


Image may be NSFW.
Clik here to view.

Article 1

The first post in the windows 2012 series! woot woot! I needed to setup a 2012 machine based on another machine and started to poke around with powershell . I listed all the installed features using...

View Article


Image may be NSFW.
Clik here to view.

Table and index size Per Table.

To get the table/index size per table from a sql servere database you can use this script. It uses a cursor to get info per table. thanks to devio !...

View Article

Image may be NSFW.
Clik here to view.

Filestream and powershell

I was looking for a way to store and retrieve FILES (pdf, xls, docx, jpg, png etc. …) in and from a SQL database using the FileStream option. Since bits are documented on the web but i did not find any...

View Article

Image may be NSFW.
Clik here to view.

Check if service broker is enabled (t-sql)

How to see if the service broker for a database is enabled? Run this query an check if the value is 1 or 0 . 1 means enabled! –Get Service Broker Status select name, is_broker_enabled from sys.databases;

View Article

Image may be NSFW.
Clik here to view.

Check Backup completion using the DMV sys.dm_exec_requests

Ever wondered how far your backup or restore operation realy is ? Select * from sys.dm_exec_requests where command like ‘%database%’ Check the colum percent_complete

View Article


Image may be NSFW.
Clik here to view.

Get Database Sizes

With this nifty little bugger you’ll get the database sizes listed. #datasize #size With fs as ( select database_id, type, size * 8.0 / 1024 size from sys.master_files ) select name, (select sum(size)...

View Article

Image may be NSFW.
Clik here to view.

Time difference between 2 columns

Use this to calculate time diff in seconds between two values. This is used to check how long our index maintenance takes in detail ! <code> select L.id, L.DatabaseName, L.Objectname,...

View Article


Image may be NSFW.
Clik here to view.

HiFiBERRY DAC on Raspbmc => 3.10.33+ firmware

I’m not at all a Linux wonder. I do have some background on redhat and debian but still google is my best friend for stuff like this. Since the audio output on raspberry pi rev b is sooooo bad i bought...

View Article

Image may be NSFW.
Clik here to view.

SQL Server 2012 SP2 and Master Data Services => MDS error 500

After installing SP2 on our highly secured master data services Acceptance environment MDS did not work anymore. We got an error 500. After some research it seemed that the rights on the web.config...

View Article


Image may be NSFW.
Clik here to view.

IIS / SQL / Kerberos (ssrs/ mds)

About SPN’s for SQL iis driven pages (ssrs/ mds). sooo… it seems that if you host multiple webpage drivven SQL technologies  (http/  ) on the same machine the initial handshake for kerberos tends to...

View Article

Image may be NSFW.
Clik here to view.

DB RECOVERY PENDING

If your db is in recovery pending, it is unable to recover (pending.. get it) . This means that there is a condition that prevents the sql engine to do the recovery because of issue X. Often this is...

View Article

Image may be NSFW.
Clik here to view.

Group by Multiple Columns

My colleague asked me how to select and group by 2 criteria where one of them is a date, the RANGE was 1 day. I came up with this one.. select CONVERT(char(10), timestamp,126), process, count(RecordID)...

View Article
Browsing all 26 articles
Browse latest View live