Keith Henry

Get contents of a directory/share to a table

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    […]

2003-09-04

240 reads

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) […]

2003-09-03

473 reads

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.

2003-09-01

525 reads

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 […]

2003-09-01

66 reads

Blogs

Containers: Create a Custom Container

By

Creating a custom container is where things get truly exciting. There’s actually a ton...

Mini-Rant: Spoofed Phone Numbers and Trust

By

I’ve seen this more and more over the last year: I receive a phone...

Speaking at SQL Saturday Dallas

By

Speaking at SQLSaturday Dallas! I’m proud to announce that I will be speaking at SQL...

Read the latest Blogs

Forums

The Change Failure Rate

By Steve Jones - SSC Editor

Comments posted to this topic are about the item The Change Failure Rate

Reporting Server

By Admingod

I have reporting server which gets replicated from other OLTP server.However, the reporting server...

FlushCache Error Message

By bobba

While analyzing an issue, I stumbled on to a "FlushCache" error message (error log). ...

Visit the forum

Ask SSC

SQL Server Q&A from the SQLServerCentral community

Get answers