Home Forums SQL Server 2005 T-SQL (SS2K5) Select statment problem in cursor using datetimes RE: Select statment problem in cursor using datetimes

  • Per your post below, what is the advantage doing the inner joins versus the code I wrote? I have been only doing T-SQL for a short time and appreciate any tips. Can you explain the differences and pros/cons between the 2 coding methods shown below?

    2) question in general

    You should change your syntax when joining tables.

    Instead of

    FROM dbo.NOTE_tblNote n, dbo.ICOMP_tblEmployee i, XCOMP_tblCompany x, CON_tblContact c

    WHERE

    n.employeeid = i.employeeid

    and n.companyid = x.companyid

    and n.contactid = c.contactid

    I'd recommend

    FROM dbo.NOTE_tblNote n

    INNER JOIN dbo.ICOMP_tblEmployee i ON n.employeeid = i.employeeid

    INNER JOIN XCOMP_tblCompany x ON n.companyid = x.companyid

    INNER JOIN CON_tblContact c ON n.contactid = c.contactid