SQL Programming: Saving/Listing each row in a SQL SELECT query results set

While debugging various enterprise management software’s that ship with a data hosted on SQL database, systems engineers requires to run various SQL queries to get the underlying information. While debugging the results returned from the query, one need to be able to observer each row returned by the SQL query. Here is quick way to run your any DQL query and verify the results at each row. This will be essentially handy when you want to inspect the temporary data in your SQL program. [code language=”sql”] DECLARE @action_code INT DECLARE row_cursor CURSOR FOR SELECT ACTUALACTION_IDX FROM test_gunnalag OPEN row_cursor — […]

Read more

Perl Code to Parse File Versions

In various automations,. systems engineers require to determine the version of file to perform a action based on the file version. Here is a excerpt code that checks for the version of a specified file. CODE#1 [code language=”perl”] #=============================================================================== # sub CheckFileVersion #=============================================================================== sub CheckFileVersion { if (-e "$File") { my $cmd = "filever \"$File\""; my $output = `$cmd`; my @lines = split(/ /, $output); my $ver = ($lines[7] eq ”) ? $lines[8] : $lines[7]; my @version = split(/\./, $ver); my $filever = $version[0]; if ($filever) { print "INFO: $File major version is $filever\n"; } else { print "ERROR: Failed […]

Read more

SQL Programming: Convert UTC Time to Local Time

Most of todays enterprise software’s get data gathered from workstations located various parts of the world that run in different time zones. To ensure the data integrity and proper processing of events/information, software’s rely on saving the date  data in UTC and then convert them at run time for reporting. When you have to run queries manually, you need to take care of this note and as well need to convert the date data into your local time and here is a quick trick that can help you. [code language=”sql”] –You can calculate the offset from UTC easily enough: select […]

Read more