Miscellaneous

Technical Article

A faster way to count rows in a table

  • Script

SQL Server includes the COUNT function for counting a table's rows - however, it can be slow.  Although querying the "rows" column from the sysindexes table is faster, it is not always accurate (e.g., if a bulk load process has recently taken place).  In addition, you would not be able to use this method in […]

1.33 (3)

You rated this post out of 5. Change rating

2003-09-11

405 reads

SQLServerCentral Article

Normalizing Dates

  • Article

Jon has been off in the land of C# and web apps for a while, but a recent project has him investigating OLAP and then coming up with a custom solution that met his needs. Jon helped us get this site off the ground, good to have him back for a guest appearance!

You rated this post out of 5. Change rating

2003-09-05

10,988 reads

Technical Article

Get contents of a directory/share to a table

  • Script

Following on from todays QOD (on xp_cmdshell permissions) I thought this might be useful.Takes a directory or UNC path and returns the contents as a table.  eg:exec sp_getdir '\\mypc\c$'returns:datestring timestring directory   filesize    nameoffile---------- ---------- ----------- ----------- ----------------------18/07/2003 10:45      1           NULL        Documents and Settings18/07/2003 11:02    […]

You rated this post out of 5. Change rating

2003-09-04

259 reads

Technical Article

To Get Latest SQL Job Status

  • Script

This query will give you the current job status of all scheduled jobs on sql server. Just by using sysJobs, and sysJobHistory table you will get to know the details about the last status of the scheduled jobs, irrespective of their status like failed, successful, or cancelled.Note: You must have admin right on MSDB database […]

3.54 (13)

You rated this post out of 5. Change rating

2003-09-04

8,552 reads

Technical Article

Convert float to duration-time string

  • Script

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

998 reads

Technical Article

Prioritised list to table

  • Script

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

78 reads

Technical Article

Execute large sql (>8000 chars)

  • Script

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

595 reads

Blogs

Troubleshooting SQL Server – Starting with the Error Log

By

We’ve all been there. Someone walks up and asks, “Is SQL Server having issues?”...

From OLTP to Analytics: Bridging the Gap with Modern SQL Architectures

By

In the beginning, there was OLTP – Online Transaction Processing. Fast, reliable, and ruthlessly...

Free Online Sessions – Building the €100 DWH and Indexing for Dummies

By

I’m giving two online sessions soon on virtual events that are free to attend....

Read the latest Blogs

Forums

The Security of Old Tech

By Steve Jones - SSC Editor

Comments posted to this topic are about the item The Security of Old Tech

Revisiting SQL Server Window Functions- A Practical Walkthrough

By Chandan Shukla

Comments posted to this topic are about the item Revisiting SQL Server Window Functions-...

Tables with a SPARSE Column and Consumption

By dbakevlar

Comments posted to this topic are about the item Tables with a SPARSE Column...

Visit the forum

Question of the Day

Tables with a SPARSE Column and Consumption

True or False:  Tables with a SPARSE column consume more space than regular columns if most values are NOT NULL.

See possible answers