Task: to determine the behaviour of particular transaction isolation levels with respect to concurrent SQL query …SELECT TOP(1) [...] + 1… Solution: see Figure 2 USE [Test_IsolationLevels] GO Source code 1: Use database CREATE TABLE [dbo].[IsoSelTopOnePlusOne]( [Identity] [int] IDENTITY(1,1) NOT NULL, [TopOnePlusOne] [int] NOT NULL, [ModifiedDate] [datetime] NOT NULL ) ON [PRIMARY] GO Source code 2: Create table — 0: [...]
Posts Tagged ‘T-SQL’
Task: syntax parsing and checking db object existence in SQL query Solution: see Source code No. 4 Source code No. 1: Syntax parsing of SQL DECLARE @SqlQuery NVARCHAR(4000) SET @SqlQuery = ‘SELECT [ID] FRON [dbo].[Parsing_T-SQL]‘ EXEC (‘SET FMTONLY ON ‘ + @SqlQuery) Figure 1: SSMS SQL query result – syntax parsing of SQL Source code No. 2: Table [...]
Task: the system function RAND() use in the user defined function (UDF) Solution: the system function RAND() is not possible to be used in the user defined function (see Figure 1 to 3). However, this function is possible to be implemented without problems into the stored procedure (see Figure 4 and 6), or to be [...]
sys.columns Task: listing of the name and nullability of individual columns from the given table Solution: SELECT [name], [is_nullable] FROM [sys].[columns] WHERE [object_id] = OBJECT_ID(‘[dbo].[Test_SysColumns]‘) Figure 1: Definition of the table Figure 2: Result of SQL query sys.parameters Task: listing of the I/O parameters from the given stored procedure Solution: SELECT [name], [is_output] FROM [sys].[parameters] [...]
