Forum Replies Created

Viewing 15 posts - 46 through 60 (of 98 total)

  • RE: Code Speed

    Hello tendayit and all,

    I see two estrange points (to me) in your code, lets me explain:

    First, your table TRANSACTION_TEMP has a clustered index but, being a temp table, you need...

  • RE: Dynamically checking rows in a table for data changes in SQL

    Hello,

    I tried to solve this problem in a chain of transformations, see the code below

    create table #temp (

    ...

  • RE: LEFT JOIN WITH COUNT Question

    Hello,

    I agree with kramaswamy in the strategy adopted, splitting the query in two parts because there are two different criteria to group results.

    To join these two parts I prefer the...

  • RE: Single table row-column comparison issue

    Hello,

    thanks for your kind answer.

    I realize that you have limited SQL skills and hardly understand the code put by all people, but there is a previous question in your problem,...

  • RE: Single table row-column comparison issue

    Hello,

    as I understand, in your drug inventory you put drugs and locations; each drug in a location 'FLR-%' must be present in another location 'PX-%' and both locations must be...

  • RE: Optimizing inserts and deletes on a single large table

    Hello,

    as Kevin said your DELETE instruction lacks on a WHERE clause, I suppose you coded something like

    DELETE TOP 3000 FROM table WHERE too_old_record

    Do you need...

  • RE: Sql tables for all countries States and Cities

    From http://www.idescat.cat/territ/BasicTerr?TC=9 you can extract all cities in Catalonia 🙂 . For the rest of the world I can't help you.

  • RE: Working with UNION and NOT EXISTS

    Of course, UNION will remove duplicate rows but not different rows with the same key. Maybe you have rows within bot your live table and your history table with the...

  • RE: Working with UNION and NOT EXISTS

    Hello Dan,

    you don't need any NOT EXISTS clause (nor any OUTER JOIN clause) because UNION will remove any duplicate rows. So if there is a row that belongs to both...

  • RE: how to print characters after third occurrance of a character

    Hello,

    the CHARINDEX function will return you the first occurrence for the desired character, so you need invoke this functions three times in a row.

    WITH X AS (SELECT '-1-2-33' AS stream

    UNION...

  • RE: STUFF FUNCTION

    the problem resides in the select statement

    That's true?, nice, now the problem is located and you can fix it.

    I am unsure on where to include the actual table Havbed with...

  • RE: Insert loop

    Hello,

    as I deduce from your query, the field ACCESS_INSTANT has unique values. Is TableA indexed by this field?, is TableB indexed by this field too?

    If so you can alter your...

  • RE: STUFF FUNCTION

    Hello again,

    executing this code,

    select stuff ((

    SELECT ',' + CASE

    WHEN placement IN (1, 2, 5, 7) THEN CAST(TotalPlacement AS VARCHAR(9))

    ELSE ''

    END

    FROM (

    SELECT 1 as placement, 10 AS TotalPlacement

    UNION SELECT 2,...

  • RE: STUFF FUNCTION

    Hello,

    well, that's I understand from your post:

    - For placements 1, 2, 5, 7 you want to show the count number (any value including zero),

    - for other placements you want to...

  • RE: STUFF FUNCTION

    Hello,

    As I understand you want to replace ',0' by ',', right?.

    Try it,

    SELECT ',' + CASE

    WHEN TotalPlacement = 0 then ''

    WHEN Placement IN (1, 2, 5, 7) THEN CAST(TotalPlacement AS...

Viewing 15 posts - 46 through 60 (of 98 total)