Go Premium for a chance to win a PS4. Enter to Win

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 516
  • 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

Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone 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