We need to change the url to images and some links, to remove "/nameofsite/" from the beginning of the url, so it starts with "/" instead. Has anyone done this using some sort of SQL script, instead of looping through all the pages and publishing through code (since this creates a new version of the page)?
It's an EPiServer CMS 6.
It has been done but I can't remember seeing any ready-to-go script on it, maybe support has one. You'll have to work with tblProperty.String,tblProperty.LongString,tblWorkProperty.String,tblWorkProperty.LongString and do your SQL magic on those columns. If you forget the "Work" tables you will get back the old URL's whenever an editor starts pushing out new content. Hope that help you to get started anyway. Be careful though so you don't mess up the content ;-)