Forum Replies Created

Viewing 15 posts - 1,891 through 1,905 (of 3,544 total)

  • RE: How do I use a checksum

    There is still a chance that you can get the same checksum value even if the dates were different, although a small chance. If it occurs then you have duplicates...

    Far away is close at hand in the images of elsewhere.
    Anon.

  • RE: How do I use a checksum

    The problem with using CHECKSUM is the possibility of having the same hash value for different data and therefore you would have to add secondary condition(s) to avoid this, therefore...

    Far away is close at hand in the images of elsewhere.
    Anon.

  • RE: Pivot Table Generator Code

    Dynamic PIVOT for 2005 (not tested)

    DECLARE @tablename nvarchar(50)

    DECLARE @groupby nvarchar(50)

    DECLARE @pivcol nvarchar(50)

    DECLARE @datacol nvarchar(50)

    DECLARE @agg nvarchar(20)

    SET @tablename = 'SOURCETABLE'

    SET @groupby = 'ROWFIELD'

    SET @pivcol =...

    Far away is close at hand in the images of elsewhere.
    Anon.

  • RE: Avoiding Cursors

    Write a function to concatenate T1ID's (plenty of examples on theis site) or if you do not wish to use a function then this will do it (limited to 6...

    Far away is close at hand in the images of elsewhere.
    Anon.

  • RE: small but dificult ms sql select count, group by, top @var

    SELECT p.PostID, p.Title, p.Body, COUNT(r.ReplyPostID) AS [noReplies]

    FROM Table_Posts p

    LEFT OUTER JOIN Table_PostsReplies r

    ON r.PostID = p.PostID

    GROUP BY p.PostID, p.Title, p.Body

    HAVING (SELECT COUNT(*) FROM Table_Posts p2...

    Far away is close at hand in the images of elsewhere.
    Anon.

  • RE: DB Log File Size

    Check the log file

    is it set to autogrow?

    by how much?

    what was it's original size when created?

    is all the space in the log used?

    If your log file is 10G then it was...

    Far away is close at hand in the images of elsewhere.
    Anon.

  • RE: small but dificult ms sql select count, group by, top @var

    Yeah possibly

    Must admit I do not look to see if it's any form of homework/coursework

    Unless you...

    Far away is close at hand in the images of elsewhere.
    Anon.

  • RE: Problem with Functions and Procedures

    Look in BOL (Books Online) it will give you what you need eg

    for a / b

    CASE WHEN b=0 THEN 0 ELSE a / b END

     

    Far away is close at hand in the images of elsewhere.
    Anon.

  • RE: Problem with Functions and Procedures

    The first error is because your language setting require dates in mm/dd/yyyy format.

    The second error will be caused by a zero value divisor. Check the values of floortotal, FinalRtLsincSC and...

    Far away is close at hand in the images of elsewhere.
    Anon.

  • RE: small but dificult ms sql select count, group by, top @var

    SELECT p.PostID, p.Title, p.Body, COUNT(r.ReplyPostID)

    FROM Table_Posts p

    LEFT OUTER JOIN Table_PostsReplies r

    ON r.PostID = p.PostID

    WHERE p.PostID BETWEEN @startIndex AND @stopIndex

    GROUP BY p.PostID, p.Title, p.Body

    Far away is close at hand in the images of elsewhere.
    Anon.

  • RE: Removing NULL rows from table x with # of columns x

    Joe's solution of using COALESCE is what I first thought of myself.

    Then I got to thinking about whether it would be possible to use checksum.

    Insert a row in the table with...

    Far away is close at hand in the images of elsewhere.
    Anon.

  • RE: Need a query to insert a row to a Destination table from a source table with multiple records

    You will have to use MAX to PIVOT the data.

    Is there a reason you removed MAX, ie

    More than 3 columns?

    Multiple values per Element Code?

    Far away is close at hand in the images of elsewhere.
    Anon.

  • RE: Need a query to insert a row to a Destination table from a source table with multiple records

    The query works fine for me using your test data.

    Are you sure you aer grouping by Pat & Adm only

    if you include Element then you will get multiple rows as...

    Far away is close at hand in the images of elsewhere.
    Anon.

  • RE: Getting Rid of Rows Affected Message

    Use

    SET NOCOUNT ON

    before your query

    Far away is close at hand in the images of elsewhere.
    Anon.

  • RE: Need a query to insert a row to a Destination table from a source table with multiple records

    INSERT INTO [Dest1] (Pat, Adm, Col1, Col2, Col3)

    SELECT Pat, Adm,

    MAX(CASE WHEN Element = 'A1' THEN EleVal ELSE '' END),

    MAX(CASE WHEN Element = 'A2' THEN EleVal ELSE ''...

    Far away is close at hand in the images of elsewhere.
    Anon.

Viewing 15 posts - 1,891 through 1,905 (of 3,544 total)