To reset your autoincrement number, you can simply run the following SQL:
ALTER TABLE 'table_name' AUTO_INCREMENT = X
Where X is the ID number you want to set the increment start point to, so running
ALTER TABLE 'table_name' AUTO_INCREMENT = 0
resets the ID increment process, and
ALTER TABLE 'table_name' AUTO_INCREMENT = 1023
Would set the start seed to 1023 - sometimes useful for making things looked "used", for example with order systems.
Showing posts with label SQL. Show all posts
Showing posts with label SQL. Show all posts
Thursday, 31 December 2009
Wednesday, 24 June 2009
SQL Server Cannot resolve collation conflict for equal to operation.
Today I migrated an exisiting set of tables from one database, to a new database, to isolate their work.
After copying all the stored procs, views, tables and data, one of my stored procs wouldn't run.
Everytime I tried to execute it, I got the error:
"Cannot resolve collation conflict for equal to operation."
It transpires that this error can be caused by many different problems, butt he main one being that the collation types for the columns being joined in the sql statement is different.
In my instance this was not the case, but by telling the columns to use the databases default collation on either side of the join fixed the problem - e.g.
SELECT table1.*, table2.* FROM table1
INNER JOIN table2 ON table1.column1 COLLATE DATABASE_DEFAULT = table2.column1 COLLATE DATABASE_DEFAULT
After copying all the stored procs, views, tables and data, one of my stored procs wouldn't run.
Everytime I tried to execute it, I got the error:
"Cannot resolve collation conflict for equal to operation."
It transpires that this error can be caused by many different problems, butt he main one being that the collation types for the columns being joined in the sql statement is different.
In my instance this was not the case, but by telling the columns to use the databases default collation on either side of the join fixed the problem - e.g.
SELECT table1.*, table2.* FROM table1
INNER JOIN table2 ON table1.column1 COLLATE DATABASE_DEFAULT = table2.column1 COLLATE DATABASE_DEFAULT
Subscribe to:
Posts (Atom)