Hi,
Working through an extremly simple ORM model, to examine and test the generated custom tool files, I ran into an error when parsing the SQLServer.ddl.
This model has only one facttype: Subject(sprm) has at most one Color(), (Both as VARCHAR 30), and creates one table, and SPs for Insert, Delete and Update.
This is the SP with the error:
CREATE PROCEDURE Simple.UpdateSubjectColor
(
@Color NATIONAL CHARACTER VARYING(30)
)
AS
UPDATE Simple.Subject
SET Color = Color
WHERE sprm = @sprm
GO
This is the error msg:
Msg 137, Level 15, State 2, Procedure UpdateSubjectColor, Line 10
Must declare the scalar variable "@sprm".
It's obvious that though @Color was delcared in the SP, @sprm was not (though it was in other SPs).
So, should the DDL include the declaration for this variable? Should the declarations for SPs be done in CREATE TABLE? Should gobal variables be used, rather than local?
Looks like the SQLServer.ddl is the only one that uses variables (I had generated the scripts for the other targets for the same model for comparison).
I didn't expect to hit something like this on so simple a test model. Does the very simplicity of the test (single fact, single table), cause the error?
One related question: I noticed that the SQLServer.ddl does not start with a Begin/Start Transaction - or end with a Commit. Is this due to SQL Server 2005, or the DDL script generation? It would seem that doing the CREATE SCHEMA as a transaction would be better, if there was an error in executing the script.
Thanks BRN..