ALTER PROCEDURE [dbo].[get_board]
@code int,
@num int
AS
declare @p_code int
declare @p_num int
declare @n_code int
declare @n_num int
set nocount on
select top 1 @p_code=code,@p_num=num from board where (code=@code and num>@num) or (code>@code) order by code asc ,num desc
select top 1 @n_code=code,@n_num=num from board where (code=@code and num<@num ) or (code<@code) order by code desc, num desc
update board set Cnt = cnt+1 WHERE code=@code and num=@num
Select top 1
seq,
name,
title,
cnt,
convert(char(16),indate,120),passwd,user_ip,
isnull(@p_code,-1),isnull(@p_num,-1),isnull(@n_code,-1),isnull(@n_num,-1),
content
from board where code=@code and num=@num
set nocount off