---
title: "What is the use of @@SPID?"  
description: "What is the use of @@SPID?"  
author: "MindStick Software Pvt Ltd"  
published: 2019-09-19  
updated: 2020-09-17  
canonical: https://www.mindstick.com/interview/33627/what-is-the-use-of-spid  
category: "c#"  
tags: ["sql server"]  
reading_time: 1 minute  

---

# What is the use of @@SPID?

@@SPID

- The @@SPID returns the session ID of the current user process.
- The SQL @@SPID is one of the Configuration Function, which will return the session ID that is currently being used. Syntax behind this is -

```
@@SPID
```

Example

```
SELECT @@SPID AS 'SP ID',
       SYSTEM_USER AS 'Login Name',
       USER AS 'User Name';
```

## Answers

### Answer by MindStick Software Pvt Ltd

@@SPID

- The @@SPID returns the session ID of the current user process.
- The SQL @@SPID is one of the Configuration Function, which will return the session ID that is currently being used. Syntax behind this is -

```
@@SPID
```

Example

```
SELECT @@SPID AS 'SP ID',
       SYSTEM_USER AS 'Login Name',
       USER AS 'User Name';
```


---

Original Source: https://www.mindstick.com/interview/33627/what-is-the-use-of-spid

Copyright © MindStick Software Pvt. Ltd. This Markdown version is provided for developers, AI systems, and offline reading.
