Wednesday, August 25, 2010

Import Microsoft Access (v2003) tables into SQL Server Express Edition (v2005)

In my little corner of the world, I have seen this issue come up three times by three different people in the past 7 days so I thought I would posts this. I actually just went through this myself a little bit ago:

1. Open Microsoft SQL Server Management Studio Express
2. Create a database for the import, if necessary
3. Open the Microsoft Access database that will be imported into SQL
4. Switch to “Tables” in Microsoft Access
5. Right click on the Table to be exported
6. Select “Export”
7. In the ‘Save Type As…’ field select “ODB Databases()”
8. Name the Table and Press “OK”
9. Press the “New…” button
10. Select “SQL Server” and Press “Next>”
11. Enter a name for the Data Source then Press “Next>”
12. Press “Finish”
13. Enter a Description if necessary
14. Select the SQL Server to connect to and Press “Next>”
15. Select the correct Authentication settings and Press “Next>”
16. Check “Change the default database to:” and Select the correct Database then Press “Next>”
17. Press “Finish”
18. Press “Test Data Source…” to very the information entered was correct
19. If test completed successfully then Press “OK”
20. Press “OK”
21. In “SQL Server Login” dialog box, enter correct authentication information and Press “OK”
22. Export should occur without any further dialog boxes or prompts
23. Switch back to the Microsoft SQL Server Management Studio Express
24. Navigate to the database, refresh the console and verify the table was created/imported

Wednesday, March 10, 2010

creating MYSQL stored procedure and calling it from PHP

# Open phpMyadmin.
# Select a database to work with.
# Open the SQL tab.

Assume your database contains table called employees.

In the SQL tab,
you can start writing :

DROP PROCEDURE IF EXISTS listEmployees $$
CREATE PROCEDURE listEmployees()
BEGIN
select * from employees;
END $$

In delimiter [;] change ; to $$.

Hit go. Thats it, you are done with creating your first stored procedure.



Up to this anyone can google and create the stored procedure, but big mess is how to use this in PHP.
After many trails and trails I learned how to call procedure in php.


Normally you would use the below to connect to a mysql database in php.
$connector=mysql_connect(host,user,pass);

In order to use stored procedures try connecting like this:

$connector=mysql_connect(host,user,pass,true,65536);
mysql_select_db(database,$connector); //Nothing changes here

Now you are done with making php mysql to use with stored procedure.

Lets see how you can call stored procedure with php.

$query=mysql_query("CALL listEmployees()");
while($result=mysql_fetch_array($query))
{
echo $result[emp_name]."
";
}

Thats it. It calls procedure called listEmployees(which we written above and that does lists all employees data from employee table).

Writing stored procedures of mysql in PHPMYADMIN

1. Open phpMyadmin.
2. Select a database to work with.
3. Open the SQL tab.
4. Select all of the SQL statements between the DELIMITER statements in your stored procedure script. Do not include the DELIMITER statements! Here’s what my example script should look like:

DROP PROCEDURE IF EXISTS spFoo $$
CREATE PROCEDURE spFoo ()
BEGIN
SELECT 'Foo' FROM DUAL;
END $$

5. In the delimiter field, just below the SQL editor’s text area, enter $$ as your delimiter.

Saturday, January 23, 2010

Famous quotes, witty quotes, and funny quotations 2



"I find that the harder I work, the more luck I seem to
have."
- Thomas Jefferson (1743-1826)



"Each problem that I solved became a rule which served
afterwards to solve other problems."
- Rene Descartes
(1596-1650), "Discours de la Methode"



"In the End, we will remember not the words of our enemies,
but the silence of our friends."
- Martin Luther King Jr. (1929-1968)


"Whether you think that you can, or that you can't, you are usually right."
- Henry Ford (1863-1947)


"Do, or do not. There is no 'try'."
- Yoda ('The Empire Strikes Back')


"The only way to get rid of a temptation is to yield to it."
- Oscar Wilde (1854-1900)


"Don't stay in bed, unless you can make money in bed."
- George Burns (1896-1996)




"I don't know why we are here, but I'm pretty sure that it is not in order to enjoy ourselves."
- Ludwig Wittgenstein (1889-1951)




"There are no facts, only interpretations."
- Friedrich Nietzsche (1844-1900)




"Nothing in the world is more dangerous than sincere ignorance and conscientious stupidity."
- Martin Luther King Jr. (1929-1968)



"The use of COBOL cripples the mind; its teaching should, therefore, be regarded as a criminal offense."
- Edsgar Dijkstra (1930-2002)




"C makes it easy to shoot yourself in the foot; C++ makes it harder, but when you do, it blows away your whole leg."
- Bjarne Stroustrup




"A mathematician is a device for turning coffee into theorems."
- Paul Erdos (1913-1996)




"Problems worthy of attack prove their worth by fighting back."
- Paul Erdos (1913-1996)




"Try to learn something about everything and everything about something."
- Thomas Henry Huxley (1825-1895)



"Dancing is silent poetry."
- Simonides (556-468bc)




"The only difference between me and a madman is that I'm not mad."
- Salvador Dali (1904-1989)




"If you can't get rid of the skeleton in your closet, you'd best teach it to dance."
- George Bernard Shaw (1856-1950)




"But at my back I always hear Time's winged chariot hurrying near."
- Andrew Marvell (1621-1678)




"Good people do not need laws to tell them to act responsibly, while bad people will find a way around the laws."
- Plato (427-347 B.C.)




"The power of accurate observation is frequently called cynicism by those who don't have it."
- George Bernard Shaw (1856-1950)




"Whenever I climb I am followed by a dog called 'Ego'."
- Friedrich Nietzsche (1844-1900)




"Everybody pities the weak; jealousy you have to earn."
- Arnold Schwarzenegger (1947-)




"Against stupidity, the gods themselves contend in vain."
- Friedrich von Schiller (1759-1805)



"We have art to save ourselves from the truth."
- Friedrich Nietzsche (1844-1900)




"Never interrupt your enemy when he is making a mistake."
- Napoleon Bonaparte (1769-1821)




"I think 'Hail to the Chief' has a nice ring to it."
- John F. Kennedy (1917-1963) when asked what is his favorite song




"I have nothing to declare except my genius."
- Oscar Wilde (1854-1900) upon arriving at U.S. customs 1882




"Human history becomes more and more a race between education and catastrophe."
- H. G. Wells (1866-1946)




"Talent does what it can; genius does what it must."
- Edward George Bulwer-Lytton (1803-1873)





"The difference between 'involvement' and 'commitment' is like an eggs-and-ham breakfast: the chicken was 'involved' - the pig was 'committed'."
- unknown




"Women might be able to fake orgasms. But men can fake a whole relationship."
- Sharon Stone




"If you are going through hell, keep going."
- Sir Winston Churchill (1874-1965)



"He who has a 'why' to live, can bear with almost any 'how'."
- Friedrich Nietzsche (1844-1900)




"Many wealthy people are little more than janitors of their possessions."
- Frank Lloyd Wright (1868-1959)

Famous quotes, witty quotes, and funny quotations



"Moral indignation is jealousy with a halo."
- H. G. Wells (1866-1946)



"Glory is fleeting, but obscurity is forever."
- Napoleon Bonaparte (1769-1821)



"Victory goes to the player who makes the next-to-last mistake."
- Chessmaster Savielly Grigorievitch Tartakower (1887-1956)


"Don't be so humble - you are not that great."
- Golda Meir (1898-1978) to a visiting diplomat


"His ignorance is encyclopedic"
- Abba Eban (1915-2002)


"If a man does his best, what else is there?"
- General George S. Patton (1885-1945)



"Political correctness is tyranny with manners."
- Charlton Heston (1924-)




"You can avoid reality, but you cannot avoid the consequences of avoiding reality."
- Ayn Rand (1905-1982)




"When one person suffers from a delusion it is called insanity; when many people suffer from a delusion it is called religion."
- Robert Pirsig (1948-)




"Sex and religion are closer to each other than either might prefer."
- Saint Thomas Moore (1478-1535)



"I can write better than anybody who can write faster,
and I can write faster than anybody who can write better."
- A. J. Liebling (1904-1963)


"People demand freedom of speech to make up
for the freedom of thought which they avoid."
- Soren Aabye Kierkegaard (1813-1855)


"Give me chastity and continence, but not yet."
- Saint Augustine (354-430)


"Not everything that can be counted counts, and not everything that
counts can be counted."
- Albert Einstein (1879-1955)


"Only two things are infinite, the universe and human
stupidity, and I'm not sure about the former."

- Albert Einstein (1879-1955)



"A lie gets halfway around the world before the truth has a chance to
get its pants on."
- Sir Winston Churchill (1874-1965)


"You may not be interested in war, but war is interested in you."
- Leon Trotsky (1879-1940)






"I do not feel obliged to believe that the same God who has
endowed us with sense, reason, and intellect has intended us to forgo
their use."
- Galileo Galilei (1564-1642)


"We are all atheists about most of the gods humanity has ever believed in. Some of us just go one god further."
- Richard Dawkins (1941-)





"The artist is nothing without the gift, but the gift is nothing
without work."
- Emile Zola (1840-1902)


"This book fills a much-needed gap."
- Moses Hadas (1900-1966) in a review


"The full use of your powers along lines of excellence."
- definition of "happiness" by John F. Kennedy (1917-1963)


"I'm living so far beyond my income that we may
almost be said to be living apart."

- e e cummings (1894-1962)


"Give me a museum and I'll fill it."
- Pablo Picasso (1881-1973)


"Assassins!"
- Arturo Toscanini (1867-1957) to his orchestra


"I'll moider da bum."

- Heavyweight boxer Tony Galento, when asked what he thought of
William Shakespeare


"In theory, there is no difference between theory and practice.
But in practice, there is."
- Yogi Berra

Thursday, January 7, 2010

Gtalk Invisibe mode via Lab Edition

Basically the desktop Gtalk client doesn’t allow you to set invisible offline status so one tip you can try out is by downloading the Gtalk Lab edition (Download lab edition) which is a google talk desktop client with a lot of features unavailable in the Gtalk gadget (the one which we use regularly).You can also launch orkut, google calendar with a click on a button using the lab edition and use those cute smileys bar in the chat window.

Another way to show offline status to your friend’s is to make use of multi protocol chat client for mac and windows but I prefer the lab edition as it is light and developed for users who wants to connect with only Google friends :)