Forum Replies Created

Viewing 15 posts - 376 through 390 (of 413 total)

  • RE: How to generate primary Keys?

    Could you describe a bit more what you are trying to achieve?

  • RE: Recurring key reference in a table.

    You are welcome

    If you still need help, please post the table definition.

  • RE: Order by

    Another possibility is to sort by a case statement, like the following:

    order by case when id = 100 then -1 else id end

  • RE: qury to select most recent w/o duplicates

    Try this one:

    select distinct d.docid, d.name, s.date

    from tblDocument d inner join tblstatus s on d.pk = s.objectid

    where not exists

    (select * from tblDocument d2 inner join tblstatus s2 on d2.pk =...

  • RE: Recurring key reference in a table.

    Could you post the table definition and also a list of indexes on your table?

    What is "Previous A & E number" for the first visit, null or blank?

    And (just curious)...

  • RE: Using Virtual tables

    When I compare our suggestions, I see that you have renamed S1, S2 and S3 to Descr, Resol and Special, which of course is much better since it is more...

  • RE: Using Virtual tables

    Looks like you are in for a headache

    I would try something like

    Select * from

    SV00300

    inner join SV00200

                 on SV00300.CUSTNMBR = SV00200.CUSTNMBR AND SV00300.ADRSCODE...

  • RE: sortby within reporting procedure

    You could input @VarName1=@VarName2=@VarName3, or more elegantly, @VarName2=@VarName3=null and then

    declare @OrderBy varchar(1000)

    select @OrderBy = ''

    if @VarName1 is not null

     select @OrderBy = @VarName1 + ' ' + @SortOrder1

    if @VarName2 is not...

  • RE: sortby within reporting procedure

    Instead of the @SortBy parameter, I think I would add 6 parameters, @VarName1, @VarName2, @VarName3, @SortOrder1, @SortOrder2, @SortOrder3 and then add something like

    'order by ' + @VarName1 + ' '...

  • RE: Stripping Out Quotes

    You might have a point when you say that "trailing blanks are ignored", rather than "the shorter string is padded with blanks". The first statement is simpler as it involves only the...

  • RE: Returning a set size of data ...

    I assume that ident is int identity(1,1) and that you want the largest number n such that the sum of the datalength of all rows with ident <= n is...

  • RE: Stripping Out Quotes

    That's a good explanation, thank you

    I would still prefer that '' and ' ' were different, but I guess there is not much...

  • RE: Joins versus subqueries

    I thought that maybe the performance difference had something to do with caching. Now I have executed each query 1000 times, and the "not exists" query is definitely faster -...

  • RE: Stripping Out Quotes

    Oh, I skipped that one after reading the first two lines

    I don't understand his answer (that the result is unknown). Since ''...

  • RE: Joins versus subqueries

    What happens if you again run query A and B in one batch, but this time query B before query A?

Viewing 15 posts - 376 through 390 (of 413 total)