Site Sponsored By: SQLDSC - SQL Server Desired State Configuration
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.
I have some data in a field called website3 which looks like this:Skidrive.Co.UkPrinciples.Co.UkAnd basically it should look like this SkidrivePrinciplesIs there any SQL command that i can write which will get rid of everything after and including the '.' if a dot appears in the website3 field.Thanks
harsh_athalye
Master Smack Fu Yak Hacker
5581 Posts
Posted - 2008-01-03 : 06:03:46
[code]declare @a varchar(20)set @a = 'Skidrive.Co.Uk'select left(@a, charindex('.', @a)-1) as stripped_name[/code]Harsh AthalyeIndia."The IMPOSSIBLE is often UNTRIED"
Topaz
Posting Yak Master
199 Posts
Posted - 2008-01-03 : 06:14:52
Hmmm...I cant really see whats going on here, but i probably forgot to mention that there are 40,000 records that need to be updated this way.And from that it looks to me like i will have to enter each matching record?
madhivanan
Premature Yak Congratulator
22864 Posts
Posted - 2008-01-03 : 07:33:32
quote:Originally posted by Topaz Hmmm...I cant really see whats going on here, but i probably forgot to mention that there are 40,000 records that need to be updated this way.And from that it looks to me like i will have to enter each matching record?
Run this and seeSelect left(yourcolumn,charindex('.',yourcolumn)-1) from yourtableMadhivananFailing to plan is Planning to fail