Pages

Tuesday, December 6, 2011

How to export query result in oracle

In may times, we often want to export the query results in the oracle into a text file with a specific format. In this blog we will discuss about how to export query results in the oracle into a text file.
To do so run the following script:
set head off 
spool c:\myoracle.txt
select field1||', '||field2||', '||field3 from my_table;
spool off
set head on
Notes :
This script will create a comma delimited file named: c:\myoracle.txt
Make sure you replace "my_table" with the actual table name.
And replace the field1, field2, with your column names.

Monday, December 5, 2011

How to Change the firewall scope in windows server 2003

Firewall is a software/hardware used to provide specific rules on a computer/server. The goal is to make our computer more secure from hacker attacks. In windows there is a built in firewall that can be set in such a way. By default the port is closed by a firewall, so that when we turn on the firewall, we must define the program/​​service that is allowed for access.

One program that is blocked by a firewall default is the file/printer sharing. When we turn on the firewall, then we can not share folders on our computer. In order to share we must add the File/Printer Sharing in Firewall exception.

By default the firewall exception is on the scope of subnet. So shared file can only be accessed on a computer in one subnet with our computers. To change the scope of the firewall do the following steps:
  1. Open windows firewall
  2. Click exception tab
  3. Click File/Printer sharing
  4. Click Edit
  5. Click Change Scope on every port
  6. Choose any computer or other choise as your need

Sunday, December 4, 2011

How to trim on mssql

Trim is a standard function which is used by many programming languages to remove the space character in a string. For example ' Hello world ', with trim function, it will be 'Hello world'.

In SQL Server, trim function is not provided by default. We need to do a certain trick to remove the spaces. we can use LTRIM and RTRIM function together.

Here's an example to remove spaces in SQL Server:
select LTRIM(RTRIM(' Hello world '))
Don't Forget To Join Our Community
×
Widget