473,385 Members | 1,838 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

Sql server 2000 performance tunning

1
Hi ,
My belwo script takes long time to run. What can i do about its performance tunning. This scripts read values from table t_emp . It search for that empid
ie comp_guid across the database . ie each table and each of database so find out whether that empid is used for no in the database if its used it insert into temp table . My t_emp is having row 400-900 rows and its long time what can i do to fine tune it .


eclare @objid int, @colid int
declare @stmt nvarchar(2000)
declare @comp_guid int
declare @objid2 int
declare c1 cursor
for select comp_guid from t_emp




--set @guid=30500

if object_id('tempdb..#t') is not null
drop table #t
create table #t(objid int, name sysname, clname sysname, cnt int)

open c1
FETCH NEXT FROM c1 INTO @comp_guid
WHILE (@@FETCH_STATUS = 0)
begin


set @objid=0

while @objid is not null
begin
select @objid=min(id) from sysobjects b
where id > @objid
and xtype <> 'S'
and type='U' and user_name(uid) = 'dbo'

set @colid=0




while @colid is not null
begin


select @colid=min(colid) from syscolumns
where colid > @colid and id=@objid and name like '%_guid'
and xtype in (select xtype from systypes where name in ('bigint','decimal','float','int','money','numeric ','real','smallint','smallmoney','tinyint'))

if (@colid is not null)
begin
select @stmt = 'insert into #t select top 1 ' + convert(nvarchar(500),@Comp_guid) + ' ,''' + object_name(@objid) + ''',''' + col_name(@objid,@colid) + ''' nm , 1 cnt from ' + object_name(@objid) + ' where ' + col_name(@objid,@colid) + '=' + convert(nvarchar(500),@comp_guid )
exec sp_executesql @stmt
end
print @comp_guid
end

end

FETCH NEXT FROM c1 INTO @comp_guid
end


CLOSE c1
DEALLOCATE c1

thanks
Sep 25 '06 #1
0 3739

Sign in to post your reply or Sign up for a free account.

Similar topics

2
by: Ed Wong | last post by:
I am looking for some published paper regarding database performance tunning performance strategies. This is for academic purpose so it needs not to be any commerical database specific. It will...
6
by: Andreas Lauffer | last post by:
I changed from Access97 to AccessXP and I have immense performance problems. Details: - Access XP MDB with Jet 4.0 ( no ADP-Project ) - Linked Tables to SQL-Server 2000 over ODBC I used...
10
by: HB Kim | last post by:
Hello, What could possibly cause data in the SQL server database to be removed, except being deleted manually? We had a couple of situations where data in certain records disappeared although the...
18
by: Robin Lawrie | last post by:
Hi again, another problem! I've moved from an Access database to SQL server and am now having trouble inserting dates and times into seperate fields. I'm using ASP and the code below to get the...
2
by: Marc Melancon | last post by:
Will the next release of SQL Server 2000 64bit sp provide performance counter? MarcM
3
by: datapro01 | last post by:
I am a DB2 DBA that has been asked to become familiar enough with SQL Server in order to become actively involved in its installation, implementation, and to review database backup/recovery...
2
by: Jobs | last post by:
Download the JAVA , .NET and SQL Server interview with answers Download the JAVA , .NET and SQL Server interview sheet and rate yourself. This will help you judge yourself are you really worth of...
6
by: vallish | last post by:
Hi All, I am struggling because of the update performance of db2 . Is it possible to improve update performance using the bufferpool size of tablespace?? I read it in some document but they...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.