June 18, 2014 at 4:41 am
I'm using SQL Server 2005 Service Pack 3. My monitoring tools was SQL Monitor from Red Gate. One of my Long-Running query as following
(@_no_akaun nvarchar(4000))Select * from MSTUMASTER where studentn=@_no_akaun
Why the Select Statement looks weird?? It's a correct syntax? Really have no idea. Please help
Please see the attachment
June 19, 2014 at 3:17 pm
That sort of syntax is denoting that a parameterized stored procedure plan was used to run the query; the (@_no_akaun nvarchar(4000)) bit indicates that the procedure was called with a value passed in for the @_no_akaun parameter, which is later called in the WHERE clause of the query.
Granted, if you try to run the query as-is, it definitely won't run :-). It's just a bit of the internal notation you're seeing, but, in most cases, it's good to see it, as you're getting good parameterization on your query.
At the same time, it can also indicate a problem point, as bad parameter sniffing could be interfering with the execution time of the query.
It's difficult to provide more information than that presently, though; if the notation was the only point of confusion, great! If more detail is desired, though, please provide some sample data, DDL, and an execution plan, and further investigation can be done.
- 😀
Viewing 2 posts - 1 through 1 (of 1 total)
You must be logged in to reply to this topic. Login to reply