Forum Replies Created

Viewing 15 posts - 1 through 15 (of 17 total)

  • RE: Which of these indexes should be deleted?

    if the data of underlying table changed and when we update statistics then plan should use that index.

    Am I right?

  • RE: Which of these indexes should be deleted?

    indexes which are never used by any plan and Gail is right that by last restart of server.

  • RE: Which of these indexes should be deleted?

    DECLARE @dbid INT

    SELECT @dbid = DB_ID(DB_NAME())

    SELECT OBJECTNAME = OBJECT_NAME(I.OBJECT_ID),

    INDEXNAME = I.NAME,

    I.INDEX_ID

    FROM SYS.INDEXES I

    JOIN SYS.OBJECTS O

    ON I.OBJECT_ID = O.OBJECT_ID

    WHERE OBJECTPROPERTY(O.OBJECT_ID,'IsUserTable') = 1

    AND I.INDEX_ID NOT IN (

    SELECT S.INDEX_ID

    FROM SYS.DM_DB_INDEX_USAGE_STATS S

    WHERE S.OBJECT_ID =...

  • RE: Does log shrink would affect any process happenning

    WE CAN SHRINK LOG FILE IN SIMPLE RECOVERY MODEL WHEN THERE IS NO NEED OF IN TIME RECOVERY.

    IF THAT IS TEST SERVER THEN OK.

    IF PRODUCTION THEN THIS PRACTICE IS...

  • RE: Concetenate and sum

    SELECT

    Main.OrderID,

    Main.SalesRegion,

    Main.OrderType,

    Main.Projectid,

    Main.ProductID,

    Main.FormatID,

    Main.MEdiaTypeID,

    LEFT(Main.COMMENTS, LEN(Main.COMMENTS) - 1) AS 'ProductComment',

    MAIN.UOM,

    MAIN.FormatName,

    MAIN.Media INTO #A

    FROM...

  • RE: Retain leading zero's while exporting SSRS report to excel

    a simple solution to your problem.

    just convert that field to varchar in your query like this

    select convert(varchar,colname) from table.

    when report will be exported to excel leading 0s will not...

  • RE: Moving SQL Server DB's

    you mentioned that 3 of databases are part of replication. then there may be a publisher and distributer.

    when you move these databases then you need to generate new publications and...

  • RE: how to schedule a sql job to run at different intervals

    you can schedule a job to run each hour.

    go on schedules and create new schedule.

    schedule type should be recurring.

    in frequency bar under occurs tab select daily.

    in daily frequency select occurs...

  • RE: Selection using date held as a string

    issue is with varchar value 'z' in data ('2013-10-29 22:59:00Z) and you are converting it to datetime or datetime2.

    you can convert it after removing that value from data.

    use this.

    SELECT TOP...

  • RE: Selection using date held as a string

    use this.

    SELECT TOP 10 key_value

    ,convert(datetime2,BPK.key_value) as DT2

    ,convert(datetime,CONVERT(DATETIME2, PV.key_value)) AS DT

    FROM parameter_value PV

    WHERE PV.datatype = 'D'

    and convert(datetime2,replace(PV.key_value,right(PV.key_value,4),'')) BETWEEN GETDATE() and DATEADD(d, 10, GETDATE())

  • RE: How to select data in a particular format

    SELECT DISTINCT V.CERTYEAR,

    (SELECT SUM(QUATITY) FROM VCERTS WHERE CERTYEAR=V.CERTYEAR AND CERTCODE='HI-MASTER')QTYMASTER,

    (SELECT SUM(QUATITY) FROM VCERTS WHERE CERTYEAR=V.CERTYEAR AND CERTCODE='HI-INSTR')QTYINSTR,

    (SELECT SUM(QUATITY) FROM VCERTS WHERE CERTYEAR=V.CERTYEAR AND CERTCODE='HI-TRAIN')QTYTRAIN

    FROM DBO.VCERTS V

    ORDER BY 1

  • RE: SELECT FROM Multiple tables with names in a table

    select 'select mfg from'+convert(varchar,ApplianceTypeTableName)+'

    union'

    from

    ApplianceTypes

    check you query editor to result to text

    and execute above.

    copy result in another query editor window and execute.

  • RE: Return 1 record with data from multiple tables

    one easy solution, using xml path.

    SELECT P.PRODUCTID,P.PRODUCTNAME,C.CategoryID,C.CATEGORYNAME,

    STUFF((SELECT ',' + convert(varchar,PP.ProductQuantity)

    FROM ProductPricing PP

    WHERE PP.PRODUCTID=P.PRODUCTID

    FOR XML PATH('')),1,1,'') AS ProductQuantity,

    STUFF((SELECT ',' + convert(varchar,PP.ProductCost)

    FROM ProductPricing PP

    WHERE PP.PRODUCTID=P.PRODUCTID

    FOR XML PATH('')),1,1,'') AS ProductCost

    FROM ...

  • RE: How do i line up the weeks in T-SQL ?

    use bar brackets for column name for 'week-2013' it will be [week-2013]

    that is what I understand,

    😀

  • RE: Update Help..

    SELECT obj.Name SPName, sc.TEXT SPText

    FROM sys.syscomments sc

    INNER JOIN sys.objects obj ON sc.Id = obj.OBJECT_ID

    WHERE sc.TEXT LIKE '%' + 'Name Your Column Here' + '%'

    AND TYPE = 'P'

Viewing 15 posts - 1 through 15 (of 17 total)