Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
| Author |
Topic |
|
razr
Starting Member
2 Posts |
Posted - 2010-02-22 : 09:05:45
|
| Is there any AS IS script available for converting ISBN10 to ISBN13 into SQL? |
|
|
khtan
In (Som, Ni, Yak)
17689 Posts |
Posted - 2010-02-22 : 10:51:08
|
[code]declare @isbn10 varchar(10), @isbn13 varchar(13), @i int, @chk intselect @isbn10 = '0123456479'select @isbn13 = '978' + left(@isbn10, 9)select @i = 1, @chk = 0while @i <= 9begin select @chk = @chk + (substring(@isbn10, @i, 1) * case when @i % 2 = 1 then 1 else 3 end) select @i = @i + 1endselect @chk = 10 - (@chk % 10)select @isbn13 = @isbn13 + convert(char(1), @chk)select @isbn13[/code] KH[spoiler]Time is always against us[/spoiler] |
 |
|
|
razr
Starting Member
2 Posts |
Posted - 2010-02-22 : 11:46:02
|
| Ty!!Would this cover also ISBN10s with the X char at the end ?for example: 185109606X ? |
 |
|
|
|
|
|