Monday, 17 November 2014

SQL Server Database Projects and Visual Studio 2012, 2013 - Why Doesn't My DACPAC Post-Deployment Script Run?

SQL Server Database Projects are a new feature from Visual Studio 2012 onwards.
The SQL DACPAC format is generated by SQL Database Projects and is a Microsoft-endorsed way for deploying SQL schema changes as part of a deployment package (also known as a Data Tier Application). These can be deployed by a setup package or even a SQL Database Administrator through SQL Server Management Studio.

I noticed today that every time I built my project, it would include the wrong post-deployment SQL script file inside my DACPAC - so my reference tables were not populated with data correctly.

Turns out that there can only ever be one designated Post-Deployment Script in a SQL Server Database Project. I originally thought it was just a naming convention that was used to find the designated post-build file (i.e. anything named "Script.PostDeployment*.*".

This was not correct - you just have to make sure it is labelled as the Post-Deployment script for that project as per the file properties below.



As a side note, I generated the SQL MERGE statements for reference/lookup data using the dbo.sp_generate_merge tool on github:
https://github.com/readyroll/generate-sql-merge

DDK

Wednesday, 14 May 2014

China, Hong Kong and Macau Trip 2014

Arrived home this week after a lengthy trip around Hong Kong, Macau and China. Went with the family including dad this time. We saw some truly jaw-dropping scenery this time round. See below.

The highlights:

1) China - The clouds curling around Huangshan (Yellow) Mountain and the Extremely Steep Steps.

Known as "Yellow Mountain" to the average guilau. It was exactly like the old Chinese watercolour paintings you see everywhere (and they obviously inspired the scenery from the movie Avatar.). The 1000s of stairs were quite punishing - and the lack of hand rails, gale-force winds and sheer drops off granite cliffs was too hair raising for my Dad (plus he had a cold) - who pulled out.













Fairy Bridge (ahem. I'm not the fairy...)




 
 
These Guys get 100 Yuan Per Container they get to the Top (10km of stairs!):
 

 


2) China - Cycling Around Hangzhou (aka the "Most Beautiful City in China") and the West Lake
The whole city of Hangzhou is like a big jungle with beautiful Willows, pagodas and bridges everywhere. Probably the most livable city in China from my perspective as they take pride in how their city looks. Last time I went there, I got food poisioning so this experience was marginally better.

The 7km Tea Plantation Walk Near Hangzhou










3) China - Great Wall of China at Mutianyu and the Mega-Taboggan on the way back down Lisa and I had been to the Badaling section of the Great Wall in 2007 - but never to the less touristy section at Mutianyu. There you can actually move without a loud Chinese Tourist Operator deafening you with a megaphone in your ear and a dictatorial snarl to their voice.

Zach and Chinese 70's moustache guy

Some videos of the kids mucking around on the Great Wall:

a) Great wall of China Song inspired by the Wolf of Wall Street - http://youtu.be/xskGz1nrz8Q
b) Zach and Heidi - General Horseplay - Running Up and Down the Wall - http://youtu.be/Kp7PTl0cq-M


4) China - Eating the Poisonous Fugu Puffer Fish and Stinky Tofu in Shanghai

I've eaten a lot of weird and wonderful animals in China - but never had the poisonous (and potentitally deadly) Puffer fish Fugu. Had it on the river side of Shanghai a few blocks from the Shanghai Pearl Tower. Apparently your tongue is meant to tingle from the neurotoxins - but I found it had limited effect. Well at least I didn't suffer from paralysis and rapid death like hundreds of people in Japan in the 1950s! That's why serving of it is now strictly controlled and licensed.

 

 
I'd also never been brave enough to eat Cho Dofu (or Stinky Tofu). I will not be doing it again - as it smells and tastes like a perverse combination if Urine and Faeces. Yummo!


5) Macau - Touring St Pauls, and The Venetian and Galaxy Casinos.

The massive scale of the Venetian Casino and it's lifelike sky meant that:
a) We regularly got lost (that's probably by design as they never want you to escape before you gamble your money away.
b) We regularly experienced "The Truman Show" moments as the sky high above our heads seemed to move before your eyes if you look at it long enough - but it was just a well painted and lit ceiling.




There is a few hundred metres of canals within the Casino.
 
 
The lack of signs meant that we got lost a couple of times. This is Heidi having enough of walking around in circles:


The Portuguese Architecture on the way to St Pauls


6) China - Shanghai - Bar Rouge @ Bund 18 - Unfortunately missed out on the pole dancing and the "Bar on Fire" (a definite OH&S Issue and wouldn't be allowed in Australia) - on account of the weather but the view was spectacular and the Tiramisu cocktail was a winner. Most of the people in the bar had a distinctly British accent.


7) Chinglish Signs 

Some of the Awesome examples of the obligatory "Chinglish" signs I came accross this time. These included:

a) The "Chubby Lady" Fashion Store. It was not for Plus size women. "Mudd" fashion was also an inappropriate mechanism for generating interest in their clothing lines.


b) Instructions in the urinal to stand closer to avoid spillage - "One small step for forward, a big step for civilization". An interesting attempt at Chinese self-effacement - and recognition of the apalling state of urinals in China generally.
c) Engraved on a steel sign, instructions that "no verminous of filthy people are allowed in the park"... and that they must not "expose or exhibit sores when begging". Even beggars need to have standards.

8) China - Single-wheeled Segways and Mini-Segways

I saw about 20 of these on streets in China that people ride to work - I've never seen anything like it. Must have a very powerful gyro. Most of the motorbikes are all now electric (a big difference from my last visit 3 years before).

9) China - Yuanmingyuan  Ruins and Terracotta Warriors in Xian
Yuanmingruan are the ruins left of the old Summer Palace during the Opium Wars - the British and French Destroyed the massive fountains and palace complex that they helped to create. Dad (as a history teacher) - finally got to see the Terracotta warriors - and was very impressed.

The Terracotta Warriors - every one of them different. All holding weapons with a chromium covering (allegedly 2200 years before the Germans discovered the technique) - so they were still shiny when excavated. The warriors were all coloured like the Chinese Temples - with blue faces.

Yuanmingyuan Ruins Destroyed in the Opium Wars

Yuanmingyuan Maze

10) China - Cooking my own food at a street vendor in Shanghai

Like cooking your own steak in the poor man's Oaks!


11) The large number of times random people asked the kids and I to have photos with them

I had 4 groups ask me to hug them for photos just in Tiananmen Square! Zach then complained that everyone wanted photos with Heidi and I - "Who's taking a photo with me???". Sure enough he was asked about 10 minutes later!

12) On our Cathay Flight Home, they played the Chinese Language of "Prepare for Landing" while we were in the middle of the Ocean!The captain apologized shortly after this boo-boo - as they had no native Mandarin speakers on the plane and got the messages mixed up. Shortly after, they asked if a doctor on the plane for an emergency. I would have had a heart attack too if I believed the message... when we landed, several people clapped and cheered. Apparently some countries have that as a tradition - but I think people were relieved that they were still alive...

There are about a million other things I could say about the trip - but that will have to do!

Till Next Time,









DDK