SQL Server script issues with 6.1.4

Discussion of open issues, suggestions and bugs regarding UniDAC (Universal Data Access Components) for Delphi, C++Builder, Lazarus (and FPC)
Post Reply
FredS
Posts: 272
Joined: Mon 10 Nov 2014 17:52

SQL Server script issues with 6.1.4

Post by FredS » Thu 18 Jun 2015 19:33

This part of the db creation script errors in 6.1.4 yet works perfect in 6.0.2:
Error:

Code: Select all

Error=CREATE PROCEDURE [dbo].[AlterIndexesOn](@TableName NVARCHAR(80), @Rebuild BOOLEAN)
AS
BEGIN
  DECLARE @EnableDisable nvarchar(10);
  DECLARE @sql NVARCHAR(80);
 
  Set @EnableDisable = case @Rebuild when 1 then 'REBUILD' else 'DISABLE' END
Error=Incorrect syntax near 'END'.
Extracted:

Code: Select all

/****** Object:  Rule [dbo].[rule_BOOLEAN]    Script Date: 5/8/2015 8:33:25 AM ******/
CREATE RULE [dbo].[rule_BOOLEAN] 
AS
(@AType IN (0, 1))

GO

/****** Object:  UserDefinedDataType [dbo].[BOOLEAN]    Script Date: 5/8/2015 8:33:25 AM ******/
CREATE TYPE [dbo].[BOOLEAN] FROM [bit] NULL
GO


/****** Object:  StoredProcedure [dbo].[AlterIndexesOn]    Script Date: 5/8/2015 8:33:25 AM ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE PROCEDURE [dbo].[AlterIndexesOn](@TableName NVARCHAR(80), @Rebuild BOOLEAN)
AS
BEGIN
  DECLARE @EnableDisable nvarchar(10);
  DECLARE @sql NVARCHAR(80);
 
  Set @EnableDisable = case @Rebuild when 1 then 'REBUILD' else 'DISABLE' END; 
  DECLARE cur_IDX CURSOR FOR
      select 'ALTER INDEX ' + I.name + ' ON ' + T.name + ' ' + @EnableDisable 
      from sys.indexes I
      inner join sys.tables T on I.object_id = T.object_id
      where I.type_desc = 'NONCLUSTERED'
      and I.name is not NULL
      AND I.is_disabled = @Rebuild /* if True(1) returns disabled indexes, if False(0) returns enabled indexes*/
      AND T.name = @TableName
  
  OPEN cur_IDX;
  FETCH NEXT FROM cur_IDX INTO @sql;
  WHILE @@FETCH_STATUS = 0
     BEGIN
        EXECUTE sp_executesql  @sql;
        FETCH NEXT FROM cur_IDX INTO @sql;
     END;
  CLOSE cur_IDX;
  DEALLOCATE cur_IDX;
END

GO

azyk
Devart Team
Posts: 1119
Joined: Fri 11 Apr 2014 11:47
Location: Alpha Centauri A

Re: SQL Server script issues with 6.1.4

Post by azyk » Fri 19 Jun 2015 11:45

Thank you for the information. We have reproduced the problem and will investigate it.

azyk
Devart Team
Posts: 1119
Joined: Fri 11 Apr 2014 11:47
Location: Alpha Centauri A

Re: SQL Server script issues with 6.1.4

Post by azyk » Thu 25 Jun 2015 11:17

We have fixed this problem. This fix will be included in the next UniDAC build.

FredS
Posts: 272
Joined: Mon 10 Nov 2014 17:52

Re: SQL Server script issues with 6.1.4

Post by FredS » Thu 25 Jun 2015 17:48

azyk wrote:We have fixed this problem. This fix will be included in the next UniDAC build.
Please supply an overnight build or better the source changes so I can recompile this.

thanks

Fred

azyk
Devart Team
Posts: 1119
Joined: Fri 11 Apr 2014 11:47
Location: Alpha Centauri A

Re: SQL Server script issues with 6.1.4

Post by azyk » Fri 26 Jun 2015 09:53

The next UniDAC build will be released next week. As soon as it is uploaded, you will be able to download it from our website and install.

Post Reply