Forum Replies Created

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

  • 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...
  • 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...
  • 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.

  • 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...

  • 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...
  • RE: Swapping and nudging items

    quote:


    envisaged it to be done without cursors


    One way would be to create a...

  • 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...

  • RE: UPDATETEXT for multiple rows

    quote:


    pick up multiple occurrences of the string in the same row


    You could put...

  • 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...

  • 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.

    ...

  • RE: UPDATETEXT for multiple rows

    quote:


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


    If the table has a PK...

  • 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...

  • 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...
  • RE: Invalid column

    quote:


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


    True in this contrived example...

  • RE: Import and export data

    quote:


    How long it takes to transfer 7GB. Are you deleting before import data, if so what happens if the job failed after...

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