Forum Replies Created

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

  • RE: TempDB Nightmare

    Rewrote that Create View sample code to be a CTE :w00t:

    ;WITH all_task_usage

    AS (

    SELECT session_id,

    SUM(internal_objects_alloc_page_count) AS tsk_intobj_alloc_pgcnt,

    ...

  • RE: TempDB Nightmare

    this might be nice to collect off somewhere...

    SELECT

    cast(SUM(unallocated_extent_page_count) as bigint) as 'Free Unallocated',

    cast(SUM(version_store_reserved_page_count) as bigint) as 'version store resv...

  • RE: Total Server Memory Vs Target Server Memory

    I wouldn't believe anything from just one source. Troubleshooting memory bottlenecks means either you are encountering some performance issues or server problems you have associated by analysis to lack of...

  • RE: Issue with datatypes

    Something like this...

    BEGIN TRY

    INSERT INTO destinationTable

    SELECT cast(substring(Column1,1,12) as nvarchar(12)),

    cast(substring(Column2,1,10) as nvarchar(10)),

    cast(Column3 as int),

    cast(Column4...

  • RE: Issue with datatypes

    ETL = 3 steps.

    1. Export to the target server. For this I would create your own copy of the source servers table structure and move records from source to...

  • RE: Index issue

    Scan your databases code for a reference to the table or the alter command

    SELECT sm.object_id, OBJECT_NAME(sm.object_id) AS object_name, o.type, o.type_desc, sm.definition

    FROM sys.sql_modules AS sm

    JOIN sys.objects AS o ON sm.object_id =...

  • RE: long running sp

    SQL server only resorts to doing parallel plan processing for an Update statement when there is a WHERE clause. I thought your orignial query did not even use a where...

  • RE: master.dbo.spt_values means?????????

    SELECT TOP 25 A.name,(SELECT rows FROM dbo.sysindexes s WITH (NOLOCK)

    WHERE s.indid < 2 AND s.id = A.ID )AS [Row count],SpaceUsedMB from

    (SELECTSO.NAME,SO.ID,

    CONVERT(numeric(15,2),(((CONVERT(numeric(15,2),SUM(i.reserved)) * (SELECT low

    FROM master.dbo.spt_values WITH...

  • RE: Things to know for better growth in sql server environment.

    In today's corporate environment you have to manage your own DBA career. Now I am not knowledgable about your current role and company but I have mentored, managed and...

  • RE: sys.dm_io_virtual_file_stats - doesn't looks like it is cummulative

    SELECT

    DB_NAME(database_id) as [dbname],

    CASE file_id

    WHEN 1 THEN 'Data'

    WHEN 2 THEN 'Log'

    ELSE 'DATA'

    END as [File_type] ,

    num_of_reads as [Reads],

    num_of_bytes_read/1024/1024 as...

  • RE: Need help with creating StoreProc

    create table Zips (Zip int, City [varchar](36) null, StateCode [varchar](2) NULL, County [varchar](36) null)

    insert into Zips values (75056, 'Dallas', 'TX', 'Dallas');

    insert into Zips values (75057, 'Irving', 'TX', 'Dallas');

    insert into Zips...

  • RE: Spliting Huge data file (mdf) into multiple mdf's in different drives.

    just 2cents...

    I'd investigate if the VM Hosts have local drives. Because if so, then you can definately speed up backup time by backing up to the Host's drives that a...

  • RE: Query to find Top 10 Adhoc Queries in SQL Server

    --

    SELECT usecounts, cacheobjtype, objtype, size_in_bytes/1024 as 'Size(KB)', TEXT

    FROM sys.dm_exec_cached_plans

    CROSS APPLY sys.dm_exec_sql_text(plan_handle)

    WHERE usecounts = 1 and objtype = 'Adhoc'

    ORDER BY size_in_bytes/1024 DESC;

    --

    SELECT q.[text],

    (highest_cpu_queries.total_worker_time/highest_cpu_queries.execution_count) / 1000000.0 AS AverageCPU,

    highest_cpu_queries.execution_count as distinctCalls,...

  • RE: Query - MOST COSTLY UNUSED INDEXES

    ;WITH IndexSpaceUsed

    as (

    SELECT OBJECT_NAME(object_id) as ObjName

    ,SUM(reserved_page_count) as ResPgCnt

    ,SUM(used_page_count) as UsedPgCnt

    ,SUM(CASE

    WHEN (index_id < 2) THEN (in_row_data_page_count + lob_used_page_count + row_overflow_used_page_count)

    ELSE lob_used_page_count + row_overflow_used_page_count

    END) as Pages

    ,SUM(CASE

    WHEN (index_id...

  • RE: Query - MOST COSTLY UNUSED INDEXES

    SELECT OBJECT_SCHEMA_NAME(I.OBJECT_ID) AS SchemaName,

    OBJECT_NAME(I.OBJECT_ID) AS ObjectName,

    I.NAME AS IndexName, I.type_desc as IdxType, ips.record_count,

    (ips.record_count * ips.avg_record_size_in_bytes)/1024/1024 as 'Size(MB)'

    FROM sys.indexes I

    INNER JOIN sys.dm_db_index_physical_stats ( DB_ID(), NULL, NULL, NULL, 'DETAILED')...

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