Improve company productivity with a Business Account.Sign Up

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 518
  • Last Modified:

How to check SQL Query Status

Hi,
can someone please help with a problem i've just encountered. I have a classic asp page which runs a query and then creates an excel file using outlook web components. The problem is the query is still running when the open file dialog box appears so the file created is incomplete. Does anybody know how to check the status of the sql query or how to issue a wait command?

thanks in advance
0
cmsRuncorn
Asked:
cmsRuncorn
  • 3
1 Solution
 
Christian de BellefeuilleProgrammerCommented:
Check this link

(if you are using an MSSQL server)
0
 
cmsRuncornAuthor Commented:
That's very helpful, thanks. But 1 question, how do i find out the current spid of the query so that i may check if the query is still running?
0
 
Christian de BellefeuilleProgrammerCommented:
You can find it this way...  

SELECT @@SPID AS 'ID', SYSTEM_USER AS 'Login Name', USER AS 'User Name'
WHERE [Login Name] = 'YOUR LOGIN NAME HERE'

0
 
Christian de BellefeuilleProgrammerCommented:
Sorry....  pick this one instead.

SELECT @@SPID AS 'ID', SYSTEM_USER AS LoginName, USER AS 'User Name'
WHERE SYSTEM_USER = 'YOUR LOGIN NAME HERE'
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

  • 3
Tackle projects and never again get stuck behind a technical roadblock.
Join Now