![]() ![]() I have faced a similar problem so I have developed a below function "char_cut" for informix 11.50 (haven't tried on different versions) Be warn that this is not the most efficient way to do that, but it works fine. # for each record found remember its `id`, split `first_name` and update it: Pstm = prepareStatement("SELECT id, last_name FROM employee WHERE last_name LIKE '%,%') Pu = db.prepareStatement("UPDATE employee SET last_name=?, first_name=? WHERE id=?") If you can use programming language like Java or Python (for this example I use Jython: it is Python that work in Java environment and can use JDBC driver) you can: db = DriverManager.getConnection(db_url, usr, passwd) Sernimir II is where the player first arrives to train as a Reaction Engineer. There are no production assignments on Sernimir II. There are only Research Assignments, here. Welcome to SpaceChem Wiki The wiki About SpaceChem We are currently editing over 258 articles, and you can help. It's appearance is very lunar-like due to numerous craters on its surface. ![]() It hosts laboratories used to train Reaction Engineer Trainees. (you can also use TRIM() to remove spaces before/after comma which will be copied)įrom comments I see that your version of Informix do not have CHARINDEX() function so you must upgrade db engine or use technique other than clean SQL. Sernimir II is the first planet of the game. If you have charindex() function you can do it with: UPDATE employees SET last_name=substring(last_name FROM charindex(',', last_name)+1), first_name=substring(last_name FROM 1 FOR charindex(',', last_name)-1) WHERE charindex(',', last_name) > 0 If you have comma in last_name then in such column there is first and last name and you must split it. If last name is a part of name column then you must search using LIKE which is slower and worse. You probably want to search employees by last name, and it is easy when you simply have such column. At first if you need to split such values and if you need to do it often then it would be easier to change your db schema: ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |