본문 바로가기

Database/MSSQL

Unique index setting Email must be unique 중복되는 email을 등록하려는 경우 다음의 exception이 발생합니다. 고유인덱스가'uq_user_email'인개체'dbo.TB_User'에중복키행을삽입할수없습니다. Sql script CREATE UNIQUE NONCLUSTERED INDEX [uq_user_email] ON [dbo].[TB_User] ( [Email] ASC )WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, IGNORE_DUP_KEY = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMAR.. 더보기
How to find DB Size Storage 의 사이즈를 확인하기 위해서 아래의 Query 를 사용합니다. USE DBName GO SELECT [size] * 8 , [filename] FROM sysfiles sysfiles 라는 view 는 기본적으로 system 에서 제공하는 것으로써 storage 에 대한 정보를 갖고 있습니다. 이 중 size 컬럼은 그 크기를 8 KB 페이지 단위로 나타내고 있기 때문에, 실제의 용량을 확인하기 위해서는 8 을 곱하면 됩니다. 출처: http://stackoverflow.com/questions/176379/determine-sql-server-database-size 더보기
SQL Server DateTime Formatting SQL Server DateTime FormattingUsually the formatting of a DateTime value into a more readable date and time is dealt with by the client application. However, there are some situations were it is useful to convert a DateTime into a formatted character string within a SQL statement. Converting a DateTime to a VarCharThe Transact-SQL (T-SQL) Convert command can be used to convert data between diffe.. 더보기