Quantcast
Channel: kristofdba – kristof dba
Browsing index pages (26 articles)

Image may be NSFW.
Clik here to view.

Get all Foreign Keys on a sql db

With this script, you can list all the foreign key relations on a SQL database. Could come in handy! If this returns ‘nothingatall’, you know the DB design needs some improvement SELECT obj.name AS...

View Article


Image may be NSFW.
Clik here to view.

Paas SQL – List rights on objects (tables, views)

So, as data technology is always progressing (or should i say ‘moving’, that leaves room for any direction ) .. I plan to write some more posts on queries i use less often but are still handy. The...

View Article


Get info on restored databases

With this query you’l get the last restore data for a database on your instance. Handy if you cant remember what database you restored wen. Or in my case accidentaly restored the wrong database… wITH...

View Article

Osisoft: Debug (UFL/BUFFER)

THe UFL interface is tha last resort interface to pump data into the PI Data Archive.  AS with all things in it land, this can go wrong… Debugging: In the UFL interface’s INI file you can up the debug...

View Article

Image may be NSFW.
Clik here to view.

Powershell: Handling OSISOFT pi UFL interface files

Since PI UFL (the last resort “load my data interface” for CSV files) is a burden to manage if you have ‘big’ inerface .INI file i created some script to troubleshoot issues. They can be used to work...

View Article


Find jobs running at given time

Original Source: SQLMAG ! DECLARE @targetTime datetime = '2017-01-21 15:10:49'; -- SET @targetTime = 'xxx' -- for SQL Server 2008 and less -- convert to string, then int: DECLARE @filter int =...

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

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.

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.

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.

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.

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.

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.

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.

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.

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.

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.

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.

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.

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
Browsing index pages (26 articles)


Latest Images