2 Replies Latest reply on Sep 10, 2012 8:47 AM by Adil Rathore

    How to change Date format in SQL



      I have a requirement to change date format for "Scan time" and "Boot time" from "Sep 9, 2012 8:01:32 AM GMT-07:00" to "9/9/2012 8:01:32 AM".


      Can someone suggest me what to modify in SQL query to change to specific date format in SQL server 2005 Ent edition.


      Below is the query I use to take report.

      select distinct inv_machine.name machine_name, inv_machine.domain, inv_machine.domain_role, inv_machine.machine_domain, inv_machine.mname, inv_machine.scantime, inv_machine.boot_time, inv_machine.serial_number, inv_machine.asset_tag_number, inv_machine.type, inv_machine.model, inv_machine.memory, inv_machine.number_of_processors, inv_processor.model, inv_processor.speed, inv_network.address, inv_network.netmask, inv_network.default_ip_gateway, inv_os.product, inv_os.version, inv_os.installdate, inv_patch.hot_fix_id, inv_machine_virtual.status as "Machine Virtual status", inv_person.username, inv_person.firstname, inv_person.lastname from inv_processor, inv_machine, inv_network, inv_os, inv_patch, inv_person, inv_machine_virtual where upper(inv_machine.domain_role) like '%SERVER%' and inv_network.machine_id = inv_machine.id and inv_os.machine_id = inv_machine.id and inv_person.machine_id = inv_machine.id and inv_processor.machine_id = inv_machine.id and inv_machine_virtual.machine_id = inv_machine.id and upper(inv_network.address) like '1%' and inv_patch.machine_id = inv_machine.id and inv_patch.os_id = inv_os.id