db-torque-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Andras Balogh <and...@reea.net>
Subject Re: MSSQL Insert problem
Date Wed, 18 Oct 2006 08:52:26 GMT
Hello,

    I have used torque with mssql successfully.
What is not clear to me why you want to insert in the identity column.
Did you declare the column in the schema as primaryKey="true" 
autoIncrement="true" ?
If yes than Torque should do the insert into your CONTACTS table 
correctly and even read the new value
of the column after insert.

Best regards,
Andras.

Joseph Amaya wrote:
> I'm getting this error whenever I try to insert into
> my identity table through my website.
>
> Cannot insert explicit value for identity column in
> table 'CONTACTS' when IDENTITY_INSERT is set to OFF.
>
> Supposedly you add:
>  
> "SET IDENTITY_INSERT <table>  ON
> ...........
> SET IDENTITY_INSERT <table>  OFF"
>  
> around your generated Insert statement, but I'm not
> sure where, I was thinking I should add to my row.vm
> located in templates/sql/load/mssql but this doesn't
> work. What is the exact syntax needed if this is
> correct? My row.vm follows. 
>
> This generated sql wasn't created by me, although I
> don't think it was through the datasql task.
>
> I was thinking of running datasql, the Ant task, to
> see what sql it generated, but I would need to run
> datadump first and my database is too large.  
>
> ------------------
> row.vm
>
> INSERT INTO $row.Table.Name (##
> #set ($comma="")#foreach($col in
> $row.ColumnValues)$comma${col.Column.Name}#set($comma=",")#end)
>     VALUES (#set ($comma="")#foreach($col in
> $row.ColumnValues)$comma${generator.parse("sql/load/mssql/val.vm",
> "", "column", $col)}#set ($comma=",")#end);
>
>
>
> __________________________________________________
> Do You Yahoo!?
> Tired of spam?  Yahoo! Mail has the best spam
> protection around 
> http://mail.yahoo.com 
>
> __________________________________________________
> Do You Yahoo!?
> Tired of spam?  Yahoo! Mail has the best spam protection around 
> http://mail.yahoo.com 
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: torque-user-unsubscribe@db.apache.org
> For additional commands, e-mail: torque-user-help@db.apache.org
>
>   


---------------------------------------------------------------------
To unsubscribe, e-mail: torque-user-unsubscribe@db.apache.org
For additional commands, e-mail: torque-user-help@db.apache.org


Mime
View raw message