469,356 Members | 1,958 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,356 developers. It's quick & easy.

Is there way to do global changes to SQL in ASP pages

We have over 100 asp pages that reference a table (distribution_components).
We added a new column and primary key to that table, so now we have to modify
the where clause to include that column (we have to make the new column = to a
session variable in the page)

The table appears 531 times in our code. Is there some util or method that
allows us to change it globally, other than going to each occurrance, and
adding the new column to the where clause
Jul 19 '05 #1
11 1653
> The table appears 531 times in our code. Is there some util or method
that
allows us to change it globally, other than going to each occurrance, and
adding the new column to the where clause


If the sql statements are exactly the same, you could do a global search and
replace using Visual Studio, or something similar. You could probably at
least knock a few off if you do a search and replace on various instances of
the sql statements.

Other than that, I'm not sure of any other way... I think you're out of
luck.
Jul 19 '05 #2
This might be a good time to switch to using stored procedures.

"johnston" <jo******@thot.com> wrote in message
news:3f***********************@newscene.com...
We have over 100 asp pages that reference a table (distribution_components). We added a new column and primary key to that table, so now we have to modify the where clause to include that column (we have to make the new column = to a session variable in the page)

The table appears 531 times in our code. Is there some util or method that allows us to change it globally, other than going to each occurrance, and
adding the new column to the where clause

Jul 19 '05 #3
http://www.aspfaq.com/2201
http://www.aspfaq.com/2423


"johnston" <jo******@thot.com> wrote in message
news:3f***********************@newscene.com...
In article <OT**************@TK2MSFTNGP12.phx.gbl>, "Aaron Bertrand - MVP" <aa***@TRASHaspfaq.com> wrote:
This might be a good time to switch to using stored procedures.

"johnston" <jo******@thot.com> wrote in message
news:3f***********************@newscene.com...
We have over 100 asp pages that reference a table

(distribution_components).
We added a new column and primary key to that table, so now we have to

modify
the where clause to include that column (we have to make the new column =
to a
session variable in the page)

The table appears 531 times in our code. Is there some util or method

that
allows us to change it globally, other than going to each occurrance,

and adding the new column to the where clause


do you have a good web page or article on doing that? Lots of people

sugguest it but i have yet to see a good expalnation with example

Jul 19 '05 #4
Or at least use a function to return an array of your data every place you
need it 531 times. Good lord. I don't mean this to sound rude johnston,
really, but let this be a lesson to you.

Ray at work

"TomB" <sh*****@hotmail.com> wrote in message
news:Oa**************@tk2msftngp13.phx.gbl...
I disagree.

A good time to switch to using stored procedures is before you've written
531 sql statements in your code.
"Aaron Bertrand - MVP" <aa***@TRASHaspfaq.com> wrote in message
news:OT**************@TK2MSFTNGP12.phx.gbl...
This might be a good time to switch to using stored procedures.

"johnston" <jo******@thot.com> wrote in message
news:3f***********************@newscene.com...
We have over 100 asp pages that reference a table (distribution_components).
We added a new column and primary key to that table, so now we have to

modify
the where clause to include that column (we have to make the new
column =
to a
session variable in the page)

The table appears 531 times in our code. Is there some util or
method that
allows us to change it globally, other than going to each occurrance,

and adding the new column to the where clause



Jul 19 '05 #5
> I disagree.

A good time to switch to using stored procedures is before you've written
531 sql statements in your code.


Well, given the lack of a time machine, this is probably the best time
*possible*. :-)
Jul 19 '05 #6
you can do a search and replace in dreamweaver through the current doc, a
particular folder, or your whole site.

or you could read in your ASP docs using fso and use a regular expression to
append to your SQL. you don't mention whether the 531 statements are exactly
the same

i'm not knocking you, but why are there 100 pages featuring an instance of
the same table? are you not passing values to it to return the required
results? if the table is identical, you could just supply that table as a
SSI, and then you'd only have had to update the SQL once.

for the future, maybe you should just stick with a SELECT * in your SQL till
you get your database design stabilised

good luck

Jason


"Ray at <%=sLocation%>" <as*@me.forit> wrote in message
news:u9**************@TK2MSFTNGP11.phx.gbl...
Or at least use a function to return an array of your data every place you
need it 531 times. Good lord. I don't mean this to sound rude johnston,
really, but let this be a lesson to you.

Ray at work

"TomB" <sh*****@hotmail.com> wrote in message
news:Oa**************@tk2msftngp13.phx.gbl...
I disagree.

A good time to switch to using stored procedures is before you've written
531 sql statements in your code.
"Aaron Bertrand - MVP" <aa***@TRASHaspfaq.com> wrote in message
news:OT**************@TK2MSFTNGP12.phx.gbl...
This might be a good time to switch to using stored procedures.

"johnston" <jo******@thot.com> wrote in message
news:3f***********************@newscene.com...
> We have over 100 asp pages that reference a table
(distribution_components).
> We added a new column and primary key to that table, so now we have to modify
> the where clause to include that column (we have to make the new column
=
to a
> session variable in the page)
>
> The table appears 531 times in our code. Is there some util or

method that
> allows us to change it globally, other than going to each

occurrance, and
> adding the new column to the where clause



Jul 19 '05 #7
On 16 Jul 2003 08:17:11 -0500, jo******@thot.com (johnston) wrote:
We have over 100 asp pages that reference a table (distribution_components).
We added a new column and primary key to that table, so now we have to modify
the where clause to include that column (we have to make the new column = to a
session variable in the page)

The table appears 531 times in our code. Is there some util or method that
allows us to change it globally, other than going to each occurrance, and
adding the new column to the where clause


Global search and replace in your favorite code editor...

Jeff
===================================
Jeff Cochran (IIS MVP)
jc*************@naplesgov.com - Munged of Course

I don't get much time to respond to direct email,
so posts here will have a better chance of getting
an answer. Besides, everyone benefits here.

Suggested resources:
http://www.iisfaq.com/
http://www.iisanswers.com/
http://www.iistoolshed.com/
http://securityadmin.info/
http://www.aspfaq.com/
http://support.microsoft.com/
====================================
Jul 19 '05 #8
In article <u9**************@TK2MSFTNGP11.phx.gbl>, "Ray at <%=sLocation%>" <as*@me.forit> wrote:
Or at least use a function to return an array of your data every place you
need it 531 times. Good lord. I don't mean this to sound rude johnston,
really, but let this be a lesson to you.

Ray at work

"TomB" <sh*****@hotmail.com> wrote in message
news:Oa**************@tk2msftngp13.phx.gbl...
I disagree.

A good time to switch to using stored procedures is before you've written
531 sql statements in your code.
"Aaron Bertrand - MVP" <aa***@TRASHaspfaq.com> wrote in message
news:OT**************@TK2MSFTNGP12.phx.gbl...
> This might be a good time to switch to using stored procedures.
>
>
>
> "johnston" <jo******@thot.com> wrote in message
> news:3f***********************@newscene.com...
> > We have over 100 asp pages that reference a table
> (distribution_components).
> > We added a new column and primary key to that table, so now we have to
> modify
> > the where clause to include that column (we have to make the newcolumn
=
> to a
i have an oracle background and came to the group that does asp programming.
I have been telling anybody that will listen that we should not use naked sql
in our asp pages, it should be done via a stored procedure.

It is either
stored procedures are for backend stuff not frontend
or
great idea, but this project is too small or deadline is too close, too much
time to develop them, we will surely use it next project, which of course is
also too small or deadline is too close
> > session variable in the page)
> >
> > The table appears 531 times in our code. Is there some util or

method > that
> > allows us to change it globally, other than going to each occurrance,

and
> > adding the new column to the where clause
>
>



Jul 19 '05 #9
"johnston" <jo******@thot.com> wrote in message
news:3f***********************@newscene.com...
We have over 100 asp pages that reference a table (distribution_components). We added a new column and primary key to that table, so now we have to modify the where clause to include that column (we have to make the new column = to a session variable in the page)

The table appears 531 times in our code. Is there some util or method that allows us to change it globally, other than going to each occurrance, and adding the new column to the where clause


WARNING: The following is only suggested for this particular
circumstance. As you have heard from others, a stored procedure would
have been the preferred way to handle this.

That being said, another option available to you is to the following:

1. Call the new table distribution_components_new
2. Create a view/saved query called distribution_table based on the new
table which reproduces the old table with the appropriate where clause
applied.

I don't know what the session variable is but I suspect it's something
available from the database. Could you provide some more details?
Jul 19 '05 #10
In article <eu**************@TK2MSFTNGP10.phx.gbl>, "Chris Hohmann" <hohmannATyahooDOTcom> wrote:

That being said, another option available to you is to the following:

1. Call the new table distribution_components_new
2. Create a view/saved query called distribution_table based on the new
table which reproduces the old table with the appropriate where clause
applied.

I don't know what the session variable is but I suspect it's something
available from the database. Could you provide some more details?

the session variable is from the web page, its not in the database.
Jul 19 '05 #11
"johnston" <jo******@thot.com> wrote in message
news:3f***********************@newscene.com...
In article <eu**************@TK2MSFTNGP10.phx.gbl>, "Chris Hohmann"

<hohmannATyahooDOTcom> wrote:

That being said, another option available to you is to the following:

1. Call the new table distribution_components_new
2. Create a view/saved query called distribution_table based on the new
table which reproduces the old table with the appropriate where clause
applied.

I don't know what the session variable is but I suspect it's something
available from the database. Could you provide some more details?

the session variable is from the web page, its not in the database.

What is it? When is it created? Can it be stored in the database?
Jul 19 '05 #12

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

3 posts views Thread by Jon Maz | last post: by
22 posts views Thread by fd123456 | last post: by
12 posts views Thread by John M | last post: by
14 posts views Thread by Alan Silver | last post: by
8 posts views Thread by Thomas Coleman | last post: by
4 posts views Thread by Grant Merwitz | last post: by
2 posts views Thread by P K | last post: by
2 posts views Thread by Steve | last post: by
reply views Thread by zhoujie | last post: by
reply views Thread by suresh191 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.