Click here to monitor SSC
SQLServerCentral is supported by Redgate
Log in  ::  Register  ::  Not logged in
Home       Members    Calendar    Who's On

Add to briefcase

Long-running query Expand / Collapse
Posted Wednesday, June 18, 2014 4:41 AM


Group: General Forum Members
Last Login: Monday, October 10, 2016 6:35 PM
Points: 104, Visits: 723
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

  Post Attachments 
RG-3.png (12 views, 54.85 KB)
RG-2.png (9 views, 31.92 KB)
RG-1.png (9 views, 39.06 KB)
Post #1582801
Posted Thursday, June 19, 2014 3:16 PM
SSChasing Mays

SSChasing MaysSSChasing MaysSSChasing MaysSSChasing MaysSSChasing MaysSSChasing MaysSSChasing MaysSSChasing Mays

Group: General Forum Members
Last Login: Tuesday, November 1, 2016 2:32 PM
Points: 606, Visits: 8,135
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.

Post #1584061
« Prev Topic | Next Topic »

Add to briefcase

Permissions Expand / Collapse