Monday, June 20, 2022

Buggish: MS SQL SMO StoredProcedure ScriptHeader(false) with renamed stored procedure

The SMO StoredProcedure ScriptHeader(false) will return the original stored procedure name (ie this is the script originally used to create the stored procedure). Because it has been renamed, this is no longer the value that I want. I want a create script with the new name.

According to this post: https://social.msdn.microsoft.com/Forums/silverlight/en-US/6de78652-3780-403b-893f-da4ef8a01ed8/textheader?forum=sqlsmoanddmo

This is a known issue. It also references:

https://www.sqlservercentral.com/articles/ssis-%e2%80%93-transfer-sql-server-objects-debugged

https://www.sqlservercentral.com/forums/topic/ssis-%e2%80%93-transfer-sql-server-objects-debugged


My resolution is to use the ScriptHeader(true) and change ALTER PROCEDURE to CREATE PROCEDURE as it is easier than parsing or replacing the stored procedure name. I also need to use ScriptHeader to preserve the documentation in the header.

I also use this to move db objects from one server to another.


NOTE: I think this only happens if a rename is used. To workaround this before, I would just run the alter script on itself. I wanted to get away from that because it would change the last updated datetime which I also used as part of my fuzzy logic in determining script versions that are not source controlled.

Thursday, June 9, 2022

Work Life: Retrospective on Learning Azure DevOps Pipeline and Release (primarily a C# developer)

I am a very lazy learner. By this, I mean more like lazy-loading in software development. I read as little as possible before trying to implement something.

Due to this, my learning of Azure DevOps Pipeline and Release was quite frustrating. To guesstimate, the experience probably took me about a week to get something to work with some ability to customize to external needs.

Pipeline vs Release

I still do not have a clear picture of this in my head. The things I read have not been fully digested and not similar to my experience with them.

My current view is that the pipeline is an ability for me the ability to use a temporary virtual machine to "download", build, and create an artifact.

I use Release to get that artifact and deploy it to the target systems.

A small question mark in my mind is that pipeline could be used to deploy and release can also be used to build. Using them separately above is still much easier.

Learning so many new technologies

By new, I mean things I have not learned for example bash. Bash has been around a long, long time but I haven't ever needed bash although a bit similar to dos command. I know extremely limited knowledge of dos command besides navigating around and getting user or system info.

Because I am a windows guy, I was using a windows VM. I was using bash on windows. I did not realize this was a problem when I was trying examples which were mostly designed around Linux. I admit that I didn't know bash was primarily a Linux thing. So after a lot of time in-part because it took me a while to learn about the Linux part, I changed the VM to Linux which then magically everything started to work properly.

The hardest part of using Windows bash was moving files around. Because Windows uses a drive letter, the copy was confused on what to do with the drive letter. It sometimes used the letter as a folder so it could not find the files. I probably didn't use it correctly.

I also had to learn YAML. Although pretty simple on the format, it was difficult to understand how this was used. It was edited in Azure so part of my mind was thinking this was executed in Azure. After a lot of troubleshooting, it finally dawned on my that this is mostly triggered from GitHub because GitHub has to send the trigger to the pipeline. So things like why the trigger branch only works on the branch the YAML file is on is important.

I was still in the process of learning GitHub and how to use it with Visual Studio while trying to train developers on branching (I also do not understand why I am the person responsible for this as a release manager). There was just so many variables in my knowledge that it was rather frustrating to figure out where the problem is.

Troubleshooting

Part of learning so many new techs is troubleshooting them. I spent hours just figuring out that spaces are important in bash. An equal sign requires no spaces around it when assigning. Then it needs spaces for comparing.

Learning which variables are part of DevOps system versus variables of the language or VM system. I really just tried copy/paste but understand where my system variables are used with code variables was taxing my brain.

Time Constraints

Would it have been better if I just sat down and read each tech first? Probably not. I would probably still be learn all the capabilities of bash and nothing else. Was there a better way to handle this still?

I definitely admit that I am very cheap. I tried to lean on colleagues but they lack the expertise even in their own fields so I have very little resource within my company. It was also very, very difficult to get someone's time to just look at my problem or teach me the technology. I spent so many evenings just reading on things just to solve seemingly simple problems like getting just the changed files in git.

I actually asked a friend if he knows anyone about the technology and offered to pay (with my personal funds) to help me with my work. I figured this was the fastest way to learn as they would know what I need to know and what I didn't need to know yet.

Ended up I couldn't find anything and my friend being curious as he was assisted me with at least the bash portion enough so that I can figure a piece of my problem. Amazingly that was enough stability for me to complete the whole project.


Tuesday, June 7, 2022

Buggish: No TypeScript version specified by loaded projects. Using the default Visual Studio TypeScript version 4.6 for IntelliSense.

This is for those who have limited knowledge of Visual Studio (for this specific instance, Visual Studio 2022) but probably the same for other recent versions.

I have used Visual Studio for several years and have almost never used the output tab before. I was troubleshooting an issue that was throwing an error when pushing change to GitHub.

The error said to look at the Output window. And in the output window is the error:

No TypeScript version specified by loaded projects. Using the default Visual Studio TypeScript version 4.6 for IntelliSense.

For the life of me, I couldn't find anything on updating the TypeScript. In some ways, this was fortunate because this had absolutely no relationship to my error. I think this message comes up in all my projects as I never specified TypeScript before. Also does not appear simple to modify.

While troubleshooting, I noticed that I could not reach GitHub due to corporate firewall. The security team is already out for the day. So eventually, I just used my phone to hotspot the access. For some reason, I can access from outside the building network.

After getting the push to finally work, I noticed that the output has a dropdown which you can change the options. By default, it is on Intellisense which is why I have the message above. In the drop down, I found one for git and saw the error messages blasted multiple times. The error was that it did not have access to github. This would have saved me 90 minutes.


Solution

Make sure the output is showing the option.

Thursday, June 2, 2022

Video: Using Azure Pipeline Deploy to a Virtual Machine

https://www.youtube.com/watch?v=uSEx5QiuOCw

by Rahul Nath





I spent a long time to figure out how to do this. Microsoft's documentation is not obvious to me.