Showing posts with label clause. Show all posts
Showing posts with label clause. Show all posts

Tuesday, March 20, 2012

automatic rename in FROM clause of dependant objects ?

I have a problem.
I should rename some tables which are referenced in numerous stored
procedures.
Is there any way to automatically replace old table name with new one in all
dependant stored procedures,
instead of manual replacement in every stored procedure ehich would be
time-consuming?

Thank you in advance.Hi

No. You need to do it by hand for all Functions, Triggers and Stored
Procedures.
People will really get cross is SQL server would go and change scripts.

Regards
----------
Mike Epprecht, Microsoft SQL Server MVP
Zurich, Switzerland

IM: mike@.epprecht.net

MVP Program: http://www.microsoft.com/mvp

Blog: http://www.msmvps.com/epprecht/

"Zlatko Mati" <zlatko.matic1@.sb.t-com.hr> wrote in message
news:d1ieos$nno$1@.ls219.htnet.hr...
> I have a problem.
> I should rename some tables which are referenced in numerous stored
> procedures.
> Is there any way to automatically replace old table name with new one in
all
> dependant stored procedures,
> instead of manual replacement in every stored procedure ehich would be
> time-consuming?
> Thank you in advance.|||On Sun, 20 Mar 2005 01:07:22 +0100, "Zlatko Mati" <zlatko.matic1@.sb.t-com.hr>
wrote:

>I have a problem.
>I should rename some tables which are referenced in numerous stored
>procedures.
>Is there any way to automatically replace old table name with new one in all
>dependant stored procedures,
> instead of manual replacement in every stored procedure ehich would be
>time-consuming?
>Thank you in advance.

2 words - Speed Ferret.

http://www.moshannon.com/|||Zlatko Mati wrote:
> I have a problem.
> I should rename some tables which are referenced in numerous stored
> procedures.
> Is there any way to automatically replace old table name with new one
in all
> dependant stored procedures,
> instead of manual replacement in every stored procedure ehich would
be
> time-consuming?
> Thank you in advance.

One word. View.

--
David Rowland
http://dbmonitor.tripod.com|||Hi

Scripting the procedure to a file(s) and globally replacing should make all
the necessary changes. Having your code in a source code control system
would help you identify what needs to be changed.

John

"Zlatko Mati" <zlatko.matic1@.sb.t-com.hr> wrote in message
news:d1ieos$nno$1@.ls219.htnet.hr...
>I have a problem.
> I should rename some tables which are referenced in numerous stored
> procedures.
> Is there any way to automatically replace old table name with new one in
> all dependant stored procedures,
> instead of manual replacement in every stored procedure ehich would be
> time-consuming?
> Thank you in advance.

Monday, February 13, 2012

auto numbering

Hello,

For analyses and reporting I would like to add a 'ranking' to a
table/view.
Example:
Using the 'order by desc' clause in query I get a list of Customers
ordered by Turnover (descending). I would like to add that ranking
numbers (same as recordnumbers) in the query. I would like to have the
following result:
Cust_nr Cust_Name Turnover_2004 Ranking
002234 Bayer 139.000 1
003456 Rentokill 123.456 2
001231 Air France 105.000 3
etc.

When the 'ranking' is part of the query/table I can use this ranking in
an other query.

Important: This questions is not about making an (empty) table structure
for filling in by an application and generating a new unique number each
time a record is added.

I hope you can help me.

Thanks,

Hans

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!On 10 Mar 2005 03:14:43 -0600, Hans de Korte wrote:

>Hello,
>For analyses and reporting I would like to add a 'ranking' to a
>table/view.
>Example:
>Using the 'order by desc' clause in query I get a list of Customers
>ordered by Turnover (descending). I would like to add that ranking
>numbers (same as recordnumbers) in the query. I would like to have the
>following result:
>Cust_nr Cust_Name Turnover_2004 Ranking
>002234 Bayer 139.000 1
>003456 Rentokill 123.456 2
>001231 Air France 105.000 3
>etc.
>When the 'ranking' is part of the query/table I can use this ranking in
>an other query.
(snip)

Hi Hans,

I'd recommend against storing it in the table, as you'll need to update
all rankings each time some data in the table changes. (Of course, if
you have a static database, where data won't change but that you have to
run extensive reports off, things change).

In a live database, I'd define a view to hold the ranking:

CREATE VIEW CustomersRanked
AS
SELECT Cust_nr, Cust_Name, Turnover_2004,
(SELECT COUNT(*)
FROM Customers AS b
WHERE b.Turnover_2004 > a.Turnover_2004) + 1 AS Ranking
FROM Customers AS a
ORDER BY Turnover_2004 DESC
(untested)

Best, Hugo
--

(Remove _NO_ and _SPAM_ to get my e-mail address)|||Thanks, the soluttion is working excellent!!

Regards,

Hans

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!