Keith Henry


Technical Article

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

You rated this post out of 5. Change rating

2003-09-04

246 reads

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

955 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

574 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

69 reads

Blogs

Building a Docker image with Docker Build Cloud

By

In a previous blog post we went through how to build a Docker container...

Top 8 Courses to Learn SQL for Data Science in 2024 & Beyond

By

Businesses are drowning in data, but starving for insights. That's where SQL experts swoop...

Going to Cloud? Look at the Shared Responsibility Model

By

The bottom line here is this: the idea that a CSP takes care of...

Read the latest Blogs

Forums

Aligning Compatibility Version Strategy

By BOR15K

I have joined a new project, where the business uses Azure SQL Hyperscale for...

azure synapse analytics

By river1

Dears, Hope this message finds you well I did not see in this foruns...

Restore dbs

By mtz676

The below code works for backup files only from local drives. When replaced with...

Visit the forum

Question of the Day

Initial Config of tempdb

What are the initial config sizes for the tempdb primary data files, secondary data files, and log files in SQL Server 2022?

See possible answers