Forum Replies Created

Viewing 15 posts - 46 through 60 (of 367 total)

  • RE: XML Data Type as a parameter in a Stored Procedure

    Before executing procedure, what is len(@agItem)? Maybe it is truncated before the procedure.

  • RE: problem in select command

    More than that! It not only didn't work, it also managed to offend innocent fellow :crying:

    Did you noticed a smiley next to the message? But I don't know who would...

  • RE: problem in select command

    Moderator, please close this thread as nonconstructive.

    I tried with mad goat method, but it turns out it did not work 🙂

  • RE: problem in select command

    First one who writes after this post will be raped by a mad goat! :w00t:

    😀

  • RE: Custom sp_who

    Here is a complete and tested example with signed procedure:

    -- Script by Vedran Kesegic, 20.3.2013.

    -- We will create a database and a procedure which calls sp_who2.

    -- We will also create...

  • RE: Custom sp_who

    Alternative would be to grant "VIEW DATABASE STATE" to the user (or better, db role) in each database you want that login to view the sessions.

    After that, you do not...

  • RE: Custom sp_who

    With "with execute as ..." clause on a procedure/function/trigger you define a database user to execute under, not a server login.

    Database user cannot have a server-level privilege such as viewing...

  • RE: Best Approach to Archieve DB

    Grant Fritchey (3/18/2013)


    If you can make changes to your architecture, you might want to look into partitioning the data.

    You can't switch partition to a switching table that is in...

  • RE: problem in select command

    Cte in some situations with really long DT can help readability, but this is not the case here. Some folks (ab)use cte in every statement because they don't know how...

  • RE: problem in select command

    You could also do it without cte. Why employ complex technique when you can use simple one? Cte is really great for recursion and multiple use of the same subquery,...

  • RE: Where is my execution plan?

    Please check is your query in the cache at all with this query:

    -- Is my query/procedure in the cache ?

    select * FROM sys.syscacheobjects

    WHERE dbid<>32767 and dbid>4

    and sql NOT...

  • RE: Where is my execution plan?

    Try with dm_exec_cached_plans:

    SELECT

    DatabaseName = db_name(st.dbid),

    cp.objtype,

    st.text,

    qp.query_plan,

    cp.usecounts,

    cp.size_in_bytes,

    cp.plan_handle

    FROM sys.dm_exec_cached_plans cp

    CROSS APPLY sys.dm_exec_sql_text (cp.plan_handle) st

    CROSS APPLY sys.dm_exec_query_plan (cp.plan_handle) qp

    WHERE st.text NOT LIKE '%sys.%'

    --AND st.dbid = DB_ID() -- current db

    AND st.text LIKE '%YourTableOrProcedureName%'

    ORDER BY st.text

  • RE: DB restored from customer -> Database diagram vanishes

    Only owner who created db diagrams can see his own diagrams, and db_owner/sysadmin can see all diagrams (created by any user) in the db.

    Log on as sysadmin and query dbo.sysdiagrams...

  • RE: How to view stats used in query?

    If non-clustered index key columns are a, b, c, and table has clustered index key "id", one multi-column statistics will be created with the same name as index.

    It will create...

  • RE: How to view stats used in query?

    1) How if at all, can you view which stats are touched during query execution?

    Statistics are not used during execution. They are used in plan generation phase which happens just...

Viewing 15 posts - 46 through 60 (of 367 total)