Click here to monitor SSC
SQLServerCentral is supported by Redgate
Log in  ::  Register  ::  Not logged in
Home       Members    Calendar    Who's On

Add to briefcase «««23456

Map IP Address to a Geographical Location Expand / Collapse
Posted Friday, July 20, 2012 8:14 AM
SSC Journeyman

SSC JourneymanSSC JourneymanSSC JourneymanSSC JourneymanSSC JourneymanSSC JourneymanSSC JourneymanSSC Journeyman

Group: General Forum Members
Last Login: Tuesday, January 6, 2015 2:38 PM
Points: 98, Visits: 227
Jeff Moden (4/18/2010)
I'm asking because I'd really like to quit.

And, you're correct. I quit twice for a year each and once for 3 months and not sure why I went back to it other than I like it and just wanted "one". The old saying holds true... "You're a puff away from a pack a day."

It took me about a dozen tries to quit. Here is what worked for me:
First and foremost, I cut out caffeine. Think about it, a nicotine fit looks just like being over-caffeinated.

Second, after the taper down phase, on my quit date, I intentionally changed my self image to a non-smoker. Post signs on the bathroom mirror, the refrigerator, in your car, in your cubicle, etc. As you go to sleep at night create a mental image of yourself as a non-smoker. Maybe on a tropical beach, maybe wearing white at a party with beautiful women all wearing white, whatever works for you.

Then when I felt a craving for a cigarette I would laugh at myself "don't be silly, you are a non-smoker." Nicotine is like the alien being in “Day of the Dove” feeding on your negative emotions. Laughing at it drives it away, stressing over it feeds it.

Good luck. As others have said you are a very special person and a major resource to many of us. It would be a shame to lose you before your time.

Anyway, back to the topic, I am trying to remember if anyone tested PARSENAME vs using a Tally Table. In this instance the tally table would only need to be 15 rows.
Post #1332997
Posted Friday, July 20, 2012 2:04 PM
Forum Newbie

Forum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum Newbie

Group: General Forum Members
Last Login: Thursday, June 4, 2015 7:39 AM
Points: 3, Visits: 16
PARSENAME is a rEaLLy great tool here. Here's another way that isn't nearly as esthetically pleasing but is probably faster, just because it doesn't parse the string four times. In CLR form it would cook...

create function dbo.ConvertIp2NumC(@ipAddr nvarchar(15))
returns bigint
declare @ipPos int, @ipLen int, @ipChar nchar(1), @segNum int, @ipNum bigint
set @segNum = 0
set @ipPos = 1
set @ipNum = 0
set @ipLen = len(isnull(@ipAddr, ''))
while @ipPos <= @ipLen begin
set @ipChar = substring(@ipAddr, @ipPos, 1)
if @ipChar = '.' begin
set @ipNum = (256 * @ipNum) + cast(@segNum as bigint)
set @segNum = 0
end else
set @segNum = (10 * @segNum) + cast(@ipChar as int)
set @ipPos = @ipPos + 1
set @ipNum = (256 * @ipNum) + cast(@segNum as bigint)
return @ipNum

Post #1333222
Posted Tuesday, July 24, 2012 5:20 AM



Group: General Forum Members
Last Login: Tuesday, December 6, 2016 8:57 AM
Points: 137, Visits: 792
Nice article.


Basit A. Farooq (MSC Computing, MCITP SQL Server 2005 & 2008, MCDBA SQL Server 2000)
Post #1334390
« Prev Topic | Next Topic »

Add to briefcase «««23456

Permissions Expand / Collapse