Click here to monitor SSC
SQLServerCentral is supported by Red Gate Software Ltd.
 
Log in  ::  Register  ::  Not logged in
 
 
 
        
Home       Members    Calendar    Who's On


Add to briefcase

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

SSC RookieSSC RookieSSC RookieSSC RookieSSC RookieSSC RookieSSC RookieSSC Rookie

Group: General Forum Members
Last Login: Monday, June 23, 2014 9:39 PM
Points: 44, Visits: 505
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 (9 views, 54.85 KB)
RG-2.png (8 views, 31.92 KB)
RG-1.png (8 views, 39.06 KB)
Post #1582801
Posted Thursday, June 19, 2014 3:16 PM
Mr or Mrs. 500

Mr or Mrs. 500Mr or Mrs. 500Mr or Mrs. 500Mr or Mrs. 500Mr or Mrs. 500Mr or Mrs. 500Mr or Mrs. 500Mr or Mrs. 500

Group: General Forum Members
Last Login: Yesterday @ 3:11 PM
Points: 577, Visits: 6,299
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.


----------------------------------
My journal of things I'm learning about SQL
Post #1584061
« Prev Topic | Next Topic »

Add to briefcase

Permissions Expand / Collapse