Programming Tips and Tricks
DECLARE @cPath varchar(100), @cDir varchar(100)SET @cPath = 'D:\TEMP\test.txt'SET @cDir = (CASE WHEN charindex('\', @cPath) = 0 THEN '' ELSE left(@cPath, len(@cPath) - charindex('\', reverse(@cPath))) END)SELECT @cDir
No comments:
Post a Comment