[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 197
  • Last Modified:

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
0
bibi92
Asked:
bibi92
  • 2
1 Solution
 
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

Featured Post

Upgrade your Question Security!

Add Premium security features to your question to ensure its privacy or anonymity. Learn more about your ability to control Question Security today.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now