Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Update Table problem!

Status
Not open for further replies.

NavMen

Vendor
Jul 6, 2004
35
NL
Hi,

I try to update a table with the following query, the ShPath string is coming from a external source

UPDATE SHARES SET group='0' WHERE servername='SRV01' and ShPath = 'C:\USERS_100\'

But the ShPath has the entry C:\USERS_100 how can I remove the \ behind the C:\USERS_100\

Thanks,

Navmen
 
I'd have a look at the Left() function to start with.

Hope this helps

HarleyQuinn
---------------------------------
The most overlooked advantage to owning a computer is that if they foul up there's no law against wacking them around a little. - Joe Martin

Get the most out of Tek-Tips, read FAQ222-2244 before posting.
 
Code:
UPDATE SHARES SET group='0' WHERE servername='SRV01' and ShPath = right('C:\USERS_100\',len('C:\USERS_100\')-1)
 
You mean Left()?

Your posted code returns :\USERS_100\...

HarleyQuinn
---------------------------------
The most overlooked advantage to owning a computer is that if they foul up there's no law against wacking them around a little. - Joe Martin

Get the most out of Tek-Tips, read FAQ222-2244 before posting.
 
How about this:

Code:
UPDATE SHARES SET group='0' WHERE servername='SRV01' and ShPath like 'C:\USERS_100%'
 
Maswien - I don't think he should use the LIKE operator because it will update records where ShPath = 'C:\USERS_10099', or 'C:\USERS_100_abc\xyz\ufo\', etc.

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top