June 11, 2014 at 12:35 pm
All,
First time post and I am learning TSQL. Anyway, I have a weird issue that I was hoping you guys could help me with. I have an database that is housing a path used to locate an external file. This application was written many years ago and I am now trying to bring the files into the database as a VARBINARY. So, I a writing a script to do this and have a small problem.
The table is holding the path like this "/folder/folder/file"
I am trying to convert that path to "\folder\folder\file"
In my Select statement I have
SELECT ProdID, REPLACE (PATH, /, \) FROM dbo.blahblah
The problem is that I can't figure out to make SQL understand that "/" is the character I want to replace. Am I going the right direction, or down a rabbit hole? Any help is appreciated.
June 11, 2014 at 12:37 pm
You're on the right direction. You just need to quote your characters/strings. 😉
SELECT ProdID, REPLACE (PATH, '/', '\')
FROM (SELECT 1 AS ProdID, '/folder/folder/file' AS [PATH])blahblah
June 11, 2014 at 1:40 pm
LOL, I quoted one but not the other, I never thought to try both. That worked, thanks! 🙂
Viewing 3 posts - 1 through 3 (of 3 total)
You must be logged in to reply to this topic. Login to reply