Plz help me:
I have a field serial_number in table tblSerialNo with its type as nchar(10), how can i write an sql query that returns the serial number incremented by one
Loading
Know the answer? Post it — somebody with the same question will find it here.
Sign in to answer this question
It is the same account you read, post and publish with — and you will come straight back to this page.
Jeff BPosted Oct 31, 2012, 2:29 PM
SELECT CAST(serial_number AS INT) + 1 as SerialNumber FROM tblSerialNo;
However if serial_number has any non-numeric data in it, this will throw an error.