Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

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

SQL Replace Regex

Hello,

What is wrong with this --

'/Events/'+LCase(REPLACE(REPLACE(EventTitle),' ', '-'),'--', '-'),

Open in new window


Full script --

insert into dbo.MyPage(
ParentID, 
PageType, 
Live, 
DatePublished, 
EventStartDate, 
EventStartDateLabel, 
EventEndDate, 
EventEndDateLabel,
UK,
Eire,
EU,
ShareHolderOnly,
Title,
SEOLink,
Summary, 
Content,
MainImage
)
Select
3,
1,
EventLive,
DatePublished,
EventStartDate,
DisplayStartDate,
EventEndDate,
DisplayEndDate,
UK,
EIRE,
EU,
ShareholderOnly,
Left(EventTitle,100),
'/Events/'+LCase(REPLACE(REPLACE(EventTitle),' ', '-'),'--', '-'),
Left(EventDescription,350),
EventDescription,
EventImage
FROM 
dbo.[Events]

Open in new window


I'm get the red line under 'LCase(REPLACE(REPLACE(EventTitle),' ', '-'),'--', '-'),
Left(EventDescription,350)'

Thank you
0
garethtnash
Asked:
garethtnash
  • 2
  • 2
1 Solution
 
McOzCommented:
REPLACE(EventTitle) has only one parameter... misplaced parentheses.

McOz
0
 
garethtnashAuthor Commented:
Hi McOz,

Thanks, still lost though, I can't see it, where should the parentheses be?

Thanks
0
 
McOzCommented:
Try this:

LCase(REPLACE(REPLACE(EventTitle,' ', '-'),'--', '-')),

Open in new window

0
 
garethtnashAuthor Commented:
Thanks, this worked -

'/Events/'+REPLACE(REPLACE(LCase(EventTitle),' ','-'),'--','-'),
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

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