SQL Clone
SQLServerCentral is supported by Redgate
 
Log in  ::  Register  ::  Not logged in
 
 
 


Finding table name based on a specific value


Finding table name based on a specific value

Author
Message
Raghavender Chavva
Raghavender Chavva
SSCertifiable
SSCertifiable (6.2K reputation)SSCertifiable (6.2K reputation)SSCertifiable (6.2K reputation)SSCertifiable (6.2K reputation)SSCertifiable (6.2K reputation)SSCertifiable (6.2K reputation)SSCertifiable (6.2K reputation)SSCertifiable (6.2K reputation)

Group: General Forum Members
Points: 6172 Visits: 1421
Comments posted to this topic are about the item Finding table name based on a specific value

Thanks and Regards!!

Raghavender Chavva
jeffgonnering
jeffgonnering
SSC-Addicted
SSC-Addicted (477 reputation)SSC-Addicted (477 reputation)SSC-Addicted (477 reputation)SSC-Addicted (477 reputation)SSC-Addicted (477 reputation)SSC-Addicted (477 reputation)SSC-Addicted (477 reputation)SSC-Addicted (477 reputation)

Group: General Forum Members
Points: 477 Visits: 558
query does not take into account the table schema so it is fails in my database. It will only work if all tables are in the dbo schema, which is not a best practice.
Sean Lange
Sean Lange
SSC Guru
SSC Guru (206K reputation)SSC Guru (206K reputation)SSC Guru (206K reputation)SSC Guru (206K reputation)SSC Guru (206K reputation)SSC Guru (206K reputation)SSC Guru (206K reputation)SSC Guru (206K reputation)

Group: General Forum Members
Points: 206309 Visits: 19047
jeffgonnering - Tuesday, April 17, 2018 8:38 AM
query does not take into account the table schema so it is fails in my database. It will only work if all tables are in the dbo schema, which is not a best practice.


This is only the beginning of the challenges. It only looks for .com so if you have any other top level domain this will miss it. Also using antiquated join syntax and mixing system catalog view with informationschema views is a bit odd.

I would suggest to the OP that a better solution to updating all the email addresses in your database and hoping you don't miss some would be use something like Papercut so you can intercept ANY email sent to ANY address from a given machine. It is super flexible and allows for all sorts of exceptions and detailed rules. There are other options out there of course but papercut is one I have used for this exact type of thing. It eliminates the accidental emails to customers/clients from a QA or dev machine much more accurately than updating a bunch of tables and hoping you didn't miss any.

_______________________________________________________________

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.

Cross Tabs and Pivots, Part 1 – Converting Rows to Columns
Cross Tabs and Pivots, Part 2 - Dynamic Cross Tabs
Understanding and Using APPLY (Part 1)
Understanding and Using APPLY (Part 2)
Raghavender Chavva
Raghavender Chavva
SSCertifiable
SSCertifiable (6.2K reputation)SSCertifiable (6.2K reputation)SSCertifiable (6.2K reputation)SSCertifiable (6.2K reputation)SSCertifiable (6.2K reputation)SSCertifiable (6.2K reputation)SSCertifiable (6.2K reputation)SSCertifiable (6.2K reputation)

Group: General Forum Members
Points: 6172 Visits: 1421
jeffgonnering - Tuesday, April 17, 2018 8:38 AM
query does not take into account the table schema so it is fails in my database. It will only work if all tables are in the dbo schema, which is not a best practice.

Thank You Jeff.
We can add the table schema in the script. I will test it and update the script.


Thanks and Regards!!

Raghavender Chavva
bwalsh 41768
bwalsh 41768
Forum Newbie
Forum Newbie (7 reputation)Forum Newbie (7 reputation)Forum Newbie (7 reputation)Forum Newbie (7 reputation)Forum Newbie (7 reputation)Forum Newbie (7 reputation)Forum Newbie (7 reputation)Forum Newbie (7 reputation)

Group: General Forum Members
Points: 7 Visits: 158
To improve performance, you should also want to take isc.data_type into account, you won't be storing email addresses in datetime, interger etc columns.
You may however, have columns with the TEXT data type, and this throws an error:

Operand data type text is invalid for count operator.


Go


Permissions

You can't post new topics.
You can't post topic replies.
You can't post new polls.
You can't post replies to polls.
You can't edit your own topics.
You can't delete your own topics.
You can't edit other topics.
You can't delete other topics.
You can't edit your own posts.
You can't edit other posts.
You can't delete your own posts.
You can't delete other posts.
You can't post events.
You can't edit your own events.
You can't edit other events.
You can't delete your own events.
You can't delete other events.
You can't send private messages.
You can't send emails.
You can read topics.
You can't vote in polls.
You can't upload attachments.
You can download attachments.
You can't post HTML code.
You can't edit HTML code.
You can't post IFCode.
You can't post JavaScript.
You can post emoticons.
You can't post or upload images.

Select a forum








































































































































































SQLServerCentral


Search