Forum Replies Created

Viewing 6 posts - 1 through 6 (of 6 total)

  • RE: Swapping and nudging items

    I'm going to reconsider here a bit. For the swap procedure, I'm going to go with:

    
    
    CREATE PROCEDURE usp_SwapItems
    @id1 CHAR(1),
    ...
  • RE: Passing a Column name to a stored procedure.

    You can, but you probably shouldn't. Any solution is almost surely going to eliminate effective compiling and optimization.

    You're better off just writing a separate sp for each column. Swiss-Army-Knife stored...

  • RE: Swapping and nudging items

     
    
    create procedure usp_SwapItems
    @id1 char(1), @id2 char(1)
    as
    UPDATE testsort
    SET sort = CASE
    ...
  • RE: Swapping and nudging items

    CREATE PROCEDURE usp_MoveItem

    @id char(1),

    @direction int

    -- @direction = -1 move up

    -- @direction = 1 move down

    AS

    DECLARE @mysort int

    DECLARE @swapid...

  • RE: Swapping and nudging items

    create procedure usp_SwapItems

    @id1 char(1), @id2 char(1)

    as

    update testsort

    set sort =

    case when id = @id1

    then (SELECT sort FROM testsort WHERE id = @id2)

    else (SELECT sort FROM testsort WHERE id = @id1)

    END

    WHERE

    id IN...

  • RE: Search & Replace inside SP's

    Must this be accomplished in TSQL only? If you are amenable to using a procedural language like VB, this is a lot easier using SQLDMO (Documented in Books Online). It's...

Viewing 6 posts - 1 through 6 (of 6 total)