1

I have a pretty large SQL script that has duplicate identities on the database the inserts are taking place on.

If I could increment all ints within the script by say 20 this should get round the issue. I was trying to suss out how to do this in Notepad++ and Textpad but failed miserably.

Was hoping someone may have some suggestions on how I could do this.

Chris Seymour
  • 83,387
  • 30
  • 160
  • 202
JIbber4568
  • 839
  • 4
  • 16
  • 33

2 Answers2

3

It's hard to understand exactly what you are looking for. You could add a zero to the end of every integer with ease. Post an example and I might be able to help more. Notepad++ tricks are one of my favorites.

Enable Regex Searching in Notepad++. 
Search for   :([0-9]*[0-9])
Replace with :\10
( \1 is the value that was found )
DeusAphor
  • 259
  • 1
  • 8
  • Thanks for that. Will give it a go tomorrow. I don't have the script to hand but its essentially lots of the following: INSERT INTO tableName VALUES( 10203, 45 'fdsfs'. gdgdf', 54, 2) – JIbber4568 Dec 10 '12 at 21:18
0

Instead of updating your script, perhaps you can simply decrement your existing DB values by 20 (-20) to be able to run your script as-is. Either way, you'll have to account for changing what might be primary and foreign keys -- and retaining those relationships.

Tim Lehner
  • 14,813
  • 4
  • 59
  • 76