SoftTree Technologies SoftTree Technologies
Technical Support Forums
RegisterSearchFAQMemberlistUsergroupsLog in
Error on CRUD Option

 
Reply to topic    SoftTree Technologies Forum Index » SQL Assistant View previous topic
View next topic
Error on CRUD Option
Author Message
crashman



Joined: 16 Oct 2009
Posts: 8
Country: Guatemala

Post Error on CRUD Option Reply with quote
SQL Server 2012 express instance

Code:
29/08/2012 10:16:00 a.m.   Start Code Generator "SQL Server CRUD Procedures Template"
29/08/2012 10:16:00 a.m.   Process table [dbo].[VntTable]
29/08/2012 10:16:00 a.m.   Error: A database error occurred while executing the following code:
CREATE PROCEDURE [dbo].[p_DeleteVntTable]
/***********************************************************
* Code generated by SoftTree SQL Assistant © v6.2.112
*
* Procedure description: This procedure is used for
*                        deleting records from table
*                        VntTable
* Date:   29/08/2012
* Author: haverramirez
*
* Changes
* Date        Modified By            Comments
************************************************************
* 29/08/2012  Initial version
*...

Errors:
Msg 102, Level 15, State 1, Proc "p_DeleteVntTable",    Incorrect syntax near ')'.
Msg 156, Level 15, State 1, Proc "p_DeleteVntTable",    Incorrect syntax near the keyword 'SELECT'.
29/08/2012 10:16:00 a.m.   Error: A database error occurred while executing the following code:
CREATE PROCEDURE [dbo].[p_GetVntTable]
/***********************************************************
* Code generated by SoftTree SQL Assistant © v6.2.112
*
* Procedure description: This procedure is used for
*                        retrieving records from table
*                        VntTable
* Date:   29/08/2012
* Author:
*
* Changes
* Date        Modified By            Comments
************************************************************
* 29/08/2012  Initial version
**...

Errors:
Msg 102, Level 15, State 1, Proc "p_GetVntTable",    Incorrect syntax near ')'.
Msg 156, Level 15, State 1, Proc "p_GetVntTable",    Incorrect syntax near the keyword 'SELECT'.
29/08/2012 10:16:00 a.m.   Error: A database error occurred while executing the following code:
CREATE PROCEDURE [dbo].[p_SaveVntTable]
/***********************************************************
* Code generated by SoftTree SQL Assistant © v6.2.112
*
* Procedure description: This procedure is used for adding
*                        and updating records in table
*                        VntTable
* Date:   29/08/2012
* Author: haverramirez
*
* Changes
* Date        Modified By            Comments
************************************************************
* 29/08/2012  haverramirez     Initial ve...

Errors:
Msg 134, Level 15, State 1, Proc "p_SaveVntTable",    The variable name '@id' has already been declared. Variable names must be unique within a query batch or stored procedure.
Msg 102, Level 15, State 1, Proc "p_SaveVntTable",    Incorrect syntax near ')'.
Msg 156, Level 15, State 1, Proc "p_SaveVntTable",    Incorrect syntax near the keyword 'ELSE'.
Msg 156, Level 15, State 1, Proc "p_SaveVntTable",    Incorrect syntax near the keyword 'END'.
29/08/2012 10:16:00 a.m.   End Code Generator


the table

Code:
CREATE TABLE [dbo].[VntTable](
   [ID] [int] IDENTITY(1,1) NOT NULL,
   [Codig] [varchar](50) NOT NULL,
   [Descripcion] [varchar](50) NOT NULL
) ON [PRIMARY]

Wed Aug 29, 2012 12:19 pm View user's profile Send private message
SysOp
Site Admin


Joined: 26 Nov 2006
Posts: 7849

Post Reply with quote
It won't work for this table. In order to generate CRUD procedures, a table must have primary key or unique constraint defined. Please add primary key for [ID] column and try again.
Wed Aug 29, 2012 2:34 pm View user's profile Send private message
crashman



Joined: 16 Oct 2009
Posts: 8
Country: Guatemala

Post Reply with quote
The Same

Code:
30/08/2012 08:04:52 a.m.   Start Code Generator "SQL Server CRUD Procedures Template"
30/08/2012 08:04:52 a.m.   Process table [dbo].[SEG_USUARIO]
30/08/2012 08:04:52 a.m.   Created object from template: Delete
30/08/2012 08:04:52 a.m.   Created object from template: Get
30/08/2012 08:04:52 a.m.   Error: A database error occurred while executing the following code:
CREATE PROCEDURE [dbo].[p_SaveSEG_USUARIO]
/***********************************************************
* Code generated by SoftTree SQL Assistant © v6.2.112
*
* Procedure description: This procedure is used for adding
*                        and updating records in table
*                        SEG_USUARIO
* Date:   30/08/2012
* Author:
*
* Changes
* Date        Modified By            Comments
************************************************************
* 30/08/2012  Init...

Errors:
Msg 134, Level 15, State 1, Proc "p_SaveSEG_USUARIO",    The variable name '@id' has already been declared. Variable names must be unique within a query batch or stored procedure.
30/08/2012 08:04:52 a.m.   End Code Generator


table

Code:
CREATE TABLE [dbo].[SEG_USUARIO](
   [ID] [int] IDENTITY(1,1) NOT NULL,
   [Usuario] [varchar](100) NOT NULL,
   [Contrasenia] [varchar](10) NOT NULL,
   [Perfil] [int] NOT NULL,
 CONSTRAINT [PK_SEG_USUARIO] PRIMARY KEY CLUSTERED
(
   [ID] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY]


[/code]
Thu Aug 30, 2012 10:07 am View user's profile Send private message
SysOp
Site Admin


Joined: 26 Nov 2006
Posts: 7849

Post Reply with quote
No, it's not the same. It works now with the exception of p_SaveXXXXX procedure because the template for the "save" procedure contains predefined variable name @ID that accidentally matches one of the column names in your table. To make it work for your table, open SQL Assistant's Options dialog, select Code Generator tab, then select Save template on the left. On the right, in the template code locate @id INT and change it to @SCOPE_IDENTITY INT. Save changes and run Bulk Code Generator again.
Thu Aug 30, 2012 10:50 am View user's profile Send private message
crashman



Joined: 16 Oct 2009
Posts: 8
Country: Guatemala

Post Reply with quote
IT WORKS !!! thanks,
Thu Aug 30, 2012 1:39 pm View user's profile Send private message
Display posts from previous:    
Reply to topic    SoftTree Technologies Forum Index » SQL Assistant All times are GMT - 4 Hours
Page 1 of 1

 
Jump to: 
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


 

 

Powered by phpBB © 2001, 2005 phpBB Group
Design by Freestyle XL / Flowers Online.