• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 456
  • Last Modified:

Stored Procedure to search all tables and fields

I'm using SQL 2005 and I need a stored procedure to help me locate all tables and field names.  The procedures should do the following:
  Search all fields in the table for fields that begin with #
  Return the table name and all the field names beginning with #
  Do for each each table in the database
0
schmir1
Asked:
schmir1
  • 5
  • 2
1 Solution
 
BrandonGalderisiCommented:
Field NAMES that begin with # or field data that begins with #?

If the first:
select * from inforamtion_schema.columns
where column_name like '#%'
0
 
BrandonGalderisiCommented:
0
 
schmir1Author Commented:
I should have said field data starting with #.  I'll check out the link
0
Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

 
BrandonGalderisiCommented:
just change the line that does:

QUOTENAME('%' + @SearchStr + '%','''')

to

QUOTENAME(@SearchStr + '%','''')

That way you are looking for it at the beginning only.
0
 
BrandonGalderisiCommented:
"I should have said field data starting with #. "

It helps, but I gave you an answer in case it was either! :)
0
 
schmir1Author Commented:
Thanks for your help.  It worked great but returned 1/2 Million records.  Took a while to go through.
0
 
BrandonGalderisiCommented:
No doubt.  There is no EASY way to do that.
0

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

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