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.

 All Forums
 SQL Server 2000 Forums
 Transact-SQL (2000)
 Update Question

Author  Topic 

cre8tor
Starting Member

7 Posts

Posted - 2002-10-07 : 10:11:35
I have a column with the following sample data
192.15.180.67#http://192.15.180.67#
192.15.180.750#http://192.15.180.50#
and so on...

I need to update the values with only the
information from the left of the first # so they appear like this:
167.15.180.67
167.15.180.750

Could someone help with the query to accomplish this?

Thanks,





Edited by - cre8tor on 10/07/2002 10:29:41

setbasedisthetruepath
Used SQL Salesman

992 Posts

Posted - 2002-10-07 : 10:24:40
Use CHARINDEX() and LEFT().

Jonathan
{0}
Go to Top of Page

lozitskiy
Starting Member

28 Posts

Posted - 2002-10-07 : 16:37:46
Some code as example:

declare @str varchar(60)
set @str='192.15.180.67#http://192.15.180.67#'

if charindex('192.15.180.67',@str)>0 and charindex('192.15.180.67',@str)<charindex('#',@str)
print 'For update'
else
print 'No update'

-------------
MCP MSSQL
Go to Top of Page
   

- Advertisement -