Sunday, 3 November 2013

Microsft Bugs - Sql Server

      In This article we are going to see a sample bug in microsoft. In the past few years i had face so many Microsoft Bugs, So many bugs are identified both in Front language [C#,asp.net] as well as Backend [Sql server] while i am doing my job, Now from that list i am going to share one of the interesting bug and that can be understand by every one. Which is present in DB Sql Server side.

    I am working in Sql Server so many times, but when a two or three tasks are combined and wrote a batch script i came across this issue.


Bug 1 :

We are all knew the How to create User Defiend Datatype and TableValued function in Sql server.

Now the issue is related to this , If we create a Both the things under a same transaction result in error as Transaction deadlock

Sample Code :



BEGIN TRANSACTION etran
go

CREATE TYPE [dbo].T_GUID FROM VARCHAR(128) NOT NULL
go

CREATE FUNCTION fn_details
(   
@ID    VARCHAR(128)    ,
@CUSTOMERID    VARCHAR(128)   
)
RETURNS @RETVALUE TABLE
(
PP_GUID    T_GUID
)
BEGIN    

DECLARE @QUERY    NVARCHAR(MAX)
DECLARE @TASKS    NVARCHAR(MAX)

RETURN
END

Error:

Msg 1205, Level 13, State 55, Procedure fn_details, Line 7
Transaction (Process ID 53) was deadlocked on lock resources with another process and has been chosen as the deadlock victim. Rerun the transaction.

link to see the Bug : Error in Create a Function


Bug 2:

A another interesting bug in sql server, i have faced is Loss of data in DB, When we make change tracking enable in  DB and tracking the changes and make suddenly switch off the system. Results in loss of data there is no data in change tracking once you execute the query to fetch the data from the sql server

link to see the Bug : Loss of Data


Still more there in front end language bugs existed, but these are could not resolve easily some of the bugs are violation of  Technology rules specified that are works well in Java.But Microsoft says a work around to work the code to be  like expected but that is not a rule to be kept in mind while programming.


No comments:

Post a Comment