remove [ ] in a job name

Hello,

How can I remove [ ]  between  a job name?
I try to modify this query, but the result is not correct :
set nocount on; SELECT DISTINCT REPLACE(name, ' [ ] ', '') FROM    msdb..sysjobs"
Thanks
bibi92Asked:
Who is Participating?
 
John EastonDirectorCommented:
I assume your current job name is something like [job] - if so, try the following:

SELECT DISTINCT REPLACE(REPLACE(name, '[', ''),']','') FROM msdb..sysjobs
0
 
bibi92Author Commented:
Hello,

Yes like [ job ], I try but how can I delete space like [] are removed.
Thanks
0
 
awking00Commented:
Not sure I understand your concern with deleting space. If you're referring to something like [job ] (where ther is a space after job), then just modify the query JEaston provided adding a trim function (i.e. trim(replace(replace(name, '[',''),']',''))
0
 
bibi92Author Commented:
Hello,

Thanks, I have found :
SELECT DISTINCT REPLACE(REPLACE(REPLACE(name,'[',''),']',''),' ', '') FROM msdb..sysjobs

Regards
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.