[sqlalchemy] Re: ms sql server schema.sequence
Thanks a lot, this is the information I am looking for! -- You received this message because you are subscribed to the Google Groups "sqlalchemy" group. To post to this group, send email to sqlalch...@googlegroups.com. To unsubscribe from this group, send email to sqlalchemy+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/sqlalchemy?hl=en.
Re: [sqlalchemy] Re: ms sql server schema.sequence
Hello Tan, On Mar 16, 2010, at 7:57 PM, Tan Yi wrote: > I mean, I tried to debug a program, using session add() to insert new > records to database after I deleted all the old records from a table. > I used the schema.sequence() to build up a mapper > Can anyone help? > > On 3月16日, 下午2时05分, Tan Yi wrote: >> Whenever I try to use schema.sequence() function on ms sql server, the >> return serial number (after flush()) is not started from 0, instead, >> it is started from a random number or something. >> wondering how to work aroud this issue. try to specify start = 0 in >> sequence function, but no luck With MSSQL whenever you delete records from a table it does not reset the IDENTITY. If you would like the identity to reset back to one (zero is not an option), then you need to truncate the table with: TRUNCATE TABLE tablename; If this is not the issue then it might be helpful if you provide a test case that demonstrates the issue you are having. It will be easier to diagnose that way. Michael -- You received this message because you are subscribed to the Google Groups "sqlalchemy" group. To post to this group, send email to sqlalch...@googlegroups.com. To unsubscribe from this group, send email to sqlalchemy+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/sqlalchemy?hl=en.
[sqlalchemy] Re: ms sql server schema.sequence
I mean, I tried to debug a program, using session add() to insert new records to database after I deleted all the old records from a table. I used the schema.sequence() to build up a mapper Can anyone help? On 3月16日, 下午2时05分, Tan Yi wrote: > Whenever I try to use schema.sequence() function on ms sql server, the > return serial number (after flush()) is not started from 0, instead, > it is started from a random number or something. > wondering how to work aroud this issue. try to specify start = 0 in > sequence function, but no luck -- You received this message because you are subscribed to the Google Groups "sqlalchemy" group. To post to this group, send email to sqlalch...@googlegroups.com. To unsubscribe from this group, send email to sqlalchemy+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/sqlalchemy?hl=en.