Thursday, August 30, 2012

How do you transfer or export SQL Server 2005 data to Excel

Option 1:
  1. Right-click the database in SQL Management Studio
  2. Go to Tasks and then Export data, you'll then see an easy to use wizard.
  3. Your database will be the source, you can enter your SQL query
  4. Choose Excel as the target
  5. Run it at end of wizard

If you wanted, you could save the SSIS package as well (there's an option at the end of the wizard) so that you can do it on a schedule or something (and even open and modify to add more functionality if needed).


Option 2:

  1. Select menu item Query > Query Options.
  2. Set check box in Results > Grid > Include column headers when copying or saving the results.

After that, when you Select All and Copy the query results, you can paste them to Excel, and the column headers will be present.


Option3:

  1. Open Excel Data>Import/Export Data>Import Data Next to file name
  2. Click "New Source" Button On Welcome to the Data Connection Wizard,
  3. Choose Microsoft SQL Server. Click Next.
  4. Enter Server Name and Credentials.
  5. From the drop down box, choose whichever database holds the table you need.
  6. Select your table then Next.....
  7. Enter a Description if you'd like and click Finish.

When your done and back in Excel, just click "OK" Easy.

Thursday, August 23, 2012

Linux change the speed and duplex settings of an Ethernet card

Task: Get speed and other information for eth0

Type following command:
# ethtool eth0Output:

Settings for eth0:
Supported ports: [ TP MII ]
Supported link modes: 10baseT/Half 10baseT/Full 100baseT/Half 100baseT/Full
Supports auto-negotiation: Yes
Advertised link modes: 10baseT/Half 10baseT/Full 100baseT/Half 100baseT/Full
Advertised auto-negotiation: Yes
Speed: 100Mb/s
Duplex: Full
Port: MII
PHYAD: 32
Transceiver: internal
Auto-negotiation: on
Supports Wake-on: pumbg
Wake-on: d
Current message level: 0x00000007 (7)
Link detected: yes

Task: Change the speed and duplex settings

Setup eth0 negotiated speed with ethtool# ethtool -s eth0 speed 100 duplex full
# ethtool -s eth0 speed 10 duplex half
To make these settings permanent you need to create a shell script and call from /etc/rc.local(Red Hat) or if you are using Debian create a script into the directory /etc/init.d/ directory and run update-rc.d command to update the script.

Read man page of ethtool for more information.

Monday, August 20, 2012

LDAP test connection

LDAP should be on port 389
Use LDAP browser tool to test connections
http://www.ldapadministrator.com/download.htm
It’s free and works well

Tuesday, August 14, 2012

How can I move my database files in SQL Server?


  • Start SQL Server Management Studio
  • Expand the server instance, expand Databases
  • Right-click the database you want to move, and choose "Properties"
  • In the Properties window, choose "Files" and write down the current file paths. Click "Cancel"
  • Right-click the database again, and choose "Tasks - Detach..."
  • Click "OK" in the next window
  • Use Windows Explorer to move the data and log files (.mdf and .ldf) to the new location
  • Right-click Databases, and choose "Attach..."
  • In the "Attach databases" window, click "Add"
  • In the "Locate database files" window, browse to the new location and select the .mdf file. Click "OK"
  • In the details pane, verify that the new location is listed for both the .mdf and the .ldf file. Click "OK"
  • In SQL Server Management Studio, choose "View - Refresh" and verify that your database is listed again under Databases