please help, script not working getting msg 245

  • BMC_CORE_BMC_BaseElement.Name, BMC_CORE_BMC_BaseElement.instanceid,

    BMC_CORE_BMC_BaseElement.reconciliationidentity

    FROM ARSystem.dbo.BMC_CORE_BMC_BaseElement BMC_CORE_BMC_BaseElement (NOLOCK)

    WHERE BMC_CORE_BMC_BaseElement.DatasetId='BMC.ASSET' AND

    BMC_CORE_BMC_BaseElement.createdate>='2014-01-01' AND

    BMC_CORE_BMC_BaseElement.createdate<='2014-12-31' AND (

    BMC_CORE_BMC_BaseElement.submitter='syl'OR

    BMC_CORE_BMC_BaseElement.submitter='salv'OR

    BMC_CORE_BMC_BaseElement.submitter='aj') order by 1

  • sandy.alvarez (4/17/2015)


    BMC_CORE_BMC_BaseElement.Name, BMC_CORE_BMC_BaseElement.instanceid,

    BMC_CORE_BMC_BaseElement.reconciliationidentity

    FROM ARSystem.dbo.BMC_CORE_BMC_BaseElement BMC_CORE_BMC_BaseElement (NOLOCK)

    WHERE BMC_CORE_BMC_BaseElement.DatasetId='BMC.ASSET' AND

    BMC_CORE_BMC_BaseElement.createdate>='2014-01-01' AND

    BMC_CORE_BMC_BaseElement.createdate<='2014-12-31' AND (

    BMC_CORE_BMC_BaseElement.submitter='syl'OR

    BMC_CORE_BMC_BaseElement.submitter='salv'OR

    BMC_CORE_BMC_BaseElement.submitter='aj') order by 1

    You're missing a SELECT statement. Using NOLOCK removes the guarantee that your query will return the correct data. ORDER BY <Column Number> is not a good practice, it is better to refer to column names.

    "I cant stress enough the importance of switching from a sequential files mindset to set-based thinking. After you make the switch, you can spend your time tuning and optimizing your queries instead of maintaining lengthy, poor-performing code."

    -- Itzik Ben-Gan 2001

  • Further on Alan's reply, this is an incomplete query, first guess would be that it's from a BMC Dashboard, try to capture the whole query.

    😎

Viewing 3 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic. Login to reply