Find truncated string (paths) in SQL server

I recently encountered a strange bug on a database of a client, which I designed. The “bug” was that the paths he entered into the database got truncated, because it was too long of a string. I made the field length at 250 chars and he needed more.

The problem was he already submitted quite some data into the database and could not remember where the paths were extra long. So, I needed to find it for him so he could re-submit those.

I scratched my head for a couple of minutes on how can I find those truncated strings, it could be quite difficult, because it’s a path to an MP3 file, I found a way to do it with a simple T-SQL script.

What I did was to simply find all of the song-paths that did not have an “.mp3″ at the end.

This is the script:

SELECT layerID, layerName, mp3FileUrl FROM appLayers
	WHERE
	(
		mp3FileUrl NOT LIKE '%.mp3'
	)

An example result
/Maximum_Basof_Nipol/Od_Paam/Acc Gtr Chorus St 2.m

  • veterinary technician

    Great information! I’ve been looking for something like this for a while now. Thanks!

  • veterinary technician

    Great information! I’ve been looking for something like this for a while now. Thanks!

  • http://www.visittetonvalley.com/ Visit Teton Valley

    Hello, thanks for posting this information, I was trying to find information on this topic – this was very helpful.