Click here to monitor SSC
SQLServerCentral is supported by Red Gate Software Ltd.
 
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
Author
Message
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: Monday, December 16, 2013 7:19 AM
Points: 98, Visits: 226
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” http://en.wikipedia.org/wiki/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: Tuesday, June 3, 2014 10:13 AM
Points: 2, Visits: 15
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
as
begin
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
end
set @ipNum = (256 * @ipNum) + cast(@segNum as bigint)
return @ipNum
end

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


SSC-Enthusiastic

SSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-Enthusiastic

Group: General Forum Members
Last Login: Monday, July 14, 2014 3:19 AM
Points: 107, Visits: 694
Nice article.

Regards,

Basit A. Farooq (MSC Computing, MCITP SQL Server 2005 & 2008, MCDBA SQL Server 2000)

http://basitaalishan.com
Post #1334390
« Prev Topic | Next Topic »

Add to briefcase «««23456

Permissions Expand / Collapse