DB2: Procedures comments are not deployed via Data Studio - db2

I create a new stored procedure including comments
etc. /* this is a comment */. But if i have a look at the source tab of this procedure in data studio this line is gone.
What's going wrong here?
kind regards
Ralf

You can also consider using -- to show comments instead of /* */
The command line (CLP) preserves comments by default with current Db2 versions, i.e. you don't have to use Data Studio for deployment activities.
In Data-Studio, remember to tick the 'Deploy Option' "Deploy source to the database", as by default it is not ticked. In my 4.1.3 version of Data Studio, this preserves comments in SQL procedures.
Losing comments was reported in an old version of Data Studio with a workaround.
The workaround for the issue is to use the Routines Editor to create the stored procedure, then select the DEPLOY button. That will preserve comments.
Data Project Explorer
Right click on Stored Procedures
Select New->Stored Procedure
Select any of the templates and click Finish
Edit the generated coded and press the DEPLOY button, top right.
If you still have a problem and if your company has an IBM support contract then open a ticket with IBM to get it resolved.

Related

SqlPackage - How do I stop it from turning off my query store?

I have a database project in Visual Studio 2017. Our database project is managed just like any other library of code where multiple developers can update the project as necessary. To ease the pain of deployments, I have built a custom deployment task in our TFS 2018 (vNext) Build process that is a powershell script that calls sqlPackage.exe. SqlPackage compares our compiled database project (*.dacpac file) to our target database (in Dev, QA, etc.). I have the custom step configured so that it will write the expected changes to disk so I have a record of what was changed, then sqlPackage runs a second pass to apply the changes to the intended target database.
My DBA enabled the Query Store in our SQL 2016 Database. During my sqlPackage deployment, one of the initial steps is to turn the query store off, this makes my DBA unhappy. He wants the ability to compare pre and post deployment changes but if the query store gets turned off, we lose the history.
I have tried several of the switches in the documentation (https://msdn.microsoft.com/en-us/library/hh550080(v=vs.103).aspx#Publish%20Parameters,%20Properties,%20and%20SQLCMD%20Variables) but I can't seem to find the magic parameter.
How do I stop SqlPackage from turning off the query store?
My current script:
sqlPackage.exe /Action:Script /SourceFile: myPath\MyDatabaseName.dacpac" /OutputPath:"myPath\TheseAreMyChangesThatWillBeApplied.sql" /TargetConnectionString:"Integrated Security=true;server=MyServer;database=MyDatabase;" /p:DropObjectsNotInSource=false /p:DropPermissionsNotInSource=false /p:DropRoleMembersNotInSource=false /p:BlockOnPossibleDataLoss=True /Variables:"CrossDatabaseRefs=CrossDatabaseRefs
Is there a better way? I am surprised that I had to write a custom TFS Build Task to do this. Which makes me think that I might be doing it the hard way. (But this has worked pretty well for me for the last several years). I love database projects, I love that they enforce references and ensure that we don't break other objects when a column is dropped (for instance).
Any insight would be greatly appreciated.
Either disable the scripting of database properties using /p:ScriptDatabaseOptions=false, or update the database properties in the project to reflect the desired Query Store settings.
To set the Query Store settings in the project, right-click the database project in Solution Explorer and open Properties. From there, in the Project Settings tab find the "Database Settings..." button. In the Database Settings dialog, click the Operational tab and scroll down to find the Query Store settings.
Apparently, all we needed to do was add a post deployment script to re-enable the Query Store. Hope this helps someone out there...
USE Master
ALTER DATABASE [MyDbName] SET QUERY_STORE = ON

Mixed WaveMaker/Java project - how to do it?

WaveMaker is a RAD tool that generates Java and Javascript code - so:
Which files should be checked in to version control, and which files
should be ignored?
What happens if I want to customise the generated code? Will my customisations be silently overwritten?
Can customised code be round-tripped back into WaveMaker?
What about database changes made outside WaveMaker - can they be round-tripped?
If I make changes to generated code, will this change the answer to question 1?
Or, should direct customisation of generated code be avoided? If so, what should be done instead?
Here are answers to your questions:
Q1. Which files should be checked in to version control, and which files should be ignored?
A1. See the documentation on Software Configuration Management with WaveMaker, w
hich outlines which files should be checked-in. All others can be ignored.
Q2. What happens if I want to customise the generated code? Will my customisations be silently overwritten?
A2. WaveMaker Studio executes the code within Studio so your changes are reflected during development and, of course, are executed in your running application. You can further edit within WaveMaker as well.
Q3. Can customised code be round-tripped back into WaveMaker?
A3. Yes, most editors within WaveMaker have a "Refresh from Server" button so if you make changes outside of WaveMaker Studio you can force WaveMaker to re-read the file and load your most recent code. If there is no "Refresh from Server" button you can always close the project and re-open, which will force WaveMaker to re-read your code.
Q4. What about database changes made outside WaveMaker - can they be round-tripped?
A4. See A3.
Q5. If I make changes to generated code, will this change the answer to question 1?
Or, should direct customisation of generated code be avoided? If so, what should be done instead?
A5. I would recommend against editing the widgets.js file that is created for each page in your application. If you edit make sure you re-open the project after editing.

Finding previously deleted code in RTC later?

Conventional wisdom says to delete code once you don't need it -- as opposed to leaving it in the codebase as a comment -- because you can always find it later in the repository.
Let's say I need a line of code from the past which I remember to contain a very memorable substring ("XYZ", for discussion's sake).
What are my options for finding the previously deleted code using the Visual Studio 2010 Rational Team Concert (3.x) client? Can I search only the revisions of a single file (I might not know what file it was in)? Can I search quickly/easily across many files (w/o pulling those files out of the repository)?
I am not sure there is an easy way to get back the exact file with that missing string.
You can select show the history on a component of a Stream, in order to "Show the History files" for a given change set.
From there, you can do some "compare with Local File".
However, the Visual Studio integration might be less complete than the eclipse one, as this thread shows (where the "Show History" shows only the history of Deliver's).
Even though the following article uses the Eclipse GUI, have also a look at "Practicing source control archaeology with Rational Team Concert", which has other ideas for you to try.

How to export bug list (or any custom query) from TFS to Excel from a command line?

I need to export list of bugs from our Team Foundation Server to Excel. It's trivial to do it manually, but I need a command line version since the task needs to be automated.
Anyone knows how to do this?
To answer your origional question:
Add a new query in TFS, create your query and click save. This should give you an option to save the query either on the sever or locally. If you chose to save it locally and then change the extension from WIQL to .txt you will have the query available to you :-)
I hope you are aware that you have the option of using the 'Team' tag in your Excel/Project ribbon. Having said that, you can create a macro in excel that consumes the refresh or publish button on the team ribbon. Have a look at this sample macro http://blogs.msdn.com/b/teams_wit_tools/archive/2007/03/15/how-to-invoke-tfs-add-in-controls-from-macro-code.aspx
HTH.
Cheers, Tarun

AnkhSVN - keep local copy and get latest version

I m new to use ankhSVN and having issues. I have created some new files which are not commited. It was required that i need to get latest version. I right clicked the folder and selected update. I didnt get the latest version and also my files were not present. It had a question mark icon towards the left.
Ideally i want to know what is the procedure to use ankhSVN.
Thanks and regards,
Ashish Agarwal
Ashish.Agarwal#Renishaw.com
[Unrelated: Please remove your e-mail address from your question if you don't want to receive spam.. you can be notified on updates via RSS and mail via your profile settings].
The 'folders' you see in Visual Studio are not normal folders/directories. They are just filters on your project. For some project types they map to actual folders (E.g. C#, VB and websites), but for other projects they don't (E.g. C, C++, Setup, Database, ...).
So actually you are just updating the selection of the filter/folder and everything below.
For most tasks you should always update on either the solution, the project level or a single file, as updating a subdirectory without the project referencing the files inside is an operation that can leave you with a broken project. (New files won't be included in your project and old files won't be removed).
AnkhSVN allows you to update the whole directory at once by checking the [X] Recursive checkbox at the bottom of the dialog, but this is currently not the default setting.