Reputation: 47
When we execute an "Alter" query in SQL Server, we get "command executed successfully" message.
So my question is, what makes SQL Server show that message after execution of the query?
As far as in know, that query may return some value, depending on that value, SQL Server decides which message to show. So, what is that value that gets returned based on which SQL Server shows that successful message?
Upvotes: 1
Views: 3255
Reputation: 1
SELECT customerstable = CustomerId, FirstName, LastName, Company, Address, City, State, Country, PostalCode, Phone, Fax, Email, SupportRepId.
FROM: customers Germany;
RETURN LastName, Country columns
Upvotes: 0
Reputation: 28900
This is handled at TDS
layer,depending on statements ,Client may return one of the token values..
This link contains all TOKENS
For Example..
Token Stream Name:DONE
Indicates the completion status of a SQL statement.
This token is used to indicate the completion of a SQL statement. As multiple SQL statements can be sent to the server in a single SQL batch, multiple DONE tokens can be generated. In this case, all but the final DONE token will have a Status value with DONE_MORE bit set .
Also check this link on to know how SQLServer executes a query.
Upvotes: 1
Reputation: 171178
The messages tab shows what SqlConnection.InfoMessage
returns. This is a TDS protocol feature. SQL Server cannot just return result sets, it also can return messages and errors.
SSMS did not decide what to show. It just outputs whatever SQL Server sends to it.
Upvotes: 1