Forum Replies Created

Viewing 15 posts - 346 through 360 (of 367 total)

  • RE: how ro create a table with multiple coloumns defined to a single primary key

    Try a free tool XDetails (www.sqlxdetails.com). It really simple presents multicolumn PK, FK, column comments and other features.

  • RE: Query - Array

    If you really have to...

    split to one city, than rejoin them with less cities per row.

    But I would not join them at all. I would leave one city per row.

    Google...

  • RE: Random updates from another table

    Modulo was because smaller table has less rows than big table.

    Lets say N = number of rows in the smaller table.

    Smaller table is widened in subquery with random unique...

  • RE: Random updates from another table

    From the smaller table make a subquery widening it with a random ordinal number as shown in example before (row_number() over(order by newid()) construct).

    If you have unique integer (maybe PK?)...

  • RE: Random updates from another table

    Why update? You could select exactly what you need and optionally store that via insert.

    Update is a low performer.

    Since you didn't specify what is random here, let's assume you have...

  • RE: Table design

    Like Andrew said, it's a classic many-to-many relation. In logical data model you have two entities: A and B. One A can have (contains, is associated with, etc) multiple B's,...

  • RE: Sql help: Triggers

    You could use SQL_VARIANT data type that can store any other base data type without conversion or lost precision:

    DECLARE @x AS SQL_VARIANT, @y AS SQL_VARIANT, @t AS SQL_VARIANT

    SELECT @x =...

  • RE: Query - Array

    In this example full text index is very wrong solution.

    You should store each value in separate table row and use a normal index.

    Split function is here:

    -- Create sysTally table

    SELECT TOP...

  • RE: Stored Procedure help

    create procedure ErrorListGet

    -- Returns comma-separated list of errors for given request

    (@reqid int,

    @Messages varchar(max) out

    ) as

    begin

    -- Bild comma-separated list of messages

    -- If you want some particular order, simply add "order...

  • RE: Using Case for an Update

    CASE in not complex at all.

    I already wrote you description of what might be wrong.

    You cannot use LEFT JOIN and then update right table - if there is no matched...

  • RE: Using Case for an Update

    tacy.highland (1/17/2011)


    Here's the scenario:

    UPDATE BookingActivity

    SET faretypeid =

    CASE WHEN c.FareTypeId IN (9,10,11) THEN 4

    ELSE faretypeid = b.FareTypeId

    END

    FROM Booking b

    LEFT JOIN Clients c ON b.ClientID =...

  • RE: Try...Catch with transactions

    Lamprey13 stole me the word of mouth (or code from the keyboard) 😉

    That code is the best IMHO. Think of this situation: If the code inside the try-block calls a...

  • RE: CASE vs JOIN

    In short: no. You probably will not have significant performance gains if you use "mutant" CASE statement.

    It's all about the megabytes that db engine needs to read to get you...

  • RE: Partition of a large Table

    This requires classic tuning procedure.

    Collect few typical queries, and start with the one that is used the most.

    Measure logical reads, eg. like this:

    SET STATISTICS IO ON

    SELECT * FROM sys.all_objects --...

  • RE: Locking of Tables

    Answer to your question is: yes, parallel execution of that procedure will give you the same control number.

    In default transaction isolation level, transaction will not lock the selected row.

    The key...

Viewing 15 posts - 346 through 360 (of 367 total)