Forum Replies Created

Viewing 15 posts - 1 through 15 (of 66 total)

  • RE: SQL Statement

    Called, some one did, hm?

    The path to becoming a jedi is made possible by using clear, precise logic in your code.

    A WHERE clause with join criteria and filters-- long it...

  • RE: WHERE IN(sub-query) vs. INNER JOIN

    Yes!

    And worse: IN and Not IN() require single-column primary keys. This leads beginners to deduce: every table must have an single-column (and thus, often, an identity) PK,...

  • RE: ISZero

    Explain what your magic "isZero()" function is doing.

    Replace 0 with another value it does, like Isnull()? If so, what value should be returned?

    if you want NULL returned, you may use...

  • RE: How do I Using MAX (DATE) and still include nulls??

    In this case, simple logic in the WHERE will suffice:

    WHERE fa.EffEndDate=(SELECT MAX(fa2.EffendDate) FROM #LAccounts fa2 WHERE Fa2.accountnumber=fa.accountnumber)

    or fa.EffEndDate is null

  • RE: Displaying every combo of unique id values

    Thank you for the compliment, Mr Rock Moose

  • RE: Displaying every combo of unique id values

    That doesn't give all permutations, and it also doesn't return a GroupID per group created.

  • RE: Displaying every combo of unique id values

    It is simply binary !

    for 4 names:

    0000

    0001

    0010

    0011

    0100

    ..etc ...

    1111

    1 = include the name, 0 = exclude.

    For each group:

    GroupID = integer representation of the bits

    Members = all ID's in which the bit...

  • RE: Convert Date For Comparison

    declare @time varchar(10);

    set @time= '09:00:00'

    select convert(Datetime, convert(varchar(10), getdate(),101) + ' ' + @time)

  • RE: declare cursor with dynamic Select

    Still confused on terminology:

    Are you assigning Invoice Numbers or Line/Item Numbers to each line in the resultset for that 1 invoice?

    i.e., this process is always generating 1 invoice or multiple...

  • RE: declare cursor with dynamic Select

    I'd like to help if you can give more details of this process. tell us step by step what you are tyring to do.

    i.e.,

    step 1 -- import CSV file

    step...

  • RE: declare cursor with dynamic Select

    Yoda is confused -- are you updating/changing data in your database, or just producing a report? (don't say both -- these are two completely separate concepts!)

    If it is just...

  • RE: Displaying every combo of unique id values

    It depends if GroupID has any meaning. if it is just to group each distinct set, then no difference.

    if there must be some logic as to how groupID...

  • RE: declare cursor with dynamic Select

    Please give sample data and what you want to do.

    I guarantee you need neither dynamic SQL, nor a cursor.

    Are you familiar with the UPDATE statement in T-SQL? It allows...

  • RE: Displaying every combo of unique id values

    warning (for my method and others):

    if large amounts of data you have, results grow even larger.

    For N names, possible groups = 2^N - 1.

    This means only 32 names = 4,294,967,295

    possible...

  • RE: Displaying every combo of unique id values

    -- This is our data:

    declare @Vals table (ID int)

    insert into @vals

    select 1 union

    select 2 union

    select 3 union

    select 4 union

    select 5

    -- we need numbers, from 1 through 2 ^ (#...

Viewing 15 posts - 1 through 15 (of 66 total)