Forum Replies Created

Viewing 15 posts - 2,896 through 2,910 (of 3,544 total)

  • RE: How would you do this?

    I would use and IF statement on CASESETTLED to decide which table to join to TBLCASE.

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

  • RE: Alternative to cursor

    SELECT a.class, a.account, a.cust, a.doc_type 
    
    FROM documents a
    LEFT OUTER JOIN documents b
    ON b.class = a.class
    AND b.account = a.account
    AND b.cust = a.cust
    AND...

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

  • RE: IP Address instead of Host Name?

    Following on from Fank's suggestion, use ping instead

    declare @ip varchar(255),@cmd varchar(100) 
    
    set @cmd = 'ping ' + HOST_NAME()
    create table #temptb (grabfield varchar(255))
    insert into...

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

  • RE: Returning Numeric values exactly as inserted

    Store value as both varchar and decimal, use the varchar to show original input and use decimal value for calculations.

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

  • RE: GROUPING based on another group ?

    John,

    You might want to check your answer. There is a WHERE missing and you will not be use

    a.StudentID in the sub query as it does not appear in the GROUP...

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

  • RE: GROUPING based on another group ?

    SELECT a.Year,a.CourseId, COUNT(distinct b.StudentId) 
    
    FROM TCourseTaken a
    LEFT OUTER JOIN TCourseTaken b
    ON b.CourseId = a.CourseId
    AND b.StudentId = a.StudentId
    AND b.Year < a.Year
    GROUP BY...

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

  • RE: Swapping and nudging items

    quote:


    envisaged it to be done without cursors


    One way would be to create a...

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

  • RE: Locale ID = 197636

    AFIK it is set during install and relates to the unicode settings. I can't remember if you can select it, MS reckons you can. The normal id is 1033, is...

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

  • RE: UPDATETEXT for multiple rows

    quote:


    pick up multiple occurrences of the string in the same row


    You could put...

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

  • RE: UPDATETEXT for multiple rows

    What I was alluding to was to create the cursor like this

    DECLARE db_curs CURSOR
    
    FOR SELECT au_id FROM authors
    WHERE Address LIKE '%'+@SearchStr+'%'

    to do the scan...

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

  • RE: UPDATETEXT for multiple rows

    Another possibility is to insert the PKs into a temp table (also with PK) and then loop thru that table using 'TOP 1', select, updatetext, delete until all rows processed.

    ...

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

  • RE: UPDATETEXT for multiple rows

    quote:


    can't use cursor because can't declare variable as text


    If the table has a PK...

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

  • RE: UPDATETEXT for multiple rows

    Jonathan, nice answer.

    Just a question though. Whilst it may not be important but if, for example, there were 100 rows to be updated then the select between BEGIN/END would read...

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

  • RE: E2 is eval. 1st in

    One way is to use CASE but there may be performance issues.

    WHERE (CASE 
    
    WHEN T_DocumentType.[Id] = '{8511C9BA-8D2E-4D8C-A58E-B1016F4A9977}') THEN
    (CASE WHEN CAST(UD3 AS Integer) = 123456...

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

  • RE: Invalid column

    quote:


    ...if you placed a GO between the Alter and the Select...


    True in this contrived example...

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

Viewing 15 posts - 2,896 through 2,910 (of 3,544 total)