General questions about using TextPad
Moderators: AmigoJack, bbadmin, helios, Bob Hansen, MudGuard
-
ravilobo
- Posts: 18
- Joined: Fri Dec 14, 2007 8:45 pm
Post
by ravilobo »
I need to prefix the objects with
schema name. I have the following code,
I need a RegEx which prefixes "dbo." to objects; at the same time it also takes care of existing schema.
Code: Select all
CREATE PROC DBO.F1
CREATE PROC DBO.F2
-
ben_josephs
- Posts: 2461
- Joined: Sun Mar 02, 2003 9:22 pm
Post
by ben_josephs »
Find what: CREATE PROC ([a-z0-9]+)$
Replace with: CREATE PROC DBO.\1
[X] Regular expression
Replace All
This assumes you are using Posix regular expression syntax:
Configure | Preferences | Editor
[X] Use POSIX regular expression syntax
-
ravilobo
- Posts: 18
- Joined: Fri Dec 14, 2007 8:45 pm
Post
by ravilobo »
Thank you Ben! It worked.
-
ravilobo
- Posts: 18
- Joined: Fri Dec 14, 2007 8:45 pm
Post
by ravilobo »
My apologies for not giving a proper example. The RegEx works for my earlier example, however it is not working for following case,
Code: Select all
CREATE PROC F1 AS SELECT GETDATE()
CREATE PROC DBO.F2 AS select col1 from tab
-
ben_josephs
- Posts: 2461
- Joined: Sun Mar 02, 2003 9:22 pm
Post
by ben_josephs »
Find what: CREATE PROC ([a-z0-9]+( |$))
Replace with: CREATE PROC DBO.\1
-
ravilobo
- Posts: 18
- Joined: Fri Dec 14, 2007 8:45 pm
Post
by ravilobo »
Amazing! Thank you ben!