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 |
|
nlinecomputers
Starting Member
17 Posts |
Posted - 2007-06-22 : 22:51:38
|
I need someone that knows something about SQL queries.I have a client that is running a Database known as ProLaw. It is in part adocument management system for Law Offices.They have an SQL 2005 database that tracks per client all the documents theycreate.We had to replace there server with new server. The new server is runningsbs2003 and had to have a different Netbios name then the old sbs2000server. (Small Bus. Server has some weird quirks that make simply using thesame netbios name impossible. Google search it if you don't believe me.)The database holds in a single column the full network share path to eachdocument.A document for example may have had a path of "\\lawwillsbs2000\Prolaw\Documents\ACME wigets Inc\smith_deposition.doc"Different documents may have different names and more subdirectories but theroot path of "\\lawwillsbs2000\Prolaw\Documents\" is shared by all.The new server is named \\sbs2003 I need to changethe first part of almost 3000 path statements to the new server. The restof the path is unchanged.I have had several people running prolaw tell me that I should run thisquery:UPDATE EventsSET DocDir=REPLACE(DocDir, '\\\\lawwillsbs2000', '\\\\sbs2003')WHERE EventKind='O' This doesn't work. Nothing is changed. I'm guessing it is because thisquery assumes the value will be ONLY \\lawwillsbs2000 I see nothing in here that tells the query that this is only part of the string. No wild card or other marker. I need some kind of string function here do I not? Anyone know enough tohelp me craft a proper query?ThanksNathan Williams |
|
|
madhivanan
Premature Yak Congratulator
22864 Posts |
Posted - 2007-06-23 : 01:28:39
|
| If all the strings start with \\lawwillsbs2000, you can trySelect '\\sbs2003'+substring(DocDir,17,len(DocDir)) from EventsIf the above select gives what you want then you can run UpdateUpdate EventsSet DocDir='\\sbs2003'+substring(DocDir,17,len(DocDir))MadhivananFailing to plan is Planning to fail |
 |
|
|
nlinecomputers
Starting Member
17 Posts |
Posted - 2007-06-25 : 18:23:55
|
| Thanks, that did the trick! Now I just need to learn the syntax of that command so I don't have to beg for help for this kind of thing again. |
 |
|
|
madhivanan
Premature Yak Congratulator
22864 Posts |
Posted - 2007-06-26 : 01:17:58
|
quote: Originally posted by nlinecomputers Thanks, that did the trick! Now I just need to learn the syntax of that command so I don't have to beg for help for this kind of thing again.
Thats good anyway MadhivananFailing to plan is Planning to fail |
 |
|
|
|
|
|