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
 SQL Server Development (2000)
 DML as parameter to stored procedure in SQL Server

Author  Topic 

AskSQLTeam
Ask SQLTeam Question

0 Posts

Posted - 2004-06-30 : 07:15:00
Padmini writes "I have thousands of text files which VB scans to extract information from them and passes the individual values to SQL Server, which, then checks whether a certain id exists or not and inserts it, if not present and updates it if present.
This processing(check, insert / update) is taking around 78-98% of CPU usage.

Please help me to optimise my query. I have used Select, Insert and update statements only and also a cursor to check whether the id exists or not."

mohdowais
Sheikh of Yak Knowledge

1456 Posts

Posted - 2004-06-30 : 07:39:20
You most likely dont need a cursor to check for existance. What's wrong with

...
IF EXISTS (SELECT 1 FROM TableName WHERE id = @ID)
...

If you post some of your code we should be able to help you speed up the query.

OS
Go to Top of Page
   

- Advertisement -