Forum Replies Created

Viewing 15 posts - 16 through 30 (of 51 total)

  • RE: how to update records

    Hey MD,

    Check out if the SQL below gives the results you are looking for:

    SELECT

     code = r.code, 

     code_updated = SUBSTRING(r.code, 1, 2) + '0' + SUBSTRING(r.code, 3,...

  • RE: help with an inner join of parent child

    Hey There Leslie,

    Check out if this SQL is what you are looking for:

    SELECT

      *

    FROM

      WorkedHours w INNER JOIN

        Employees e LEFT OUTER JOIN

          Dependants d ON...

  • RE: Please Help with view

    Hey,

    Are you able to do a SELECT on the view such as:

    SELECT * FROM myview

    Just taking a guess here:

    I'm thinking that maybe mytable in database2 might contain...

  • RE: XPSMTP to send out a list of outstanding actions

    Hey StephanJ

    Some approaches that I could think of are:

    [Approach 1 : Go SQL Server all the way]

    1) Create a stored procedure to identify user e-mails with...

  • RE: To DTS or NOT DTS when update sql from access?

    Hey Juanita,

    I corrected the UPDATE statement in the code in my previous post.  I noticed that I originally posted the UPDATE like this:

      UPDATE SQL_Table a

        SET <pairs of "sql...

  • RE: To DTS or NOT DTS when update sql from access?

    Hey There Juanita,

    The approach you mention about loading the Access data into an auxilary SQL table and then working off that table seems like a reasonable approach.  I...

  • RE: remove duplicate rows from result set

    Hey barcoder,

    Check out this SQL to see if this is what you are looking for or helps you get there:

    SELECT

      P.Productcode,

      PlantName = MIN(F.PlantName)

    FROM

     ...

  • RE: Returning too many rows....

    hey egnagey,

    try adding the following HAVING clause to your SQL to see if that is what you are looking for:

    SELECT

      tblroofs.roofid, cap.estimatedcost as CapCost, cap.estimateddate

    FROM

     ...

  • RE: Problem with between

    Yeah, I've seen this too for the case posted ...

    It seems as if though SQL Server is expecting the start_value and end_value of BETWEEN to be the same...

  • RE: Executing SQL Command???

    Hey jmarg,

    You would have to resort to dynamic SQL to be able to concatenate @filterCMD.

    From looking at the code posted, you could do this:

    IF @filterCriteria LIKE 'w'

     ...

  • RE: Search for dates in the same week one year ago

    Hey Jordan,

    SQL for this might be something like this:

    SELECT

      *

    FROM

      Some_Dates_Table

    WHERE 

      DATEDIFF(year, someDate, GETDATE() ) = 1 AND 

      DATEPART(week, someDate) =...

  • RE: pass table variable to stored procedure

    hey joe,

    you would have to resort to dynamic SQL to be able to do this.

    so your proc would look something like this:

    CREATE PROCEDURE dbo.usp_product

    (

     

  • RE: Common temp tables in procedures

    Hey Sahana,

    According to the T-SQL online reference in MSDN, it is recommended that table variables be used instead of temp tables whenever possible. 

    See

  • RE: Convert table into a crosstab table in SQL Server

    try this one then:

    INSERT INTO Destination_Table(item, source1, source2, source3, source4)

    SELECT

      DISTINCT s.item,

      source1 = MIN(s.source1),

      source2 = MAX(s.source2),

      source3 = MAX(s.source3),

      source4 = MAX(s.source4)

    FROM

    (

      SELECT

        s1.item,

       ...

  • RE: Convert table into a crosstab table in SQL Server

    hey,

    try to see if this is what you are looking for:

    INSERT INTO Destination_Table(item, source1, source2, source3, source4)

    SELECT

      s1.item,

      source1 = MAX(s1.source),

      source2 = MAX(CASE WHEN s2.source <>...

Viewing 15 posts - 16 through 30 (of 51 total)