|
|
|
|
wowhoo / 2001-04-25 / ¿ÀÈÄ 9:24:25 / 61.73.28.59
Á¶È¸¼ö : 151
|
[Áú¹®] ÇÁ·Î½ÃÀú¿¡ °üÇÑ Áú¹® .. |
CREATE PROCEDURE Proc_GetMax
@Board_Name Varchar(20) ,
@Column Varchar(10) ,
@TotalCount Varchar(10) Output
AS
Begin
DECLARE @Str_MaxSQL Varchar(200)
Set @Str_MaxSQL = 'Select @TotalCount = Max('+@Column+') From ' + @Board_Name
EXEC(@Str_MaxSQL)
if @TotalCount is Null select @TotalCount=0
End
GO
À̶õÇÁ·Î½ÃÀú¸¦ ¸¸µé¾ú½À´Ï´Ù .
ASP¶û ¿¬µ¿Çϱâ À§ÇÑ ÇÁ·Î½ÃÁ® ÀÌÁö¿ä ..
@TotalCount ¶õ ÇÔ¼ö·Î .. Out PutÀ» ÇÏ°í ½ÍÀºµ¥ ..
ÇÁ·Î½ÃÀú »ý¼ºÀº µÇÁö¸¸ ½ÇÇàÀº µÇÁö ¾Ê½À´Ï´Ù.
¹Ýµå½Ã .Declare Ç϶õ ¸Þ½ÃÁö¸¸ ³ª¿É´Ï´Ù .
Ȥ½Ã .. ÀÌ·±½ÄÀ¸·Î EXEC¶õ ¸Þ¼Òµå¸¦ ÀÌ¿ëÇÏ¿© ¹®ÀÚ¿·Î ó¸®ÇÒ¶§ ..
Input °ªÀ̶û... OUP °ªÀÌ °°ÀÌ ÀÖ¾î¼ ¿¡·¯°¡ ¶ß´Â°Ç ¾Æ´ÑÁö ..
¾î¶²½ÄÀ¸·ÎÇÏ¸é ¹®Á¦¸¦ ÇØ°á ÇÒ¼ö ÀÖÀ»·±Áö ±Ã±ÞÇÕ´Ï´Ù.
Âü°í·Î
Board_name = "freeBoard"
Set Cmd=Server.CreateObject("ADODB.Command")
With Cmd
.ActiveConnection=DBconn
.CommandText="Proc_GetMax"
.CommandType=adCmdStoredProc
.Parameters.Append .CreateParameter("@Board_name",adVarChar,adParamInput,10,Board_Name)
.Parameters.Append .CreateParameter("@Column",adVarChar,adParamInput,10,"Ref")
.Parameters.Append .CreateParameter("@TotalCount",adInteger,adParamOutput,0)
.Execute , ,adExecuteNoRecords
Max_Ref = Clng( .Parameters("@TotalCount").Value)+1
End with
Set Cmd = Nothing
¾Æ·¡ÀǼҽº´Â.. ASP ¿¡¼ °ªÀ» ¹Þ±â À§ÇÑ ¼Ò½ºÀÔ´Ï´Ù .
°í¼ö´ÔµéÀÇ Á¶¾ð ºÎŹ µå¸³´Ï´Ù .. ^^;;
|
|
|
|