Forum Replies Created

Viewing 15 posts - 4,126 through 4,140 (of 10,144 total)

  • RE: Query Performance

    ringovski (8/18/2013)


    ChrisM@Work (8/16/2013)


    Stefan_G (8/16/2013)


    thava (8/15/2013)


    ...

    This is a good idea - scan the large tables a single time.

    To improve performance even more you should include a WHERE condition for GNLFSMID as...

  • RE: Delete datetime record

    adonetok (8/16/2013)


    This will delete entire row.

    What I need is to delete data in [ORDERDATE] cell and keep bbb in [NAME] field.

    An UPDATE then.

    update mytable set date = NULL where name...

  • RE: Delete datetime record

    delete from mytable where name = somename and date = somedate.

  • RE: Update table values if corresponding values change in another table

    pwalter83 (8/16/2013)


    ChrisM@Work (7/24/2013)


    pwalter83 (7/24/2013)


    ChrisM@Work (7/24/2013)


    Lowell has already asked but the question remains unanswered: why do you want to hold the same data in two places at once?

    Hi,

    The reason is -...

  • RE: Absent Problem

    I think it should look more like this:

    SELECT

    w.eID, w.name,

    al.[status],

    COALESCE(al.CheckTime, c.[Date]) AS [Date]

    ,CASE WHEN al.CheckTime IS NULL THEN 'A' ELSE 'P' END AS Attendance

    FROM dbo.employee AS w

    CROSS JOIN...

  • RE: Absent Problem

    immaduddinahmed (8/16/2013)


    ...

    actulay this work is above my level thats why i am getting complexity 🙂

    You're doing just fine - you've learned a huge amount in the time you've been posting...

  • RE: Absent Problem

    My mistake, coding before thinking. Try this:

    SELECT *

    FROM Calendar c

    CROSS JOIN employee e

    LEFT JOIN attendlog a

    ON a.eid = e.eid

    AND a.CheckTIme = c.Date

    WHERE c.[Date] >= CAST('20130801' AS DATETIME)

    AND...

  • RE: Absent Problem

    immaduddinahmed (8/15/2013)


    from attendlog a

    left outer join employee e on a.eid = e.eid

    If an employee has no attendance record for the selected time period then they will be excluded...

  • RE: Add Check Constraint in Two Columns

    As Stefan has pointed out, your spec is full of errors and is very difficult to understand. What I suggest you do is to show with examples what you mean...

  • RE: Help Required!!

    I'd use a CROSS APPLY cascade. This article [/url]has at least one example which is very similar to your requirements.

  • RE: Query Performance

    Stefan_G (8/16/2013)


    thava (8/15/2013)


    ...

    This is a good idea - scan the large tables a single time.

    To improve performance even more you should include a WHERE condition for GNLFSMID as well:

    WHERE ...

  • RE: Query Performance

    I'd guess that's way too complicated for the optimiser to deal with and you've got a plan which is far from ideal. Thava has the right idea - you should...

  • RE: Is there a better way to do this? SELECTs within a SELECT

    The performance would be appalling. Consider Luis' approach, or even APPLY():

    SELECT SalesPersonID, FirstName, LastName,

    x.Address1,

    x.Address2,

    x.City,

    ...etc....

    FROM dbo.SalesPersons

    OUTER APPLY (

    SELECT Address1, Address2, City

    FROM dbo.Addresses

    WHERE (LookUpID = 1)

    AND (RecordTypeID = 3)

    )...

  • RE: Help on inserting results into Table

    ;WITH src AS

    (

    SELECT

    database_id, db_buffer_pages = COUNT_BIG(*)

    FROM sys.dm_os_buffer_descriptors

    --WHERE database_id BETWEEN 5 AND 32766

    GROUP BY database_id

    )

    INSERT INTO MyNewTable ([db_name], db_buffer_pages, db_buffer_MB, db_buffer_percent)

    SELECT

    [db_name] = CASE [database_id] WHEN 32767

    THEN 'Resource DB'

    ELSE...

Viewing 15 posts - 4,126 through 4,140 (of 10,144 total)