서버: 메시지 8144, 수준 16, 상태 2, 프로시저 sp_attach_single_file_db, 줄 0 프로시저 또는 함수 'sp_attach_single_file_db'에 너무 많은 인수가 지정되었습니다. 이런 에러가 발생했씁니다. 데이터 화일의 총수는 8개 인데요... 위 single_file 옵션은 하나의 데이터 화일만을 attach 하는 건가요? 고수님들의 답변 부탁드립니다. 수고하세요..
single_file_db 는 한개의 데이터 화일만을 attach 시킬수 있는
것으로 알고 있습니다. 더 가능한가요?
sp_attach_db 는 최고 16개 까지 가능한 것으로 알고 있습니다.
맞나? ^^'' 해본지 오래 되서 가물가물..
프로시져 열어보니 입력인수 2개네요.
db명하고 파일명하고..
SET QUOTED_IDENTIFIER ON GOSET ANSI_NULLS OFF GO
create procedure sp_attach_single_file_db@dbname sysname,@physname nvarchar(260)asdeclare @execstring nvarchar (400)set nocount on IF ((@dbname is null OR datalength(@dbname) = 0) OR (@physname is null OR datalength(@physname) = 0)) begin raiserror (15004,-1,-1) return (1) end
select @execstring = 'CREATE DATABASE ' + quotename( @dbname , '[') + ' ON (FILENAME =' + '''' + REPLACE(@physname,N'''',N'''''') + '''' + ' ) FOR ATTACH' exec (@execstring)if @@error <> 0 begin -- No need to raiserror as the CREATE DATABASE will do so return(1) end -- strip out replication from this databaseif exists (select * from master.dbo.sysobjects where name=N'sp_removedbreplication') begin exec sp_removedbreplication @dbname end return (0) -- sp_attach_single_file_db
GOSET QUOTED_IDENTIFIER OFF GOSET ANSI_NULLS ON GO
자세한 설명은 온라인 설명서에...