Search all tables in a database

Search all text fields across all tables in a database. Taken from http://vyaskn.tripod.com/ –To search all columns of all tables in Pubs database for the keyword “Computer” EXEC SearchAllTables ‘Computer’ GO


CREATE PROC SearchAllTables ( @SearchStr nvarchar(100) )
AS BEGIN

-- Copyright © 2002 Narayana Vyas Kondreddi. All rights reserved.
-- Purpose: To search all columns of all tables for a given search string
-- Written by: Narayana Vyas Kondreddi
-- Site: http://vyaskn.tripod.com
-- Tested on: SQL Server 7.0 and SQL Server 2000
-- Date modified: 28th July 2002 22:50 GMT

CREATE TABLE #Results (ColumnName nvarchar(370), ColumnValue nvarchar(3630))

SET NOCOUNT ON

DECLARE @TableName nvarchar(256), @ColumnName nvarchar(128), @SearchStr2 nvarchar(110)
SET @TableName = ''
SET @SearchStr2 = QUOTENAME('%' + @SearchStr + '%','''')

WHILE @TableName IS NOT NULL
BEGIN
SET @ColumnName = ''
SET @TableName =
(
SELECT MIN(QUOTENAME(TABLE_SCHEMA) + '.' + QUOTENAME(TABLE_NAME))
FROM INFORMATION_SCHEMA.TABLES
WHERE TABLE_TYPE = 'BASE TABLE'
AND QUOTENAME(TABLE_SCHEMA) + '.' + QUOTENAME(TABLE_NAME) > @TableName
AND OBJECTPROPERTY(
OBJECT_ID(
QUOTENAME(TABLE_SCHEMA) + '.' + QUOTENAME(TABLE_NAME)
), 'IsMSShipped'
) = 0
)

WHILE (@TableName IS NOT NULL) AND (@ColumnName IS NOT NULL)
BEGIN
SET @ColumnName =
(
SELECT MIN(QUOTENAME(COLUMN_NAME))
FROM INFORMATION_SCHEMA.COLUMNS
WHERE TABLE_SCHEMA = PARSENAME(@TableName, 2)
AND TABLE_NAME = PARSENAME(@TableName, 1)
AND DATA_TYPE IN ('char', 'varchar', 'nchar', 'nvarchar')
AND QUOTENAME(COLUMN_NAME) > @ColumnName
)

IF @ColumnName IS NOT NULL
BEGIN
INSERT INTO #Results
EXEC
(
'SELECT ''' + @TableName + '.' + @ColumnName + ''', LEFT(' + @ColumnName + ', 3630)
FROM ' + @TableName + ' (NOLOCK) ' +
' WHERE ' + @ColumnName + ' LIKE ' + @SearchStr2
)
END
END
END

SELECT ColumnName, ColumnValue FROM #Results
END

How to change the listening port for Remote Desktop

Often you’ll want to run Remote Desktop services on a non-standard port.  Here’s the steps for changing the listening port on the “host” system.  Taken from the MS Knowledge Base.

View products that this article applies to. This article was previously published under Q306759 Important This article contains information about modifying the registry. Before you modify the registry, make sure to back it up and make sure that you understand how to restore the registry if a problem occurs. For information about how to back up, restore, and edit the registry, click the following article number to view the article in the Microsoft Knowledge Base: 256986 Description of the Microsoft Windows Registry INTRODUCTION This article describes how to change the port that Remote Desktop listens on. Note The Remote Desktop Connection Client for the Mac supports only port 3389. 3389 is the default port. MORE INFORMATION You can use the Remote Desktop feature in Microsoft Windows XP Professional to connect to your computer from another remote computer. Warning The Remote Assistance feature in Microsoft Windows XP may not work correctly if you change the listening port. For additional information, click the following article number to view the article in the Microsoft Knowledge Base: 307711 Remote Assistance invitation file does not contain correct port number To change the port that Remote Desktop listens on, follow these steps. Warning If you use Registry Editor incorrectly, you may cause serious problems that may require you to reinstall your operating system. Microsoft cannot guarantee that you can solve problems that result from using Registry Editor incorrectly. Use Registry Editor at your own risk.

  1. Start Registry Editor.
  2. Locate and then click the following registry subkey:

 

HKEY_LOCAL_MACHINESystemCurrentControlSetControlTerminalServerWinStationsRDP-TcpPortNumber

  1. On the Edit menu, click Modify, and then click Decimal.
  2. Type the new port number, and then click OK.
  3. Quit Registry Editor.

 

Note When you try to connect to this computer by using the Remote Desktop connection, you must type the new port.304304 How to configure the Remote Desktop client to connect to a specific port when you use Windows XP

 

Order characters numerically

It may be simple, but this SQL will order items numerically (1,2,3,10,20) instead of alpha (1,10,2,20,3).


SELECT ItemID, ItemName, ItemNum, CASE WHEN Len(ItemNum) = 0 THEN 'Z' ELSE SPACE(10- Len(ItemNum)) + ItemNum END OrderCol
FROM table
ORDER BY OrderCol

Citizen Kane

I just got done watching Citizen Kane for the very first time. Sure I knew what Rosebud was the whole time, so maybe I had extra sympathy for Kane from the beginning. But I wonder how many of use spend our whole life looking to find that one thing that can make us loved by everyone and thereby make us happy. When what we really want is to return to a simpler time. The pure joy that you hear in young Kane’s voice as he played in the snow at the beginning of the movie points to the joy of the simple things in life.

I think that we should all take the lessons of Kane to heart in that no matter how many things you collect, remember that the simple things in life can give you the most joy, but don’t wait until your dying breath to realize that and live it. Oh, and don’t wait 32 years to see this movie!

Bush Apologizes … Finally

President Bush took the blame the day after the election for the Republicans losing the house majority. “I’m obviously disappointed with the outcome of the election and, as the head of the Republican Party, I share a large part of the responsibility,” Bush said at a White House news conference on November 8th. He is willing to take responsibility for the political problems, but how about the problems with the war. It seems to me that Bush is sidestepping his responsibility in the problems that are going on with the war. In a bit of irony, Don Rumsfeld is stepping down as Defense Secretary because of the way things are going. I think that Rumsfeld made a lot of dumb moves in this war, but why isn’t the President willing to accept responsibility there as well. After all, he is the head of the armed forces as well as the head of the Republican party.

Now, I am not saying that he should resign, or that he needs to be impeached. We set a very dangerous precedent when we start impeaching presidents because we don’t agree with their decisions. That way leads to chaos and political instability and that benefits no one. All I’m asking for is an admission that the buck stops at the top and that whatever mistakes were made in Iraq are in part due to decisions made by Bush. Yes Rumsfeld should leave and should have left earlier. He bungled the preparation for this war and needs to bear responsibility for that. Bush has to accept that he took Rumsfeld’s advice when he shouldn’t have, but Bush has other jobs beyond national defense and removing him now causes ripples far beyond that of Rumsfeld leaving.

So, Mr. President: there is more the being president then playing political games. Take some responsibility for your other mistakes.

Nate Baxley

Using Alt and Title attributes on img tags

I was sent a tip about using alt and title attributes. I’ve noticed for a while now that Netscape 6+ doesn’t show the alt tags when you hover over them. Looking at the W3C specifications, the alt attribute is supposed to be used when the image can’t be displayed, because the image wasn’t found or the browser doesn’t support images. The title attribute is supposed to be used to provide extra information about ANY element and doesn’t have to be used only on img tags. Netscape uses the title attribute to show the little pop-up text when you hover over an image and shows the contents of the alt attribute when the image can’t be loaded. So, what is the correct attribute to use on images? It turns out the best thing to do is use both if you want to have a pop-up show when the user hovers over the image. IE will show the title attribute if it exists and the alt if title isn’t there. The title then could be a much longer description of the image and the alt tag a short explanation of what it’s for so that browser that can’t see the image will know what was supposed to be there.

For example:
<img src=”navicons/registration.jpg” alt=”Registration” title=”Click here to register for the conference”>

Will show “Click here to register for the conference” when you hover over it in either browser. It will show “Registration” in either browser if the image can’t be loaded although IE also shows a broken image icon. For screen readers, they’ll read both, “Registration” as the meaning of the image and the longer description if the user wants more information.

So, long story short, ALWAYS use alt, even if it’s blank(for bullet icons and such), and IF you want a pop-up to show use the title attribute. That said I’m certainly not suggesting that we go back and change pages we’ve already done, just keep it in mind for the future.

TV Families

In the last two weeks, two very long running shows on NBC, Friends and Frasier, came to an end after 10 or more years. I managed to catch the final shows of each series and it made me think about something. I didn’t watch every episode of these shows, but I caught them fairly regularly. I’m 29 now and so I was able to relate to Friends more than Frasier, but for both of them it made me think about the fact that I’ll miss these shows and these characters. They were like people that we knew. Of course they were people who we saw for an hour a week and who were able to solve most of their problems in about an hour. How does it happen that we become so attached to these characters? I actually watched an hour long show that talked about the history of these shows where they showed lots of clips from the shows. As I watched the clips, I remembered events from my own life that went along with the show. Is it sad to have those kind of associations? I don’t think so. I think that TV has become

Palestinian Terrorists?

I’ve just been reading several articles about the conflict between Israel and Palestine. The Israeli press routinly calls the Palestinians terrorists, and I suppose by a strict definition of the word, they are. They do strike terror into the hearts of their enemies. They do use hit and run tactics and suicide bombers to carry out some of their attacks. But a better term would be gorrilla fighters. Their tacts of hit and run and ambushes are very much like gorrila fighting. I think something that might bring the Palestinian side of the conflict home to more Americans would be if they thought of how British new reports would describe the 13 colonies actions during the American revolution. Certainly the Americans used much less conventional tactics to attack their British enemy who was playing by the traditional “rules” of war. But when you are outnumbered, you fight in what ever way that you can.

I believe that Israel has used up just about all of the grief that people felt toward the Holocaust victims. I think without the Holocaust, Israel would not exist today, and people somehow see the Israelis as always being the oppressed ones. Well, when helicoptors pick random targets out of a town and destroy them as an act of “retaliation” for bombings that may have come from that area of town, you really have to wonder who is the oppressed and who is the oppressor. When innocent Palestinians have to sit in their homes and fear that they will be arrested for suspicion at any moment. When they have to drive, or walk, many miles out of their way to get to work because the Isreali army will not let them use the same roads as everyone else, you begin to see that the Israelis are not the downtrodden people that they appeared to be after World War II.

I am not an Anti-Semit. I am not Pro-Palestinian. I think both sides have been caught in a conflict that should have been settled long ago if it where not for childish leaders on both sides at one time or another. However, I will admit that I do not know enough of the history on either side to say who is right and who is wrong. But when Sharon says that he desperatly wants peace from one side of his mouth, and from the other side gives orders to occupy Palestinian towns and cut them off from the outside world, I have to wonder what he really wants. You also have to wonder when the main, the only, person that can or will represent the Palestinians is held under house arrest, how can there be a free and open discussion? I also want to state that while I find the Israeli leadership dispicible, I can not help but blame at least a majority of the Israeli people themselves when given a choice so obviously oppostite in Perez.

I hope this conflict is ended soon, but I am not going to hold my breath. This conflict will continue until the leaders of both countries are able to behave like civilized human beings, and until the rest of the world stops treating the Israelis as the chosen people.

7 month update

Noah has his first tooth! Yeah!

Well, it was hard work, but he got his first tooth just last week. Now biting daddy’s nose is more rewarding when daddy screams \”ouch.\”

Noah turned 7 months old today. He’s crawling around everywhere and getting into everything. Luckily he hasn’t discovered the kitchen yet. Max is learning that he can’t lay in one spot for too long before Noah finds him and pulls out some fur.

Noah is still always ready to smile although teething has made him a little cranky lately. Some days are better than others. He’s so darn cute though!

Breakfast at the Baxleys
Ha ha, ha ha, this tickles

America’s Game?

I’m writing today about something that has been burning in me for about a year now and I need to get it off my chest. I love the Chicago Cubs. I always have. Since we moved to Kansas City, it is hard to listen to or catch a game. Luckily for me, WGN radio broadcasts over the Internet, so I am able to listen to the games there. However, last year, Major Leage Baseball told all radio stations that they could no longer broadcast the games over the Internet. Why you ask, because MLB had their own plans for broadcasting the games, but not for free as the stations had done. The fee they would charge would be $10 for the season. Not a bad deal you say, and you’re right, but why is my question. Why not allow the stations to continue to broadcast the games as they had been? Why not support the games with ads? They went so far as to play dead silence between innings instead of play ads which could have easily supported the broadcasts.

Last year, in a furry, I sent an email to all of my friends telling them about this terrible plan and that they should stay away from it and send comments to MLB and express their disapproval of this new program. However, I urned out to be the biggest turncoat of them all. As the Cubs started their year off as one of the best in recent memory, I couldn’t take it and payed the $10. I then found out that the $10 did not include the pregame that was normally broadcast on WGN, although WGN was still prohibited from broadcasting it. I worked with people from MLB and WGN to try and get the pregame shows broadcast online since we get very little in depth coverage here in KC. As you may know, the Cubs turned in their usual end of season performance and didn’t get into the playoffs. I was willing to hang my head in shame at their performance and my capitulation with MLB and vow to let the matter drop. But, a few weeks ago I recieved an email from MLB telling me that I should act not to sign up for this season, and if I hurried, I could get it at the bargain price of $10, however, the regular price would be $15. So, even with internet broadcasts, MLB has followed the lead of the ballparks in their ever increasing chase of higher profits.

“Who cares?” you ask. I do for one. I see this as another sign of the decline of America’s game from what it once was, a family sport that could be enjoyed by all and bring the family closer together. I will never forget the first time that I went to Wrigley field to see the Cubs play. It was like being in a dream. The field was so green, the smells were so real, and I had to pinch myself to make sure that it was all real. I have 3 brothers and sisters, and I’m not sure what it cost my parents to take us all, but if we were to go today, we would spend almost $100 just to get in the door. And to make the experience complete, you have to have a hot dog and a coke. That will cost you another $30 at least. I know that I may sound like a curmugoney old complainer, but it saddens me that the game that I love and the America once called it’s one is now manifestint iteslf as a money hungry corpoaration that cares little for the fans or the accessibility of the game to the average American family.

So what now, if you feel that the new online broadcast policy of MLB is not a good way to bring the game to the fans, pleas send your comments to fanfeedback@website.mlb.com and be a silent bench warmer no more!