Scripts

Technical Article

Convert float to duration-time string

This UDF is using in reporting where lots of durations are calculated, stored and then summed up and averaged for reports.  By storing the durations as floats (which are similar to the fixed point numbers datetimes are stored as) math functions are simpler.The problem is that float-times are not human readable, and cast(@floatime as datetime) […]

You rated this post out of 5. Change rating

2003-09-03

985 reads

Technical Article

Execute large sql (>8000 chars)

With a dynamic sql script under 4000 chars use sp_executesql With under 8000 chars write it to a variable.For anything longer you can use this script.  Use UpdateText and WriteText to write your dynamic sql to a text/ntext field in a table somewhere and then pass its location to this script.

You rated this post out of 5. Change rating

2003-09-01

580 reads

Technical Article

Prioritised list to table

I wrote this to allow me to send a priority list of int ids.This takes a "," seperated list of integers and puts them into a table, along with an [insorder] field that allows you to sort them.eg 2,6,3,1,7 becomesints insorder ---- --------1    72    13    56    37    9Depending on what […]

You rated this post out of 5. Change rating

2003-09-01

75 reads

Technical Article

Track Long Running Queries

SQL2000 only.We use the attached script to schedule a SQL Agent job that sets up a Profile trace looking for long queries, and hourly imports them into a table.  This way we can historically (but with some degree of real time) look to see what queries put a load on the system.  We then allow […]

5 (1)

You rated this post out of 5. Change rating

2003-08-23

1,473 reads

Technical Article

Compare Parallel Data Streams

This a script to compare two parallel data streams, in my case production and QA.  Two extracts were created and a mapping table was created as a look-up between old and new recordids.  A final table TestResults was created to hold the results of the comparison.  The comparison table names and join syntax are controlled […]

You rated this post out of 5. Change rating

2003-08-21

145 reads

Technical Article

Delete old backup files

A stored procedure and two functions that given a path, a date and a file extension will do one of the following:-Delete all files of the supplied extension in that directory before a certain date.-Delete everything before the last full backup.I use this because disk space is tight and maintenance plans seem to delete old […]

You rated this post out of 5. Change rating

2003-08-21

713 reads

Technical Article

Display Defragmentation Of Selected Tables

This script will display the defragmentation of table(s) all indexes of selected tables and display a table/list of the DBCC SHOWCONTIG. It will aslo will report if there are tables in the list that can't be found in the current database. Run the script in the database where the tables you want to check are.Check […]

You rated this post out of 5. Change rating

2003-08-21

783 reads

Technical Article

Get Filegrowth info from backuphistory

This uses info in backup tables to display growth of datafiles (LDF and MDF) and actual datagrowth (backupsize)  over a period of time.  Replace parameter values with name of your database and date from when you want info displayed. Results are best viewed in grid.

5 (2)

You rated this post out of 5. Change rating

2003-08-20

397 reads

Blogs

A New Word: Ochisia

By

ochisia – n. the fear that the role you once occupied in someone’s life...

Create a Numbers Table in Power Query

By

This is a quick blog post, mainly so I have the code available if...

Microsoft finally adds Tenant Switcher for Fabric / Power BI

By

Praise whatever deity you believe in, because it’s finally here, a tenant switcher for...

Read the latest Blogs

Forums

It's The People

By Grant Fritchey

Comments posted to this topic are about the item It's The People

To View or not to View, that is the question...

By pietlinden

I've read lots of the horror stories about nested views in databases where they're...

Grant user read-write permission to a single database

By PJ_SQL

Hello! How do I grant a user to read-write to a single database and...

Visit the forum

Question of the Day

The Density Vector

When building statistics, there is the concept of density that refers to the duplicates in a table. How is this calculated?

See possible answers