EXEC sp_renamedb 'old_db_name', 'new_db_name'
Some Classic ASP in VBScript and SQL Server tips, flavored with rhetorical rants, commentary and other useless blather.
Tuesday, May 22, 2007
Tuesday, March 27, 2007
Changing Table Owner in SQL Server
To change the owner of a table in SQL Server, open query analyzer, make sure you are in the database containing the table whose owner you want to change, and execute the following stored procedure:
sp_changeobjectowner 'TableName' , 'OwnerName'
Where:
TableName is the name of the table
OwnerName is the name of the account you want to assign ownership to
You can actually use this to change the ownership of any object in the database....
Monday, February 12, 2007
Money Making on the Web - Affiliate Marketing
For those of you who don't know, affiliate marketing is a method of promoting web businesses in which you are rewarded for every visitor, subscriber, customer, and/or sale you drive through your efforts. So it's sort of like traffic directing - you send the traffic, and if the custoemr completes a transaction, be it a sale or sign up, you get a cut.
Merchants like affiliate marketing because it's "pay for performance", meaning the merchant doesn't pay anything unless there are results. Some merchants run their own affiliate programs while others use third party services like Linkshare, Commission Junction, or Performics for tracking.
At it's most basic level, it works like this: You build a site about widgets becasue you collect them. You talk about them and rate them and, on your review pages, you proviode an affiliate link to a store that sells widgets. If any visitors to your website click throguh that special link and buy a widget, you get paid. Sweet.
Getting started with an affiliate program is easier than you think. Just head over to Amazon and sign up (it's called their Associates program). Then, on your blog write a review of a book you just read or a DVD movie you just watched. Amazon makes it simple to look up that product and drop in a bit of JavaScript code that will put an image of the book or movie up along with a coded link. Visitors pour into your site, read your glowing review, and hasten over to Amazon (through your link) and snap up the book. Viola! Instant Taco Bell money!
Stay tuned for more advanced money making conversations....
Friday, February 09, 2007
Some of My Sites
I’ve been pretty lax about adding new stuff to the site. I’ll try to change that. A few encouraging emails have convinced me at least more than on person is reading this thing.
It also occurred to me that visitors might be interested in seeing some of my projects. All the new ASP work I do nowadays is for my own personal projects, At work, we are on .Net 2.0. I cracked my first book this week, having finally decided that if I want to keep my job, I better get caught up!
Anyway…. Here are a few of my sites, some new, some old. WARNING: I’m a programmer, not a graphic designer! Try not to vomit on your keyboard.
http://www.sfreader.com/ – this is a book review site for science fiction, fantasy and horror. It was my first ASP site and the one I used to teach myself programming. It launched in 2000. It’s grown a lot since then, with the addition a few years back of a forum that has become quite popular with SF fans and writers. It started on Access, but about a year back I finally ported it over to SQL. It gets about 500 visitors a day and remains my most popular (though one of my lowest earning) sites. You can get a free web page if you are a writer or fan of SF. I run an annual short story contest with cash prizes, and the Mother of All Speculative Fiction Directories is slowly getting bigger. It’s a fun site and I get all the free books I can read from the publishing companies!
http://www.yawds.com/ – my take on a directory site. I used some cool
http://www.ishophq.com/ – the mother of my price comparison sites. This one pulls from ALL the products in my database, which is populated with data feed inventory from over 40 merchants. For a while there, this and the niche site where doing REALLY well. Not so well any more…. Stupid search engines…. When I noticed a particular product doing well (like duvets for example), I’d break that product out into its own site (http://www.treadmillhq.com/). I’ve got about 50 of them, but they are slowly expiring. Since the SERP debacle, some of them didn’t even earn back the $9.20 I paid to GoDaddy to register the name! My first SQL server site. I taught myself how to use full text indexing and how to write stored procedures with this one.
http://www.nutribody.com/ – great domain name, sucky site. Pulls from the iShopHQ database. Someday I might do something worthwhile with it. Still pulls about 200 visitors a day, but I don’t know what they do there. They obviously aren’t buying anything….
So those are a few. I’ve got a ton of others, but they are all iShopHQ niche product knock-offs. The CPA and CPL I’m doing with Freetastic has given me a lot of great marketing ideas though, so I’m not done yet! I might post a little here about it, even though it’s not really ASP related.
Thursday, January 18, 2007
Form Field Focus On Page Load
In any case, here's another (hopefully) useful tip; how to get the curser to be in a form field on a page load. I find it especially useful for admin type pages that require a log in. You can have everything ready to go for the user to just start typing.
In this example, your form would look like this:
<BODY onLoad="document.forms.MyForm.UserName.focus()">
<form method="post" name="MyForm" action="YourActionPage.asp">This is a simple log in form with two fields: UserName and Password. In this example, when the page loads, the cursor will be placed in the UserName field.
<input type="text" name="UserName" size="15">
<input type="text" name="Password" size="15">
<input type="submit" value="Search">
</form>
Remember! JavaScript is case sensitive!
Sunday, December 03, 2006
Free Online Keyword Research Tools
Google AdWords Keyword Tool, Keyword Sandbox Tool Good tool but it's Google after all, so keep in mind that you and everyone else on the planet is using it.
MIVA Keyword Generator Note this is from the UK, so spellings might be non-USA
Overture Keywords Suggestion Tool Same problem here as with Google - any keywords you generate here will probably not be unique. Also somewhat of a pain, because it it alphabetizes the keyword varients it returns. So "cheap tennis racket" varients ceom out as "cheap racket tennis", "american express credit card" varients come out as "american card credit express" etc. Annoying
Search Engine Keyword Tracker & Keyword Ranking Tool This on is hand because it generates some Wordtracker words as well as the Overture ones. That's what I use it for. For some reason, the Overture lookup here sometimes seems to be faster than the actual Overture site.
7Search Keyword Suggestion Tool. Brings back 100 at a time. Good varients here.
The Miva and 7Search tools are pretty good, and probably not as widely used as the Google and Overture tools. I tend to use them for my main research and then augment with Google and Overture.
I'm pretty sure Microsoft has one too, but I can't find a link to it. Maybe you have to be an adCenter user to get access....
Monday, November 13, 2006
Geek Babe Monday - Jessica Alba
Alba knew she wanted to be an actress since the age of 5. Her first film role, in the 1994 film Camp Nowhere, came her way by chance. After one of the characters dropped out of the production, dark-haired Jessica was cast as the replacement, thanks to the fact that her hair matched that of the original actress. She then ventured onto the small screen, with commercials for Nintendo and J.C. Penney, and a recurring role in Nickelodeon's The Secret World of Alex Mack.
Following Nickelodeon, Jessica was cast as Maya in the 1995 series Flipper. While working with dolphins on the television series, Jessica was cast in the disastrous film Venus Rising, as well as the 1996 made-for-TV movie Too Soon for Jeff and an episode of Chicago Hope.
1998 was filled with television appearances, including a recurring role on the primetime soap Beverly Hills, 90210, Brooklyn South and The Love Boat: The Next Wave. As for film, audiences could catch Jessica in P.U.N.K.S. (aka Rebels), Never Been Kissed, and Idle Hands.
With Jessica's growing popularity and her exotic looks, it's no wonder that James Cameron cast her as the lead role in his television series, Dark Angel.
![]() | ![]() |
2007 promises to be a busy year. Jessica will be seen in a slew of movies: Saw IV, The Eye, Sin City 2, Fantastic Four: Rise of the Silver Surfer, Good Luck Chuck, Awake, Bill, and The Ten. Whew!
Friday, November 10, 2006
Counting Active Users in ASP
<script language=vbScript runat=server>The, on any page you want to display the count, put
sub session_onStart()
application.lock()
application("SCount") = application("SCount") + 1
application.unlock()
end sub
sub session_onEnd()
application.lock()
application("SCount") = application("SCount") - 1
application.unlock()
end sub
sub application_onStart()
' don't need a lock in onStart()
application("SCount") = 0
end sub
</script>
<%This method isn't 100% accurate and does have a few pitfalls:
Response.Write "Users Online: application("SCount")
%>
It creates a "hotspot" during application.lock() that can cause delays when a new visitor arrives
You have no control over whether users launching new windows will trigger new sessions which will increment the count
You are constantly holding and modifying an application variable in memory, though you rarely use it
You need a modified copy of global.asa for each application, and have to aggregate different sites/applications separately
Nevertheless, for a quick and easy and mostly accurate way to count the number of active sessions, this will work.
Tuesday, November 07, 2006
Errors When Trying to do Response.Redirect
Response object error 'ASP 0159: 80004005'When calling response.redirect, you have to execute it BEFORE any client-side code, including the opening <html> tag.
Header Error. The HTTP headers are already written to the client browser.
Any HTTP header modifications must be made before writing page content.
This usually isn't a problem in IIS 6 (Server 2003) because in IIS 6 the default setting for Response.Buffer is True by default. This means the server holds the page content until it's all ready to go and then sends it to the client. If Response.Buffer is set to True, you can call Response.Redirect anytime before the page is complete and it will work.
In older versions of IIS, Response.Buffer is set to False by default. This means content gets sent to the client as the page is executing. In this scenario, you'll get an error if you try to execute Response.Redirect anytime after content has been sent.
The fix? If you're in a version of IIS older than IIS 6, set Response.Buffer = True at the top of the page.
Another error you can get when using Response.Redirect is Object Moved. One way to prevent this from happening is using Response.Clear first (note that buffering must be enabled). At the top of the page:
Response.Buffer = trueBefore you call Response.Redirect:
Response.Clear
Response.Redirect "http://www.domain.com"
Monday, November 06, 2006
Geek Babe Monday - Erin Gray
This is a late post, since I was a little under the weather yesterday and didn't make time to post. Missed last week too....
This post might more rightly be called Retro Geek Babe Monday. Erin Gray was one of the first models to successfully crossover into television. She is best known as "Kate Summers" on the highly watched TV show "Silver Spoons" (1982), and (the reason for her status as a Geek Babe) Colonel Wilma Deering on the TV show "Buck Rogers in the 25th Century" (1979).
![]() | ![]() |
Erin Gray was born on January 7, 1950 in Honolulu. Gray moved with her family from Hawaii to California when she was eight years old and graduated from Pacific Palisades High School. She was fifteen when a chance meeting with Nina Blanchard, head of one of Hollywood's top model agencies, convinced her what she wanted to do in life.
Moving to New York, she became one of the town's most sought-after models, in elite company with Farrah Fawcett, Veronica Hamel and Susan Blakely. TV viewers encountered her commercials for Breck, Max Factor, Clairol, Camay Soap and RC Cola, and a classic spot for English Leather cologne in which she provocatively delcared, "My men wear English Leather - or they wear nothing at all!"
Between modeling assignments, she studied acting with well-known coach Warren Robertson and when movie-TV offers came in, she was ready. Universal was impressed by her performances on such series as "Police Story" and "Gibbsville" and signed her to a seven-year contract. Under that pact, the studio co-starred her as a tough-minded newspaper reporter in Irwin Shaw'sEvening in Byzantium (1978) (TV).
Her performance scored with both critics and audiences, and led directly to the role in "Buck Rogers in the 25th Century" (1979). As a result, she has become a regular commuter between Hollywood and New York, the hub of the magazine and fashion world.



