December 12, 2012 at 11:36 am
I am using Find and Replace in SSMS to search for any line in my T-SQL code that contains a CREATE but does not include a following DBO. (not case-sensitve) to qualify the object being created. I am able to query all occurrences where CREATE and DBO exist, but have not had much luck trying to exclude where DBO did not follow the CREATE somewhere on the line.
For example, this below code finds all CREATE followed by a DBO on the line:
<CREATE(([^:a]+[:a]+)^1|([^:a]+[:a]+)^2|([^:a]+[:a]+)^3)[^:a]+DBO>
I just do not have the Regex mettle to find where a DBO does not trail the CREATE.
Any help would be greatly appreciated, as I am a little stuck on this one.
Thank you,
Tom
December 12, 2012 at 11:58 am
like '%create%dbo%'
Not really sure what you are looking for. Also if you only the dbo schema why does it matter much if the object is not fully qualified?
_______________________________________________________________
Need help? Help us help you.
Read the article at http://www.sqlservercentral.com/articles/Best+Practices/61537/ for best practices on asking questions.
Need to split a string? Try Jeff Modens splitter http://www.sqlservercentral.com/articles/Tally+Table/72993/.
Cross Tabs and Pivots, Part 1 – Converting Rows to Columns - http://www.sqlservercentral.com/articles/T-SQL/63681/
Cross Tabs and Pivots, Part 2 - Dynamic Cross Tabs - http://www.sqlservercentral.com/articles/Crosstab/65048/
Understanding and Using APPLY (Part 1) - http://www.sqlservercentral.com/articles/APPLY/69953/
Understanding and Using APPLY (Part 2) - http://www.sqlservercentral.com/articles/APPLY/69954/
December 12, 2012 at 12:10 pm
Hello and thanks for the quick reply. I am trying to use the Regular Expressions feature in Find and Replace of the SSMS UI to search my text file that contains our T-SQL code.
December 12, 2012 at 12:23 pm
I don't think that's a regex issue. Wouldn't you just use a find with a "and not" in it? Find anything with CREATE, and not with the regex you already wrote?
- Gus "GSquared", RSVP, OODA, MAP, NMVP, FAQ, SAT, SQL, DNA, RNA, UOI, IOU, AM, PM, AD, BC, BCE, USA, UN, CF, ROFL, LOL, ETC
Property of The Thread
"Nobody knows the age of the human race, but everyone agrees it's old enough to know better." - Anon
December 12, 2012 at 3:52 pm
I am using the Find and Replace dialog from within SSMS. I have a large text file (> 100K lines) that includes a delta of all our change scripts.
December 13, 2012 at 7:43 am
I still say that if you are only looking for dbo that it seems unnecessary. If you have only one schema everything will be created there anyway. Unless you are just trying to figure out how to make the regex work and you can tweak it slightly to check for each schema. I have never had great success with the regex tool in the search dialog. Maybe it is my inability to create complex regex. 😉
_______________________________________________________________
Need help? Help us help you.
Read the article at http://www.sqlservercentral.com/articles/Best+Practices/61537/ for best practices on asking questions.
Need to split a string? Try Jeff Modens splitter http://www.sqlservercentral.com/articles/Tally+Table/72993/.
Cross Tabs and Pivots, Part 1 – Converting Rows to Columns - http://www.sqlservercentral.com/articles/T-SQL/63681/
Cross Tabs and Pivots, Part 2 - Dynamic Cross Tabs - http://www.sqlservercentral.com/articles/Crosstab/65048/
Understanding and Using APPLY (Part 1) - http://www.sqlservercentral.com/articles/APPLY/69953/
Understanding and Using APPLY (Part 2) - http://www.sqlservercentral.com/articles/APPLY/69954/
Viewing 6 posts - 1 through 5 (of 5 total)
You must be logged in to reply to this topic. Login to reply