Re: MSSQL Insert Problem

2006-10-18 Thread Joseph Amaya
Hello,

1. My procedure is to run the jdbc Ant task
2. Then I change my schema to autoIncrement=true for
my Identity table, it already has primayKey=true
3. Then I run the default task for build-torque
4. I don't set my identity column in my program, but
when I attempt to save I get the TorqueException

Cannot insert explicit value for identity column in
table 'CONTACTS' when IDENTITY_INSERT is set to OFF.

Andaras Says:

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.


__
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



RE: MSSQL Insert Problem

2006-10-18 Thread Greg Monroe
In your schema.xml, try setting the defaultIdMethod 
attribute to native in the database element.  It 
could be that you're trying to use Torque's DB server
independent key generator and this is setting an 
key value for you. E.g.:

database name=bookstore defaultIdMethod=native
...  

 -Original Message-
 From: Joseph Amaya [mailto:[EMAIL PROTECTED] 
 Sent: Wednesday, October 18, 2006 2:46 PM
 To: torque-user@db.apache.org
 Subject: Re: MSSQL Insert Problem
 
 Hello,
 
 1. My procedure is to run the jdbc Ant task
 2. Then I change my schema to autoIncrement=true for
 my Identity table, it already has primayKey=true
 3. Then I run the default task for build-torque
 4. I don't set my identity column in my program, but
 when I attempt to save I get the TorqueException
 
 Cannot insert explicit value for identity column in
 table 'CONTACTS' when IDENTITY_INSERT is set to OFF.
 
 Andaras Says:
 
 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.
 
 
 __
 Do You Yahoo!?
 Tired of spam?  Yahoo! Mail has the best spam protection around 
 http://mail.yahoo.com 
 
 -
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]
 
 

Duke CE Privacy Statement
Please be advised that this e-mail and any files transmitted with it are 
confidential communication or may otherwise be privileged or confidential and 
are intended solely for the individual or entity to whom they are addressed.  
If you are not the intended recipient you may not rely on the contents of this 
email or any attachments, and we ask that you  please not read, copy or 
retransmit this communication, but reply to the sender and destroy the email, 
its contents, and all copies thereof immediately.  Any unauthorized 
dissemination, distribution or copying of this communication is strictly 
prohibited.



-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



MSSQL Insert problem

2006-10-17 Thread Joseph Amaya
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: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]