Quantcast
Channel: SQLServerCentral » SQL Server 2014 » Development - SQL Server 2014 » Latest topics
Viewing all articles
Browse latest Browse all 3145

Find string with spaces and replace them with other string

$
0
0
I have following query which return me SP/Views and Functions script using:[code="sql"]select DEFINITION FROM .SYS.SQL_MODULES[/code]Now, the result looks like [code="sql"]Create proccreate procedurecreate proccreate view create function[/code]I need its result as:[code="sql"]Alter ProcedureAlter ProcedureAlter ProcedureAlter ViewAlter Function[/code]I used following [code="sql"]select replace(replace(replace(DEFINITION,'CREATE PROCEDURE','Alter Procedure'), 'create proc','Alter Procedure'),'create view','Alter View') FROM .SYS.SQL_MODULES[/code]to but it is checking fixed space like create<space>proc, how can i check if there are two or more spaces in between create view or create proc or create function, it should replace as i want?Shamshad Ali

Viewing all articles
Browse latest Browse all 3145

Trending Articles