본문 바로가기

IT/MS SQL

[MS SQL]Transaction begin tran --트랜잭션 시작 commit tran --트랜잭션 완료 rollback tran --트랜잭션 취소 select @@error --에러 count CREATE proc tran01 @tbname varchar(10), @types varchar(5), @comment varchar(20) AS begin tran INSERT tableinfo(tbname, comment, types) VALUES(@tbname, @comment, @types) IF @@error>0 --오류가 발생하면 begin print '오류방생!' rollback tran end else begin print '제대로 실행!' commit tran end exec tran01 'aaa','board','테스트' 더보기
[SQL Server] 날짜 연산 DATEDIFF() http://technet.microsoft.com/ko-kr/library/ms189794.aspx DATEDIFF ( datepart , startdate , enddate ) :int DATEADD() http://technet.microsoft.com/ko-kr/library/ms186819.aspx DATEADD (datepart , number , date ) :date datepart약어 year yy, yyyy quarter qq, q month mm, m dayofyear dy, y day dd, d week wk, ww hour hh minute mi, n second ss, s millisecond ms microsecond mcs nanosecond ns 더보기
[SQL Server] Data Format Cast & Convert http://msdn.microsoft.com/en-us/library/ms187928.aspx Syntax for CAST: CAST (expression AS data_type [ (length ) ] ) Syntax for CONVERT: CONVERT (data_type [ (length ) ] ,expression [ ,style ] ) 구글링도 귀찮다 이제 -_-a 더보기
[MS SQL] SQL Server 2005 에디션별 기능 비교 http://www.microsoft.com/korea/sqlserver/2005/2005/productinfo/sql2005features.mspx 더보기
[MS SQL] Unable to cast object of type 'Microsoft.SqlServer.Management.Smo.SimpleObjectKey'... Job Schedule 등록하다가 받은 에러.. Unable to cast object of type 'Microsoft.SqlServer.Management.Smo.SimpleObjectKey'to type 'Microsoft.SqlServer.Management.Smo.Agent.JobObjectKey'. (Microsoft.SqlServer.Smo) Service pack 2 설치 후 해결! http://www.microsoft.com/downloads/details.aspx?familyid=D07219B2-1E23-49C8-8F0C-63FA18F26D3A&displaylang=en 설치 하고, 리붓 하고, 다시 Schedule 등록, 성공! 더보기
[MS SQL] Database Backup Backing Up a Whole Database BACKUP DATABASE { database_name | @database_name_var } TO [ ,...n ] [ ] [ next-mirror-to ] [ WITH { DIFFERENTIAL | [ ,...n ] } ] [;] Backing Up Specific Files or Filegroups BACKUP DATABASE { database_name | @database_name_var } [ ,...n ] TO [ ,...n ] [ ] [ next-mirror-to ] [ WITH { DIFFERENTIAL | [ ,...n ] } ] [;] Creating a Partial Backup BACKUP DATABASE { database_n.. 더보기
[MS SQL] SQL server 2005 -> 2000 Migration 2005 버전에 있는 Database 파일을 2000 으로 옮기기 - SQL Server Management Studio 이용 1. 옮길 Database 선택 팝업 > Task > Generate Scripts 2. Next...Next......하다가 Option 에서 Script for Server Version 변경 Next....Next......Generate 완료! # 근데,,, 이렇게 해서 한방에 되진 않더라는.....쩝. *참조 - SQL Server 2000 온라인 설명서 Download http://www.microsoft.com/downloads/details.aspx?displaylang=ko&FamilyID=a6f79cb1-a420-445f-8a4b-bd77a7da194b - Ma.. 더보기
[MS SQL] Error 29506 when installing SQL Server 2005 Management Studio Express x64 on Windows7 이번엔 요런 녀석을 만났다. 뭐냐 이건...-_- 하지만, 구글님은 알고 계시지.... 다음과 같이 해결한다. 1. 커맨드 프롬프트를 실행시킨다. 그냥 실행시키는게 아니라 관리자 모드로 실행시킨다. (마우스 오른쪽버튼 > 팝업메뉴를 띄우면 있음) 2. 관리자 모드로 실행시킨 커맨드창에서 SQLServer2005_SSMSEE_x64.msi를 실행시키고 설치한다. 3. 잘 설치된다. 더보기