Thursday, June 19, 2014

Kaartha Veeryarjuna Stotram

திருட்டுப் போன பொருள் கிடைக்க ஸ்ரீ கார்த்த வீர்யார்ஜுன சுவாமி மந்திரம், துதி.

முதலில் விநாயகரை வழிபடுங்கள், பிறகு உங்கள் குலதெய்வத்தையும் இஷ்ட தெய்வத்தையும் வழிபடுங்கள். அதன்பின் கீழே உள்ள ஸ்ரீ கார்த்த வீர்யார்ஜுன சுவாமியின் மந்திரத்தை 108 முறை முழு மனதுடன் கூறினால் திருட்டுப் போன பொருள் கிடைக்கும் என்பது பெரியோர்கள் அளித்த நம்பிக்கை.

"ஓம் - ஆம் ஹ்ரீம் - க்ரோம் 
கார்த்த வீர்யார்ஜுனாய நமஹ
கார்த்த வீர்யார்ஜுனோ நாம 
ராஜா பாஹு ஸஹஸ்ரவான்
யஸ்யஸ்மரண மாத்ரேண 
கதம் நஷ்டம் ச லப்யதே".


MANTRA TO GET LOST ARTICLE/STOLEN MATERIAL. SRI KARTHA VEERYARJUNA MANTHIRAM, SLOKAM.

If you have lost any material, or if the same is stolen, and to get back the same, pray to Lord Karthaveeryarjana. First pray to Lord Ganesha, then to your kuladheivam/ishta dheivam and then recite the below mantra 108 times. Elders have guided us with this mantra.

OM - AAM HREEM - KROHM
KAARTHTHA VEERYAARJUNAAYA NAMAHA
KAARTHTHA VEERYAARJUNOH NAAMA
RAAJAA PAAHU SAHASRAVAAN
YASYASMARANA MAATHRE(Y)NA
KADHAM NASHTAM SA LABYATHE(Y).


Wednesday, May 14, 2014

15 Most Amazing Predictions for Kali Yuga from the Bhagavata Purana

Bhagavata Purana


In the last canto of the Bhagavata Purana there is a list of predictions and prophecies about the dark times for the present age of Kali Yuga. The following 15 predictions, written 5,000 years ago by sage Vedavyasa, are amazing because they appear so accurate. Despite the negative tone of these prophecies, there is still one bright spot for all of us, which is mentioned at the end.

Prediction 1:

Religion, truthfulness, cleanliness, tolerance, mercy, duration of life, physical strength and memory will all diminish day by day because of the powerful influence of the age of Kali.

Source: Srimad Bhagavatam 12.2.1

sri-suka uvaca
tatas canu-dinam dharmah
satyam saucam ksama daya
kalena balina rajan
nanksyaty ayur balam smrtih

Prediction 2:

In Kali Yuga, wealth alone will be considered the sign of a man's good birth, proper behaviour and fine qualities. And law and justice will be applied only on the basis of one's power.

Source: Srimad Bhagavatam 12.2.2

vittam eva kalau nṝṇāḿ
janmācāra-guṇodayaḥ
dharma-nyāya-vyavasthāyāḿ
kāraṇaḿ balam eva hi

Prediction 3:

Men and women will live together merely because of superficial attraction, and success in business will depend on deceit. Womanliness and manliness will be judged according to one's expertise in sex, and a man will be known as a brahmana just by his wearing a thread.

Source: Srimad Bhagavatam 12.2.3

dāmpatye 'bhirucir hetur
māyaiva vyāvahārike
strītve puḿstve ca hi ratir
vipratve sūtram eva hi

Prediction 4:

A person's spiritual position will be ascertained merely according to external symbols, and on that same basis people will change from one spiritual order to the next. A person's propriety will be seriously questioned if he dos not earn a good living. And one who is very clever at juggling words will be considered a learned scholar.

Source: Srimad Bhagavatam 12.2.4

lińgaḿ evāśrama-khyātāv
anyonyāpatti-kāraṇam
avṛttyā nyāya-daurbalyaḿ
pāṇḍitye cāpalaḿ vacaḥ

Prediction 5:

A person will be judged unholy if he does not have money, and hypocrisy will be accepted as virtue. Marriage will be arranged simply by verbal agreement, and a person will think he is fit to appear in public if he has merely taken a bath.

Source: Srimad Bhagavatam 12.2.5

anāḍhyataivāsādhutve
sādhutve dambha eva tu
svīkāra eva codvāhe
snānam eva prasādhanam

Prediction 6:

A sacred place will be taken to consist of no more than a reservoir of water located at a distance, and beauty will be thought to depend on one's hairstyle. Filling the belly will become the goal of life, and one who is audacious will be accepted as truthful. He who can maintain a family will be regarded as an expert man, and the principles of religion will be observed only for the sake of reputation.

Source: Srimad Bhagavatam 12.2.6

dūre vāry-ayanaḿ tīrthaḿ
lāvaṇyaḿ keśa-dhāraṇam
udaraḿ-bharatā svārthaḥ
satyatve dhārṣṭyam eva hi
dākṣyaḿ kuṭumba-bharaṇaḿ
yaśo 'rthe dharma-sevanam

Prediction 7:

As the earth thus becomes crowded with a corrupt population, whoever among any of ther social classes shows himself to be the strongest will gain political power.

Source: Srimad Bhagavatam 12.2.7

evaḿ prajābhir duṣṭābhir
ākīrṇe kṣiti-maṇḍale
brahma-viṭ-kṣatra-śūdrāṇāḿ
yo balī bhavitā nṛpaḥ

Prediction 8:

Harassed by famine and excessive taxes, people will resort to eating leaves, roots, flesh, wild honey, fruits, flowers and seeds. Struck by drought, they will become completely ruined.

Source: Srimad Bhagavatam 12.2.9

śāka-mūlāmiṣa-kṣaudra-
phala-puṣpāṣṭi-bhojanāḥ
anāvṛṣṭyā vinańkṣyanti
durbhikṣa-kara-pīḍitāḥ

Prediction 9:

The citizens will suffer greatly from cold, wind, heat, rain and snow. They will be further tormented by quarrels, hunger, thirst, disease and severe anxiety.

Source: Srimad Bhagavatam 12.2.10

śīta-vātātapa-prāvṛḍ-
himair anyonyataḥ prajāḥ
kṣut-tṛḍbhyāḿ vyādhibhiś caiva
santapsyante ca cintayā

Prediction 10:

The maximum duration of life for human beings in Kali Yuga will become 50 years.

Source: Srimad Bhagavatam 12.2.11

triḿśad viḿśati varṣāṇi
paramāyuḥ kalau nṛṇām

Prediction 11:

Men will no longer protect their elderly parents.

Source: Srimad Bhagavatam 12.3.42

na rakshishyanti manujah
sthavirau pitarav api

Prediction 12:

In Kali-yuga men will develop hatred for each other even over a few coins. Giving up all friendly relations, they will be ready to lose their own lives and kill even their own relatives.

Source: Srimad Bhagavatam 12.3.41

kalau kakinike 'py arthe
vigrihya tyakta-sauhridah
tyakshyanti ca priyan pranan
hanishyanti svakan api

Prediction 13:

Uncultured men will accept charity on behalf of the Lord and will earn their livelihood by making a show of austerity and wearing a mendicant's dress. Those who know nothing about religion will mount a high seat and presume to speak on religious principles.

Source: Srimad Bhagavatam 12.3.38

sudrah pratigrahishyanti
tapo-veshopajivinah
dharmam vakshyanty adharma-jna
adhiruhyottamasanam

Prediction 14:

Servants will abandon a master who has lost his wealth, even if that master is a saintly person of exemplary character. Masters will abandon an incapacitated servant, even if that servant has been in the family for generations. Cows will be abandoned or killed when they stop giving milk.

Source: Srimad Bhagavatam 12.3.36

patim tyakshyanti nirdravyam
bhritya apy akhilottamam
bhrityam vipannam patayah
kaulam gas capayasvinih

Prediction 15:

Cities will be dominated by thieves, the Vedas will be contaminated by speculative interpretations of atheists, political leaders will virtually consume the citizens, and the so-called priests and intellectuals will be devotees of their bellies and genitals.

Source: Srimad Bhagavatam 12.3.32

dasyutkrishta janapada
vedah pashanda-dushitah
rajanas ca praja-bhakshah
sisnodara-para dvijah

Despite all of these dark prophecies, there is one good quality in this age of Kali yuga:

kaler dosha-nidhe rajann
asti hy eko maha gunah
kirtanad eva krishnasya
mukta-sangah param vrajet



"Although Kali-yuga is an ocean of faults, there is still one good quality about this age: simply by chanting the names of Krishna, one can become free from material bondage and be promoted to the transcendental kingdom." (Source: Srimad Bhagavatam 12.3.51)

So let us take advantage of this special spiritual gift given during the dark times of Kali yuga to quickly raise ourselves spiritually through chanting of God's holy names.
Src: www.indiadivine.org

Sunday, March 16, 2014

An unopened book...

Alone in the forest dust, I was walking with a stick, unable to withstand the freezing cold counting the steps I had taken crossing several miles of hurdles, found some crumbled torn pieces of old foils tied in a golden ribbon.

I found it in a no-man's place where no one can peek in just like that. It looked like it was kept preserved and secret for aeons and it was floating on the cosmos which is accessible by anyone but with an encrypted key to find the path.

But how did I find the path, asked myself mysteriously. Who gave me the key to the path, sounded astonishing to me. It seemed to me like a book, but why someone has kept it like that? Loads of questions wavered in my mind. I was very curious to know it. I didn't know whether to really touch it or not.

It was not shining and neither seemed to be more attracting as well. Then why would I bother to touch it, asked myself. Is it not unmoral to trespass in someone's path? As I am looking at that, I kept walking with loads of thoughts running in my mind.

Something strange, that floating object followed me wherever I went which made me to think more skeptical as to why it is happening. It felt like something was connected to me with that which made me to feel the presence of it.

I didn't mind to bother to look at it for sometime and kept gazing my path to destiny. By the way I didn't know what was my destiny either. I just dragged myself wherever the path leads to. I had become too old to even stand erect, and there was no one to lend a helping hand.

I saw a big tree full of fruits and birds singing peacefully, nobody there to disturb their blissfulness.

(I will continue writing after sometime...)

Monday, January 16, 2012

மணித்துளிகள்...

வெளிநாட்டுப் பயணமும் வெளிநாட்டில் தொழிலும்
மணித்துளிகள் என்று எண்ணி வந்தேன்...

ஆனால் அவை வெறும் துளி மணிகள் தான்
என்று தெரிந்துக்கொண்டேன்...

பவழங்களும் முத்துக்களும் அங்கே கொட்டிக்கிடக்க
வெறும் பாசி மணிகளை பொருக்கவா இங்கு வந்தேன்?

என் மணித்துளிகளைக் காண
ஒவ்வொரு மணித்துளிகளையும் மணி மணியாய்க் கழிக்கின்றேன்...

Friday, November 25, 2011

Karam UppuSai (A different definition to cooking)

My friends/colleagues used to make fun of me coining different terms / definitions, when I say it when I am angry / irritated / feeling very jolly / having fun...

Few such things are Sani Mundam, Eruma Naayagam, Karuma Kammanaati and so forth...

I am new to cooking, as I have never touched utensils in my house for cooking...

But you see, necessity is the mother of invention... Idle mind is devil's workshop...

I was damn hungry, didn't have anything to eat, what I had was vegetables and few flours (maavu)... But what to do with that... My mom is a great cook... She does anything to eat with whatever food stuff is available.

I saw my mom preparing karacha maavu dosai which can be instantly prepared...
Oh, what an !dea? I thought of trying the same... And the final product is Karam UppuSai....

Don't laugh... Its really good to eat... And very quick to prepare too...

Ok... Let me tell you all, how I prepared... Btw, why this peculiar name? As I said before, I was too much irritated as I was hungry and the end product what I got made me feel even irritated... So I wanted to give a name which I should never forget in life... One such previous invention is Soriyaani rice (thats too funny) as the rice came was like that only...

What does Karam UppuSai means?

Karam, (in tamil) means hand/arm...??? Why this here??? Read further...
And UppuSai is from two words Uppuma/Dosai... Hope most of you had/heard about them...

The ingredients of this dish are (for 1 person):
1. Arisi maavu (A) - (Rice flour) - 1 hand full / equiv
2. Ravaa (R) - (Sooji) - 1 hand full / equiv
3. Maida maavu (M) - All purpose flour / Refined white wheat flour - 2 hand full / equiv
4. Pachai Milagai - (Green Chilly) - one
5. Vengayam - (Onion) - Big half
6. Kadugu - (Mustard)
7. Jeeragam - (Cumin seeds)
8. Oil & Salt
9. Thayiru - (Curd / Yogurt) - optional

How to prepare
1. Put ARM in the ratio 1:1:2 in a bowl and add water and mix it well in such a way that the batter (maavu in liquid state) is consistent and slightly flowy but not watery.
2. Add salt to the batter and mix it again
3. If you have curd then add 1 karandi (big spoon) of it to the batter
4. Then put oil in the pan/illupa karandi and put mustard and jeera in it and heat it until mustard starts popping up (don't make it completely black / burnt)
5. Add this mustard, chopped onions and chilly to the batter. Stir well and keep it aside for 15-30 minutes
6. After 15-30 minutes, add more water so that the batter is more flowy like milk or even slightly less. Dont add more water. Based on our experience, next time we can add more or less water
7. Now the batter is ready...
8. Put some oil in the pan and pour this batter in the pan

Here comes the main scene... Hope you might have seen how a dosa is made... The same way you do this also.. The outcome of this depends on how lucky you are :)
I also tried to make dosa only (I have done it at home a couple of times and trust me it came out well too)
If the batter is too thick, then we cant make it proper and same in the case if it is too watery
If the outcome is like a dosa, then you are done.

Here I introduce the final twist.... I was not able to make it like a Dosa as it tore into pieces and I was not able to rotate it either.. So I pressed it to make sure there is no watery batter in the pan and I almost made it like how we will fry eggs (egg burjie / egg podimaas or so) and it tasted & looked like Uppumaa too...

Since the outcome came to be like that and my intention was to prepare dosai, I named it UppuSai.
But the main ingrediants are (A)risi maavu, (R)avaa & (M)aida maavu, so I thought of naming it ARM Uppusai, but since I am a tamizhan and Dosai & Uppuma are part of South India (TamilNadu), I changed ARM to Karam (sounded similar and meant the same too) to give a different name.

I hope, some might have enjoyed reading this and few might have got irritated too ;)

What to do, I am staying alone in USA and need to do something for Lunch/Dinner and this is one of my experimentations....

Note: The original name of this is "Karacha maavu dosa" - previously mentioned though...

Most of you might be thinking now, Ada paavi idha dhaan ithna neramaa ivalo kevalamaa sonniyaanu....
The answer is YES...

Sunday, November 20, 2011

Simple & Effective Exercise

The essence of the exercise is that your "Eyes Must be Closed" when you are doing this exercise. You must practise the "Jin Ji Du Li" exercise with the eyes closed. This exercise was so simple and amazing that I thought I had to share it here. 
Here is the exercise: 
Stand on one leg while your eyes are closed. That is all. Just try it right now, stop reading and stand up, close your eyes and try standing on one foot. 
  
 If you are not able to stand for less than 10 seconds, it means that your body has degenerated to 60 to 70 years old level in other words, you may be only 40 years old, but your body has aged a lot faster. 
I tried this exercise myself when I read the mail. I thought “oh, big deal, I’m sure I can do this easily” I was fooling myself, I’m glad I tried it because I discovered much to my surprise that while I could stand easily on one foot with my eyes open, trying the same thing with my eyes closed was another story! I just could not keep my balance for more than two to three seconds before I started wobbling and hopping around. 
  
You do not need to lift your leg high, if your internal organs are out of synch, even lifting your leg this bit will make you wobble. 
Now this was quite scary because it told me that my body was almost 60 years old and here was me, barely into my forties! These Chinese are really very advanced in their knowledge of the human body. It was very heartening to know that frequent and regular practice can help you recover your sense of balance. In fact Chinese specialists suggest daily practice of Jin Ji Du Li for 1 minute, this helps prevent dementia. 
You can try slightly closing both eyes while practicing Jin Ji Du Li, instead of completely closing them; in fact this is what the health specialist Zhong Li Ba Ren recommends. 
Daily practice of Jin Ji Du Li, can help in healing many illnesses or diseases like 
  • Hypertension,
  • High Blood Sugar or diabetes,
  • Neck and Spinal diseases,
  • it can also prevent you from getting dementia.
Zhong Li Ba Ren has written a book titled "Self Help is Better than Seeking Doctors' Help", which is a bestselling book that has been the best seller health book in China since it was first published last year. Its success can be measured by the fact that it has been reprinted 12 times within 6 months, with more than 1 million copies sold. The book is a hot seller because is it teaches many simple practical health tips. 
It is said that according to the understanding of Chinese physicians, diseases appear in the body because the coordination between the various internal organs encounter problems and that causes the body to lose its balance. Jin Ji Du Li can readjust this inter-relationship of the organs and how they function with each other. Zhong Li Ba Ren stated that many people can't stand on one foot with their eyes closed for even 5 seconds, but later on as they practice it daily, are able to stand for more than 2 minutes. 
As you gain ability to stand for longer time, the feeling of "head heavy, light feet” disappears. As benefits or practising Jin Ji Du Li, you will experience that the quality of sleep improves, the mind clears up and memory improves significantly. Most importantly if you can practice Jin Ji Du Li with your eyes closed for 1 minute every day, you will not get dementia. (I think it this also means the brain will remain healthy). 
Zhong Li Ba Ren explained that there are 6 important meridians passing through our legs. When you stand on a single leg, the weak meridian will feel sore while getting the necessary exercise, and as this happens, the corresponding organs of these meridians and their path-ways, start getting the necessary tuning. This method can focus or concentrate the awareness, and channel the body's qi to the foot. The beneficial effects of practising Jin Ji Du Li on various illnesses associated with hypertension, diabetes, neck and spinal diseases are quick to be seen and felt. Jin Ji Du Li can also prevent gout. 
Jin Ji Du Li helps to Strengthen body Immunity rapidly 
Jin Ji Du Li it is suitable for everyone generally. It is the basic cure for "Cold Feet Disease” and it can also strengthen the body’s immunity. You do not have to wait until you have any illness to start practising Jin Ji Du Li. It is especially beneficial for young people, when they practice it daily while they are healthy, so that their chances of contracting the various illness associated with aging is comparative lower. 
Please note that it is not suitable for people over 70 years old, or those old people 

Thursday, November 17, 2011

Think about it... LIFE IS VERY SHORT

It's another morning......... Again I have to go to the office. Ohh!! this is me... I shouted, having a glance at my photo in today's news paper.

But what the HELL is it doing in the death column??

Strange...

One second.......Let me think, last night when I was going to bed I had a severe pain in my chest, but I don't remember anything after that, I think I had a sound sleep.

It's morning now, ohh....... It's already 10:00 AM, where is my coffee?

I will be late for office and my boss will get a chance to irritate me..

Where is everyone...??? I screamed. "I think there is a crowd outside my room, let me check." I said to myself.

So many people..... Not all of them crying...... But why are some of them crying....

WHAT IS THIS??? I'm lying there on the floor...

"I AM HERE" ....... I shouted!!! No one is listening.

"LOOK I AM NOT DEAD" .... I screamed once again!!
No one is interested in me. They all were looking at me on the bed.

I went back to my bed room. "Am I dead??" I asked myself...

Where is my wife, my children, my Mom, my Dad, my friends?

I found them in the next room, all of them were crying...still trying to console each other. My wife was crying... she was really looking sad.

My little kid was not sure what happened, but he was crying just because his Mom was sad..

How can I go without saying to my kid that I really love him, I really do care for him. ??

How can I go without saying to my wife that she is really the most beautiful and most caring wife in this world..??

How can I go without saying to my parents that I'm what I am ... just because of you??

How can I go without telling my friends that without them perhaps I would have done most of the wrong things in my life... thanks for being there always when I need them...and sorry for not being there when they really need me..

I can see a person standing in the corner and trying to hide his tears....

Oh... he was once my best friend, but a small misunderstanding made us part, and we both have a strong enough ego to keep us disconnected.

I went there..... And offered him my hand, "Dear friend.... I just want to say sorry for everything, we are still best friends, please
forgive me." No response from other side, what the hell?? He is
still preserving his ego, I am saying sorry... even then!!!

I really don't care for such people.

But one second...... It seems he is not able to see me!!!! He did not see my extended hand.

My goodness...... AM I REALLY DEAD???

I just sat down near ME; I was also feeling like crying...

"OH ALMIGHTY!!!! PLEASE JUST GIVE ME FEW MORE
DAYS..."

I just want to make my wife, my parents; my friends realize how much I love them.....

My wife entered the room, she looks beautiful. "YOU ARE BEAUTIFUL" I shouted.

She didn't hear my words, in fact she never heard these words because I never said this to her.

"GOD!!!!" I screamed... a little more timeplzzzzz... I cried...

One more chance please... to hug my child, to make my mom smile just once, to feel my dad proud of me at least for a moment, to say sorry to my friends for everything I have not given to them, and thanks for still being in my life....

Then I looked up and cried!!
 I shouted....... "GOD!!!! ONE MORE CHANCE PLEASE!!!!"

"You shouted in your sleep," said my wife as she gently woke me up. "Did you have a nightmare?"

I was sleeping.... Ohh that was just a dream....

My wife was there... she can hear me... This is the happiest moment of my life...

I hugged her and whispered....

"YOU ARE THE MOST BEAUTIFUL AND CARING WIFE
IN THIS UNIVERSE..... I REALLY LOVE YOU, DEAR"

I can't understand the reason of the smile on her face with some tears in her eyes, still I'm happy....

"THANK YOU GOD FOR THIS SECOND CHANCE."

SO, now it's not late... Forget the egos, the Past... and express your love to others.......

Be friendly...

Keep smiling...... forever....It is another chance For you...

Friday, October 7, 2011

SQL - OPENXML vs xQuery

--One of the nice ways to work with XML in SQL Server 2005/2008

DECLARE @idoc int
DECLARE @doc varchar(1000)
SET @doc ='
<ROOT>
<Customer CustomerID="VINET" ContactName="Paul Henriot">
<Order OrderID="10248" CustomerID="VINET" EmployeeID="5"
OrderDate="1996-07-04T00:00:00">
<OrderDetail ProductID="11" Quantity="12"/>
<OrderDetail ProductID="42" Quantity="10"/>
</Order>
</Customer>
<Customer CustomerID="LILAS" ContactName="Carlos Gonzlez">
<Order OrderID="10283" CustomerID="LILAS" EmployeeID="3"
OrderDate="1996-08-16T00:00:00">
<OrderDetail ProductID="72" Quantity="3"/>
</Order>
</Customer>
</ROOT>'
--Create an internal representation of the XML document.
EXEC sp_xml_preparedocument @idoc OUTPUT, @doc
-- SELECT stmt using OPENXML rowset provider
SELECT *
FROM OPENXML (@idoc, '/ROOT/Customer/Order/OrderDetail',2)
WITH (OrderID int '../@OrderID',
CustomerID varchar(10) '../@CustomerID',
OrderDate datetime '../@OrderDate',
ProdID int '@ProductID',
Qty int '@Quantity')


DECLARE @Result int
EXEC @Result = sp_xml_removedocument @idoc
IF @Result = 0
SET @idoc = NULL

------------------------------------------------------------------------------------------------------------
DECLARE @idoc int
DECLARE @doc varchar(1000)
SET @doc ='<Root>'+ (
SELECT
'Text Sample' AS TextCol,
GETDATE() AS DateCol,
12345 AS IntCol
FOR XML PATH('Sample')
)
SET @doc = @doc + '</Root>'
SELECT @doc = CAST(CAST(@doc AS XML) AS NVARCHAR(MAX))
EXEC sp_xml_preparedocument @idoc OUTPUT, @doc
SELECT *
FROM OPENXML (@idoc, '/Root/Sample', 2)
WITH
(
TextCol VARCHAR(50),
DateCol DATETIME,
IntCol INT,

xmldata XML '.'
)
--the xmldata can be used to insert individual details into an XML in a single column

DECLARE @Result int
EXEC @Result = sp_xml_removedocument @idoc
IF @Result = 0
SET @idoc = NULL

------------------------------------------------------------------------------------------------------------

/*
Note:


Do not forget to use sp_xml_removedocument after using sp_xml_preparedocument...
It has an impact on memory usage...

The OpenXML opens up a single file and allows you to use is as a data set. The xml.NODES syntax (xQuery) is designed to allow you to run queries against XML columns in a table. So - if you have kept some 100 xml documents in a single table as separate rows, you could run one query against ALL of them in on shot, and get the results back. Using OPENXML - you'd need a loop, some place to store the results of each run , etc

Hence OpenXML and xQuery should be chosen wisely depending on the scenario.
*/


------------------------------------------------------------------------------------------------------------
--Sample usage between OpenXML and xQuery
------------------------------------------------------------------------------------------------------------

DECLARE @InputXML XML
SET @InputXML =
'<contacts>
<contact id="fce91f99-69d7-4a55-9ecf-000072f65eb2">
<name>name1</name>
<phone>123-432-1234</phone>
<email>1stmail@email.com</email>
</contact>

<contact id="0982747d-9089-49d8-b870-000072fe965a">
<name>name2</name>
<phone>567-123-1234</phone>
<email>2ndmail@email.com</email>
</contact>

<contact id="a5b4874e-538e-4349-94d3-00009cf28e07">
<name>Testing Name</name>
<phone>432-123-4213</phone>
<email>3rdmail@email.com</email>
</contact>
</contacts>'
--------------------------------------------------------
/*Using OpenXML*/
--------------------------------------------------------
DECLARE @XMLHandle INTEGER
DECLARE @Result INTEGER
EXEC sp_xml_preparedocument @XMLHandle OUTPUT, @InputXML
SELECT ID
,Name
,Phone
,EMail
,'Using OpenXML' AS Source
FROM OPENXML (@XMLHandle, '/contacts/contact', 2)
WITH ( id UNIQUEIDENTIFIER '@id'
,name VARCHAR(50)
,phone VARCHAR(50)
,email VARCHAR(50)
)
EXEC @Result = sp_xml_removedocument @XMLHandle
IF @Result = 0
SET @XMLHandle = NULL
--------------------------------------------------------
 
--------------------------------------------------------
/*Using xQuery*/
--------------------------------------------------------
SELECT Con.value('(@id)','UNIQUEIDENTIFIER') AS ID

,Con.value('name[1]','VARCHAR(50)') AS Name
,Con.value('phone[1]','VARCHAR(50)') AS Phone
,Con.value('email[1]','VARCHAR(50)') AS EMail
,'Using xQuery' AS Source
FROM @InputXML.nodes('/contacts/contact') AS x(Con)
--------------------------------------------------------