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 2008 Forums
 Transact-SQL (2008)
 sql server 2008 db is locking other queries

Author  Topic 

maifs
Yak Posting Veteran

57 Posts

Posted - 2010-07-17 : 05:57:02
HI...

I made a utility with the combination of front-end(PowerBuilder_6.5) and SQL Server 2000 db.

in back-end , there are several procedures which are executed from a main procedures.

i always did query in query analyser or management studio 2005 while utility was being executed.

Example : select * from anyTable with(nolock)
Now
i have migrated the whole utility into latest version of both front-end(PowerBuilder_11.5)
and back-end(SQL Server 2008 db).

now when i try to execute some query during execution of utility then db has been locking. it is being executed.

noquery is effected from it.

maifs
Yak Posting Veteran

57 Posts

Posted - 2010-07-17 : 06:34:27
After successfull deletion, i am updating statistics, re-indexing and after than shrinking the log file and shrinking database.

commands are listed below :

declare @table_nme sysname
declare @db_name varchar(300)
declare @exec_string varchar(300)

EXEC('UPDATE STATISTICS ' + @table_nme)

select @exec_string = 'dbcc dbreindex ([' + @table_nme + '])'

exec(@exec_string)



---- Shrinking log file

DBCC SHRINKFILE (@logfile_name, 5)


-- Shrinking database
DBCC SHRINKDATABASE (@db_name)

Go to Top of Page
   

- Advertisement -