TopMiniSite
-
7 min readWhen exporting data to a CSV file in PowerShell, you can separate columns by using a specific delimiter. By default, PowerShell uses a comma (,) as the delimiter when exporting to a CSV file. If you want to use a different delimiter, you can specify it using the -Delimiter parameter when using the Export-CSV cmdlet. For example, if you want to use a tab as the delimiter, you can use the following command: Export-Csv -Path "output.csv" -Delimiter "`t" -NoTypeInformation.
-
3 min readTo extract a value inside a column in a certain pattern in Oracle, you can use the REGEXP_SUBSTR function. This function allows you to extract substrings that match a specified regular expression pattern from a column.For example, if you have a column that contains text data in the following format: "Name: John", and you want to extract the value after the colon, you can use the following SQL query:SELECT REGEXP_SUBSTR(column_name, ':(.
-
5 min readTo connect to a SQL Server database using PowerShell, you can use the Invoke-Sqlcmd cmdlet provided by the SqlServer module. First, you need to import the SqlServer module by running the Import-Module SqlServer command in your PowerShell session. Then, you can use the Invoke-Sqlcmd cmdlet to connect to the SQL Server database by specifying the server name, database name, and your credentials.
-
4 min readMultithreading in PowerShell allows for concurrent execution of multiple threads within a script or command. This can be useful for improving performance by utilizing multiple CPU cores or for handling asynchronous tasks.To perform multithreading in PowerShell, you can use the .NET framework's System.Threading namespace, which provides classes for creating and managing threads. You can use the Start-Job cmdlet to start a new background job, which runs in a separate thread.
-
5 min readTo filter on raw data type in Oracle, you can use the RAWTOHEX function to convert the raw data into a hexadecimal representation. This allows you to perform comparisons and filter the raw data based on specific criteria. For example, you can use the WHERE clause in a SQL query to filter raw data using the RAWTOHEX function to convert the raw data into hexadecimal format. Additionally, you can also use comparison operators such as =, >, <, etc.
-
5 min readTo properly export to CSV using PowerShell, you can use the Export-Csv cmdlet. First, you need to select the data that you want to export using a command such as Get-Process or Get-Service. Then, pipe that data to Export-Csv with the desired file path where you want to save the CSV file. You can also specify additional parameters such as -NoTypeInformation to exclude the type information from the CSV file.
-
3 min readTo pass a value as a parameter to join tables in Oracle SQL, you can use a WHERE clause in your SQL query. This clause allows you to specify the condition by which the tables should be joined.For example, if you have two tables A and B that you want to join on a specific column, you can pass the value of that column as a parameter in your query.Here's an example query:SELECT * FROM table_A A JOIN table_B B ON A.column_name = B.column_name WHERE A.
-
8 min readTo process custom log data using PowerShell, you can start by reading the log data from a file or another source using the appropriate cmdlet or script. Once you have the log data loaded into PowerShell, you can then parse and analyze it to extract the information you need.One common approach is to use regex (regular expressions) to match patterns in the log data and extract relevant information such as timestamps, log levels, error messages, etc.
-
3 min readTo exclude data based on the weeks in Oracle, you can use the WHERE clause in your SQL query. You can use the WEEKOFYEAR function to extract the week number from a date and then use this information to filter out the data you want to exclude. For example, you can use a condition like WHERE WEEKOFYEAR(date_column) <> some_week_number to exclude data from a specific week.
-
4 min readTo force delete an open file using PowerShell, you can use the "Remove-Item" cmdlet with the "-Force" parameter. This command will forcefully delete the file even if it is being used or locked by another process.To do this, open PowerShell as an administrator and use the following command: Remove-Item -Path "C:\path\to\file\file.txt" -Force Replace the "C:\path\to\file\file.txt" with the path to the file you want to delete.
-
3 min readTo grant privilege to a row in Oracle, you can use the concept of Virtual Private Database (VPD). VPD allows you to selectively apply security policies to individual rows in a table based on specific criteria.To grant privilege to a row, you can create a security policy using the DBMS_RLS package. This policy will define the conditions under which a user can access a specific row in a table.