Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is the number in brackets on the tab label of a sql script in VS2010?

After connecting to the database with a sql source file, the tab shows the filename in the tab along with my windows user id and a number in brackets. Different script files have different values in the brackets.

What are these numbers representing?

like image 613
Bill Avatar asked Mar 15 '11 23:03

Bill


People also ask

What do the brackets mean in SQL?

The brackets are required if you use keywords, spaces, hyphens or special chars in the column names or identifiers. Using square brackets in SQL Statements allow the names to be parsed correctly.

What do curly brackets mean in SQL?

In SQL syntax notation, curly brackets enclose two or more required alternative choices, separated by vertical bars. [ ] In SQL syntax notation, square brackets indicate an optional element or clause. Multiple elements or clauses are separated by vertical bars.

Why we use square bracket in SQL?

Those brackets are included so that SQL Server can correctly interpret queries that reference table or column names that include spaces or special characters. None of the tables or columns in this database actually include spaces, but the automatically generated scripts include the square brackets anyway.

How do you find closing brackets in SQL?

With SSMSBoost jump between bracket pairs is performed with hotkeys: CTRL+SHIFT+UP is used to move the cursor leftwards to the opening bracket and CTRL+SHIFT+DOWN moves the cursor rightwards to the closing bracket.


2 Answers

Its the SPID (basically session ID) from your session in SQL server.

If you run the sp_who2 stored proc you can see more information.

It helps with working out tracing and killing any scripts you have that are causing problems.

like image 104
Jon Egerton Avatar answered Sep 25 '22 00:09

Jon Egerton


That is the SPID, which nowadays uniquely identifies your user session on the server.

If you fired up SQL profiler you could filter operations by that number.

Note that you see that same number in SQL Management Studio at the top of query windows with active connections, and also down in the lower-right corner of your VS IDE.

SPID used to stand for Server Process ID, but now it's User Session ID.

like image 34
shannon Avatar answered Sep 24 '22 00:09

shannon