2011년 1월 12일 수요일

SQL 해당 글자의 Char ASCII값

SET TEXTSIZE 0
-- Create variables for the character string and for the current
-- position in the string.
DECLARE @position int, @string char(8)
-- Initialize the current position and the string variables.
SET @position = 1
SET @string = 'New Moon'
WHILE @position <= DATALENGTH(@string)
BEGIN
SELECT ASCII(SUBSTRING(@string, @position, 1)),
CHAR(ASCII(SUBSTRING(@string, @position, 1)))
SET @position = @position + 1
END
GO

2011년 1월 4일 화요일

DB 이름 변경

데이타베이스 명령어인 renamedb를 사용하여 변경
alter database ADAM set single_user with rollback immediate
EXEC sp_renamedb 'ADAM', 'ADAM_20110104_old'
alter database ADAM_20110104_old set multi_user with rollback immediate