File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes JDBC and Relational Databases and the fly likes sql server question Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Make it so: Java DB Connections & Transactions this week in the JDBC forum!
JavaRanch » Java Forums » Databases » JDBC and Relational Databases
Bookmark "sql server question" Watch "sql server question" New topic

sql server question

Brian Percival
Ranch Hand

Joined: Jun 23, 2004
Posts: 163
I am kinda new to tsql programming and trying to find a quickie from google and such for a solution.

What I want is to get a list of tables and columns that contain a certain string. I actually want to replace all such occuranaces with some other string but here is how I started:

When I try to run ths, it complains that table variable @tn is not declared. Obviously I cann't use a varchar variable in place of a table, looks like..

Can anyone point out how I should change the above? I basically want to use the @tn and @cn as table name and column name in my 'select' inside the loop. HOW???

Thanks for your time.
Brian Percival
Ranch Hand

Joined: Jun 23, 2004
Posts: 163
I got this from forums

Hope this helps posterity.
Jeanne Boyarsky
author & internet detective

Joined: May 26, 2003
Posts: 32844

Thanks for posting the solution Brian!

[OCA 8 book] [Blog] [JavaRanch FAQ] [How To Ask Questions The Smart Way] [Book Promos]
Other Certs: SCEA Part 1, Part 2 & 3, Core Spring 3, TOGAF part 1 and part 2
I agree. Here's the link:
subject: sql server question
It's not a secret anymore!