what the true nature of @ in Transct-SQL
- by Richard77
Hello,
I reading some old ScottGu's blogs on Linq2SQL. Now I'm doing the SPROC part. I'd like to know what's the exact meaning of @variable.
See this from ScottGu's Blog
ALTER PROCEDURE dbo.GetCustomersDetails
(
@customerID nchar(5),
@companyName nvarchar(40) output
)
AS
SELECT @companyName = CompanyName FROM Customers
WHERE CustomerID = @customerID
SELECT *
FROM Orders
WHERE CustomerID = @customerID
ORDER BY OrderID
I'm kind of lost as, so far, I've though of anything preceded by a '@' as a placeholder for user input. But, in the example above, it looks like '@companyName' is used as a regular variable like in C# for instance (SELECT @companyName = ...). But, @companyName is not known yet.
So, what the true nature a something preceded by a '@' like above? a vriable? a simple placeholder to accommodate user entered value?
Thanks for helping