Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 Transact-SQL (2000)
 update

Author  Topic 

arkiboys
Master Smack Fu Yak Hacker

1433 Posts

Posted - 2007-08-13 : 11:43:37
Hi,
I have created a stored procedure which contains the following lines.
As you see, they all refer to one table tblCEMStaticAll2
Is it possible to reduce the number of updates here?
i.e. have a fewer update(s) which does the same thing?

Thanks

update tblCEMStaticAll2
set AdaptiveLegalEntityCode = LTRIM(RTRIM(AdaptiveLegalEntityCode))

update tblCEMStaticAll2
set Min_Transfer_Amount = null
where ISNUMERIC(Min_Transfer_Amount) = 0

update tblCEMStaticAll2
set DocN_Threshold_Amount = null
where ISNUMERIC(DocN_Threshold_Amount) = 0

update tblCEMStaticAll2
set rating_fitch_rating_date = null
where isdate(rating_fitch_rating_date) = 0

update tblCEMStaticAll2
set [Rating_S&P_Rating_Date] = null
where isdate([Rating_S&P_Rating_Date]) = 0

update tblCEMStaticAll2
set Rating_Moodys_Rating_Date = null
where isdate(Rating_Moodys_Rating_Date) = 0

update tblCEMStaticAll2
set Rating_Fitch_Rating_Date = null
where isdate(Rating_Fitch_Rating_Date) = 0

ashley.sql
Constraint Violating Yak Guru

299 Posts

Posted - 2007-08-13 : 11:59:47
how long does the stored procedure takes to run.

this procedure will scan the complete table when it runs. even the previous rows which have been updated in the last run.

you can put in somecondition based on some date or timestamp
and create an index on that column as well. this will reduce the time for the update. but as far as reducing the updates i am not sure how that would be possible.

Ashley Rhodes
Go to Top of Page
   

- Advertisement -