Viewing 6 posts - 1 through 6 (of 6 total)
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),
...
December 2, 2003 at 11:53 pm
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...
December 2, 2003 at 2:54 pm
create procedure usp_SwapItems
@id1 char(1), @id2 char(1)
as
UPDATE testsort
SET sort = CASE
...
December 2, 2003 at 2:49 pm
CREATE PROCEDURE usp_MoveItem
@id char(1),
@direction int
-- @direction = -1 move up
-- @direction = 1 move down
AS
DECLARE @mysort int
DECLARE @swapid...
November 30, 2003 at 10:42 am
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...
November 30, 2003 at 10:02 am
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...
November 30, 2003 at 2:16 am
Viewing 6 posts - 1 through 6 (of 6 total)