Sử dụng Transaction trong SQL Server

Có 2 cách để kiểm soát Transaction trong SQL Server
Cách 1: bằng cách kiểm tra biến toàn cục @@ERROR để xác định nếu có lỗi xảy ra thì thực hiện rollback. Đây là cách cổ điển của SQL Server 2000. Điểm bất tiện của nó là sau mỗi câu lệnh SQL, ta phải thực hiện việc kiểm tra giá trị của biến này, để kịp thời rollback.

CREATE PROC For_TransTest
AS
BEGIN
    BEGIN TRANSACTION updatestaff;

    UPDATE aspnet.staff SET fk_department = 30
    WHERE pk_staff = 971;

    IF @@ERROR != 0  -- neu co loi xay ra, rollback 
    BEGIN
        PRINT 'rollback ne';
        ROLLBACK TRAN updatestaff;
    END

    UPDATE aspnet.staff SET fk_department = null
    WHERE pk_staff = 971;

    IF @@ERROR != 0  -- neu co loi xay ra, rollback 
    BEGIN
        PRINT 'rollback ne';
        ROLLBACK TRAN updatestaff;
    END
    ELSE
        COMMIT TRANSACTION updatestaff;

END

Cách 2: Sử dụng lệnh TRY...CATCH, hỗ trợ trên SQL Sever 2005, rất đơn giản và dễ dùng

Ví dụ:

CREATE PROC For_TransTest
AS
BEGIN
    BEGIN TRY

        BEGIN TRANSACTION updatestaff;

        UPDATE aspnet.staff SET fk_department = 30
        WHERE pk_staff = 971;

        UPDATE aspnet.staff SET fk_department = null
        WHERE pk_staff = 971;


        COMMIT TRANSACTION updatestaff;
        PRINT 'commited';
    END TRY
    BEGIN CATCH
        PRINT 'rollback ne';
        ROLLBACK TRAN updatestaff;  
    END CATCH
END

Làm sao để shrink database?

/*set database sang chế độ simple*/
Declare @dbname varchar(200),@sql varchar(200)/*khai báo biến*/
SET @dbname = 'traugia_conon'/*gán tên db*/
set @sql ='alter database '+@dbname+' SET RECOVERY SIMPLE'/*chuyển sang simple*/
exec (@sql)/*thực thi lệnh*/
/*tém nó*/
DBCC SHRINKDATABASE(@dbname,10)/*shrink-->gọn nhẹ không ngờ*/

Microsoft SQL Server 2008 R2 Developer Edition x86 and x64

icrosoft SQL Server 2008 Developer enables developers to build and test applications that run on SQL Server on 32-bit, ia64, and x64 platforms. SQL Server 2008 Developer includes all of the functionality of Enterprise Edition, but is licensed only for development, test, and demo use. The license for SQL Server 2008 Developer entitles one developer to use the software on as many systems as necessary. For rapid deployment into production, instances of SQL Server 2008 Developer can easily be upgraded to SQL Server 2008 Enterprise without reinstallation.

Trusted, Scalable Platform
Supporting data consistency across heterogeneous systems through SQL Server Master Data Services, enabling high-scale complex event-stream processing through SQL Server StreamInsight™, and supporting scale-up scenarios for the largest available x64 and Itanium hardware (up to 256 logical processors).
IT & Developer Efficiency
Enabling administrators to centrally monitor and manage multiple database applications, instances or servers, accelerating the development and deployment of applications and providing improved support for virtualization through Hyper-V with Live Migration in Windows Server 2008 R2.
Managed Self-Service BI
Expanding powerful BI tools to all users with SQL Server PowerPivot for Excel and empowering a new class of business users to build and share powerful BI solutions with little or no IT support, while still enabling IT to monitor and manage user-generated BI solutions.

SQL.Sever.2008.R2.Developer.Edition.iso.torrent (20,89 kb)

Microsoft SQL Server 2008 R2 DataCenter Edition x86 and x64

Built on SQL Server Enterprise, SQL Server 2008 R2 Datacenter is designed to deliver a high-performing data platform that provides the highest levels of scalability for large application workloads, virtualization and consolidation, and management for an organization’s database infrastructure. Datacenter helps enable organizations to cost effectively scale their mission-critical environment.

Top Datacenter Only Features

*Gain insights and manage hundreds of instances per Control Point with Application and Multi-Server Management
*Leverage highest virtualization support for maximum ROI on consolidation and virtualization
*Enable high-scale complex event processing with StreamInsight™
*Enjoy the highest levels of scale through support for more than 8 processors and up to 256 logical processors
*Use powerful hardware with maximum OS memory enablement

Improve Hardware Utilization through Maximum Consolidation Support
*Consolidate databases onto fewer machines with maximum virtualization limits and Windows Server 2008 R2 Hyper-V™ support
*Assess resource utilization at scale for maximum optimization with Application and Multi-instance Management
*Host multiple databases on a server without compromising performance and scalability without hardware processor and memory limits
*Create a library of VHDs ready to be deployed when needed with SQL Server Sysprep

Lower Costs and Increase Business Continuity
*Help reduce hardware costs, optimize storage, and improve I/O performance with data and backup compression
*Achieve high availability through database mirroring and maximum server clustering support
*Move virtual machines between host servers without service interruption with Windows Server 2008 R2 Hyper-V™
*Help enable high availability and reduce downtime with indexing and restore operations and hot-add and hot-replace CPU and memory capabilities

Optimize High-scale Database Management for Compliance and Performance
*Help improve performance through table and index partitioning, query parallelism, scalable shared database deployments, and enhanced read-ahead and scan capabilities
*Define hardware resource limits for individual workloads for predictable performance across multiple database workloads with Resource Governor
*Help accelerate impact analysis and identify issues before they become problems with Performance Data Collector, SQL Server Profiler, and Database Engine Tuning
*Proactively define configuration policies and apply them across your SQL Server environment to ensure enterprise-wide compliance without the administrative overhead
*Gain the highest data protection to meet strict compliance requirements with built-in features like SQL Server Audit, Transparent Data Encryption and Enterprise Key Management

Enjoy Built-in Business Intelligence for Thousands Users
*Improve business efficiency by creating a single, consolidated data warehouse for business analytics and reporting – support up to tens of terabytes of data
*Ensure you have a single standardized version of your data for operational and reporting consistency across the enterprise with Master Data Services
*Perform complex data analyses using a familiar tool, Microsoft Office Excel 2010, and share results in Microsoft Office SharePoint with the new PowerPivot Add-in
*Deliver business insights with controlled access across the enterprise with a suite of self-service business intelligence features and SQL Server Reporting Services
*Share reports quickly and seamlessly through Microsoft Office SharePoint integration – publish directly to a SharePoint library or embed reports directly into SharePoint portal web parts

RELEASE iNFORMATiON
CRACKER: TEAM Z.W.T
SUPPLiER: TEAM Z.W.T
PACKER: TEAM Z.W.T
RELEASE DATE: 04/29/2010
FORMAT: iSO
SiZE: 1 DVD
PLATFORM: WinALL
SOFTWARE TYPE: UTIL
LANGUAGE: ENGLiSH

 

Link: azsharing.com

http://azsharing.com/rujnvpdxa0u9/zssr2ent.iso.00 1.html

http://azsharing.com/iiq8t48at0ks/zssr2ent.iso.002.html

http://azsharing.com/7u1an6shp2qz/zssr2ent.iso.003.html

http://azsharing.com/50c9muachlv4/zssr2ent.iso.004.html

http://azsharing.com/z6rtcfzpabvw/zssr2ent.iso.005.html

http://azsharing.com/k710vvdf3mmk/zssr2ent.iso.006.html

http://azsharing.com/o1lk1bnjusja/zssr2ent.iso.007.html

http://azsharing.com/gbh0azzzpctc/zssr2ent.iso.008.html

http://azsharing.com/yaqbplpech2r/zssr2ent.iso.009.html

http://azsharing.com/18bttpab38fq/zssr2ent.iso.010.html

http://azsharing.com/aqtihamvxbwn/zssr2ent.iso.011.html

http://azsharing.com/jo7vrc55euur/zssr2ent.iso.012.html

http://azsharing.com/txmn00egie4u/zssr2ent.iso.013.html

http://azsharing.com/mbzn24idrytx/zssr2ent.iso.014.html

http://azsharing.com/p0dxiy7zcg7c/zssr2ent.iso.015.html

http://azsharing.com/p2r4xbyevyex/zssr2ent.iso.016.html

http://azsharing.com/omhhj0f3penn/zssr2ent.iso.017.html

http://azsharing.com/y3dbnaivxq9z/zssr2ent.iso.018.html

http://azsharing.com/407nnfcjnibp/zssr2ent.iso.019.html

http://azsharing.com/ov1rwihbxa1l/zssr2ent.iso.020.html

http://azsharing.com/an99xj41w640/zssr2ent.iso.021.html

http://azsharing.com/vclg8wcy4n3v/zssr2ent.iso.022.html

link: mediafire

http://www.mediafire.com/?y4wgt69a2b8av

Microsoft.SQL.Server.2008.Data.Center.Edition.X86.X64.torrent (64,01 kb)

Sử dụng Transaction trong SQL Server

Có 2 cách để kiểm soát Transaction trong SQL Server
Cách 1: bằng cách kiểm tra biến toàn cục @@ERROR để xác định nếu có lỗi xảy ra thì thực hiện rollback. Đây là cách cổ điển của SQL Server 2000. Điểm bất tiện của nó là sau mỗi câu lệnh SQL, ta phải thực hiện việc kiểm tra giá trị của biến này, để kịp thời rollback.

CREATE PROC For_TransTest
AS
BEGIN
    BEGIN TRANSACTION updatestaff;

    UPDATE aspnet.staff SET fk_department = 30
    WHERE pk_staff = 971;

    IF @@ERROR != 0  -- neu co loi xay ra, rollback 
    BEGIN
        PRINT 'rollback ne';
        ROLLBACK TRAN updatestaff;
    END

    UPDATE aspnet.staff SET fk_department = null
    WHERE pk_staff = 971;

    IF @@ERROR != 0  -- neu co loi xay ra, rollback 
    BEGIN
        PRINT 'rollback ne';
        ROLLBACK TRAN updatestaff;
    END
    ELSE
        COMMIT TRANSACTION updatestaff;

END
Cách 2: Sử dụng lệnh TRY...CATCH, hỗ trợ trên SQL Sever 2005, rất đơn giản và dễ dùng
CREATE PROC For_TransTest
AS
BEGIN
    BEGIN TRY

        BEGIN TRANSACTION updatestaff;

        UPDATE aspnet.staff SET fk_department = 30
        WHERE pk_staff = 971;

        UPDATE aspnet.staff SET fk_department = null
        WHERE pk_staff = 971;


        COMMIT TRANSACTION updatestaff;
        PRINT 'commited';
    END TRY
    BEGIN CATCH
        PRINT 'rollback ne';
        ROLLBACK TRAN updatestaff;  
    END CATCH
END