Forum Replies Created

Viewing 15 posts - 2,941 through 2,955 (of 10,144 total)

  • RE: Left Ordering of Index Keys to Utilize the Index

    er.mayankshukla (9/9/2014)


    Hi Experts,

    Till date I know that the ordering of Index key matters in a query so that we can utilize that Index.

    Let me show you with example

    Use AdventureWorks2008

    sp_helpindex 'Person.Person'

    index_nameindex_descriptionindex_keys

    IX_Person_LastName_FirstName_MiddleNamenonclustered...

  • RE: Selecting all data from employee where forign key = null

    --suppose i need to show all data from Employee table (NationalityName,BranchName,JobName) where

    --NationalityID =NULL OR BranchID=NULL OR JobID=NULL

    --WHAT I DO

    -- Use outer joins on those columns, like this:

    SELECT

    n.NationalityName, e.DriverName, e.DriverID,...

  • RE: Selecting all data from employee where forign key = null

    Here's your original query reformatted and using table aliases:

    SELECT

    n.NationalityName, e.DriverName, e.DriverID, e.NationalityID, e.ResidentNo, c.CountryName,

    e.CountryID, b.BranchName, e.BranchID, e.JoinDate, e.ResignDate, e.HealthCarNo, e.JobID,

    j.JobName, d.DepartmentName, j.DepartmentID, e.PlaceIssue, e.Deduction, e.ExpireDateMedical,

    e.PolicyNumber, e.[Owner],...

  • RE: Selecting all data from employee where forign key = null

    SELECT NationalityName, BranchName, JobName

    FROM Employee

    WHERE NationalityID IS NULL OR BranchID IS NULL OR JobID IS NULL

  • RE: SQL import data when both source and destination has data and identity column

    IT researcher (9/8/2014)


    I am using Import and export data option to import data from one database to another database. Both database have similar structure of tables. All the tables...

  • RE: Not Cast?

    DECLARE @Code VARCHAR(4)

    DROP TABLE #SampleData

    SELECT Code = CAST('20' AS VARCHAR(4)) INTO #SampleData UNION ALL

    SELECT '0020' UNION ALL

    SELECT '786' UNION ALL

    SELECT '0786'

    SET @Code = '20'

    SELECT *

    FROM #SampleData

    WHERE...

  • RE: Today's Random Word!

    Ed Wagner (9/8/2014)


    crookj (9/8/2014)


    Ed Wagner (9/7/2014)


    TomThomson (9/5/2014)


    Ed Wagner (9/5/2014)


    Sean Lange (9/5/2014)


    Capsize

    Expensive

    Dear

    Yes, Dear

    Honey-Do

    Perpetual

    Peripatus

  • RE: cost of clustered index insert is 100%

    charipg (9/8/2014)


    actually it inserting simple single record.

    we estimated time should be milli seconds, but its taking 2min.

    need to find what might be causing this. not getting any clue.

    The...

  • RE: Data from one Table to Two Columns

    SELECT *

    FROM D_DRIVER_LOGGED_HISTORY i

    OUTER APPLY (

    SELECT TOP 1 LOGGED_DATETIME

    FROM D_DRIVER_LOGGED_HISTORY o

    WHERE o.DRIVER_ID = i.DRIVER_ID

    AND o.IS_LOGGED_IN = 0

    AND o.LOGGED_DATETIME > i.LOGGED_DATETIME

    ORDER BY LOGGED_DATETIME

    ) oa

    WHERE i.IS_LOGGED_IN = 1

  • RE: Data from one Table to Two Columns

    patelmohamad (9/5/2014)


    Hi Koen Verbeeck,

    I have tried it but no luck, I have 81 Records for that particular driver but it is multiplying the records and the output value is 6561...

  • RE: Adding a number to a string to create series

    Eirikur Eiriksson (9/5/2014)


    ChrisM@Work (9/5/2014)


    Meatloaf (9/3/2014)


    Hello,

    I trying to figure out the logic to add a number to the end of an ID to create a series.

    For example, I have an EventID...

  • RE: Adding a number to a string to create series

    Meatloaf (9/3/2014)


    Hello,

    I trying to figure out the logic to add a number to the end of an ID to create a series.

    For example, I have an EventID that may have...

  • RE: View results not displaying nil columns

    Try this:

    SELECT

    c.cltSortName AS ClientName,

    a4.ainTVal AS ClientPartner,

    a422.ainDVal AS [Date Added],

    ai.ainTVal AS Inudstry

    FROM dbo.cdbClient c

    LEFT OUTER JOIN dbo.cdbObject o

    ON c.cltCategoryID = o.objID

    LEFT OUTER JOIN dbo.vcltAttrib4 a4...

  • RE: Help with the query

    Not really sure what you are trying to do here - but this is a simple way to assign numbers to the Cycles in your data set:

    ;WITH CycleEnds AS (

    SELECT...

  • RE: Trying to explain LEFT OUTER JOIN

    -- Simplify the query and examine the unaggregated result of the INNER JOIN

    SELECT

    a.[status], a.batch,

    b.[status], b.batch

    FROM AP4_packing_leg1_HSM_status a

    INNER JOIN AP4_packing_leg1_HSM_Faults b

    ON a.[status] = b.[status]

    AND a.batch = 105

    --group by...

Viewing 15 posts - 2,941 through 2,955 (of 10,144 total)