[thelist] Increment every value in table (MySQL)

Chris Price chris.price at choctaw.co.uk
Tue Jan 6 10:27:33 CST 2009


Thanks. I've not come across cursors before so that'll be interesting. 
I'll try it out.

Samuel Warren wrote:
> Jason,
> not all database structures require a parent/child relationship which
> necessitates foreign keys.
> Chris,
> I'm sure what your looking for can be done, probably with a cursor
> (unfortunately).
> Basically This query will give you the column names:
> SELECT name FROM syscolumns
> WHERE id = (SELECT id FROM sysobjects
> WHERE name= '<TableName>')
> ORDER by colorder;
> If you drop those names into a cursor you should be able to use them to run
> out Update queries from there. Never done it before, but I'm pretty sure
> it's possible.


Kind Regards

  Chris Price

chris.price at choctaw.co.uk <mailto:chris.price at choctaw.co.uk>
www.choctaw.co.uk <http://www.choctaw.co.uk>

Tel. 01524 825 245
Mob. 0777 451 4488

Beauty is in the Eye of the Beholder while
Excellence is in the Hand of the Professional


 >> Sent on behalf of Choctaw Media Ltd <<


Choctaw Media Limited is a company registered in
England and Wales with company number 04627649

Registered Office: Lonsdale Partners, Priory Close,
St Mary's Gate, Lancaster LA1 1XB . United Kingdom

More information about the thelist mailing list