I have an old SQL database (Microsoft's SQL Server) with thousands of rows that contains data as follows:
ID urlString
1 page.aspx?pageID=34
2 page.aspx?pageID=163
3 page.aspx
4 page.aspx?pageID=23
I've added a new column (pageID) to the database. I want to create an UPDATE query to copy the pageID from the URLstring and insert it in the new column (pageID) as follows. If there is no pageID I want to add 0. How can I accomplish that?
ID URLstring pageID
1 page.aspx?pageID=34 34
2 page.aspx?pageID=163 163
3 page.aspx 0
4 page.aspx?pageID=23 23