How to get Host name and SQL Instance Name by T-SQL

I am using SQL 2000, 2005 and 2008. I have few multi instances SQL servers. I would like to gather following information:
Host Name
SQL Instance Name
SQL Version
Server1
Server1
SQL 2000
Server1
Server1\ABC
SQL 2005
Server1
Server1\XYZ
SQL 2008
Server2
Server2
SQL 2008
Is there any way I can get it by T-SQL? Any help would be appreciated.
Thanks
Saumen 

SELECT
SERVERPROPERTY('MachineName') AS [ServerName],
SERVERPROPERTY('ServerName') AS [ServerInstanceName],
SERVERPROPERTY('InstanceName') AS [Instance],
SERVERPROPERTY('Edition') AS [Edition],
SERVERPROPERTY('ProductVersion') AS [ProductVersion],
Left(@@Version, Charindex('-', @@version) - 2) As VersionName
 |
Blog: MSBICOE.com |
MCITP - BI, SQL Developer & DBA
Hate to mislead others, if I'm wrong slap me. Thanks!

Similar Messages

  • How to get RFC Destination and Logical System name dynamically

    Hi all,
    I have a RFC FM written in CRM. I need to call this FM in R/3. So, i use the syntax " Call function <func> destination <destination name>. My problem is that i need to fetch the destination name dynamically..
    There is a way to do so in CRM which is as follows:
    DATA:  lt_siteselect TYPE TABLE OF siteselect INITIAL SIZE 0,
               ls_siteselect TYPE siteselect.
      CALL FUNCTION 'SMOF0_READ_SITESELECT'
        TABLES
          to_siteselect = lt_siteselect.
      READ TABLE lt_siteselect INTO ls_siteselect
             WITH KEY sitetypeid = cl_smw1_siteprovider=>c_sitetype_r3oltp.
    The above piece of code returns the site and also takes care of the client you are currently working on. But the specified FM is present only in R/3..
    I want to achieve the functionality fulfilled by the above code in R/3.
    Kindly help.
    Useful answers will be rewarded.
    Thanks in advance,
    Karan Merwana
    I can not use FM LOG_SYSTEM_GET_RFC_DESTINATION as for that i need to provide the logical system name. And the logical system name would be different for different clients.
    Message was edited by:
            Karan Merwana

    For those referring this thread later, I could not find a solution to this and ultimately had to do away with hardcoding of system names based on the DEV, Q, and PROD system names.
    If anyone does manage to get a workaround, please let me know.

  • How to get record created and modified user name from SharePoint Database?

    Hi,
    My SharePoint Portal is in Window Authentication. Some users have added requests to Lists. I want to find user name of the Created By and Modified By.
    Only ID is available in the corresponding columns in Content Database table. In which table the users details would store in Content Database.
    Thanks & Regards
    Poomani Sankaran

    hi, you can find the user details inside UserInfo Table in content database. But i would suggest not to directly query the content databse not even for select as it will affect the indexes.
    why not follow the link
    http://www.sharepoint4arabs.com/AymanElHattab/Lists/Posts/Post.aspx?ID=99
    also if you just need the basic created by and modified by info than use SharePoint Object Model To get these values using ECMA script use below link
    http://www.c-sharpcorner.com/UploadFile/anavijai/get-created-by-and-modified-by-values-from-sharepoint-2010-l/ using Client side object model https://msdn.microsoft.com/en-us/library/office/ee534956%28v=office.14%29.aspx?f=255&MSPPError=-2147217396
    Using server Side Object model
    http://www.sharepointcto.com/View.aspx?id=15
    Whenever you see a reply and if you think is helpful,Vote As Helpful! And whenever you see a reply being an answer to the question of the thread, click Mark As Answer

  • Get current SQL instance name with PowerShell

    Hi all,
    I'm preparing SQL agent job that will backup all jobs on SQL server. Main step is PoswerShell script. I want that job to be universal for all servers. The first parameter that I need to send to script is instancename.
    I want to use variable as InctanceName parameter. So, when I run this job on particular server this variable must get current SQL instance name.
    I can use $env:computername for default instances but I cannot use it with named instances or with clustered instances. Some solutions like using 'HKLM\SOFTWARE\Microsoft\Microsoft SQL Server\Instance Names\SQL' keys won't work because of number of
    instanses can be running on one machine.
    How to get only current SQL instance name?

    Hi, 
    Thank you for your answers.
    I found this solution:
    $serverInstance = "$(ESCAPE_DQUOTE(SRVR))"
    Working perfect.

  • How to get customer number and name from the SD document

    Hi All,
    Can you please let me know how to get Customer Number and Name from the SD Document?
    Thanks a lot....
    Anil

    Hi,
    It will be displayed in the SD (BIlling document) itself,  you clikc on the VF03. The customer name and number will also appear in the SO document also Tcode VA03
    regards,
    radhika
    Edited by: kolipara radhika on Jul 10, 2009 5:32 AM

  • CAD SQL Instance Name match

    Looking for clarification on CAD installation with SQL Data Store. The CAD Installation Guide states "It is required that your system include a separate SQL Server instance that hosts the CAD base services (on both servers in a replicated system). This is under the Configuring Microsoft SQL Server 2005 for CAD section.
    Do the SQL instance name for the side A and B servers need to match ? I believe the answer is yes but want to make sure.

    Yes, use the same name.  A few steps down there is the statement:
    "NOTE: It is recommended that you name the SQL instance that CAD will use CADSQL. Although, you can name this SQL instance anything you would like, the directions for this guide are written for use with CADSQL. You might have to deviate from these instructions if you do not use the name CADSQL."

  • How to get profile options & values at user & responsibility level by SQL?

    Experts, How to get profile options and values at user and responsibility level using SQL?

    SELECT
    po.profile_option_name as name
    , po.user_profile_option_name
    , decode(to_char(pov.level_id),'10001','SITE','10002','APP','10003','RESP','10005','SERVER','10006','ORG','10004','USER', '???') as "LEVEL"
    , decode(to_char(pov.level_id),'10001','','10002', app.application_short_name,'10003', rsp.responsibility_key,'10005', svr.node_name,'10006', org.name,'10004', usr.user_name,'???') as context
    , pov.profile_option_value as value
    FROM
    fnd_profile_options_vl po
    , fnd_profile_option_values pov
    , fnd_user usr
    , fnd_application app
    , fnd_responsibility rsp
    , fnd_nodes svr
    , hr_operating_units org
    WHERE 1=1
    AND pov.application_id = po.application_id
    AND pov.profile_option_id = po.profile_option_id
    AND usr.user_id (+) = pov.level_value
    AND rsp.application_id (+) = pov.level_value_application_id
    AND rsp.responsibility_id (+) = pov.level_value
    AND app.application_id (+) = pov.level_value
    AND svr.node_id (+) = pov.level_value
    and org.organization_id (+) = pov.level_value
    ORDER BY 1, pov.level_id, 5
    You'll need to apps initialize your SQL session before running this ...
    Regards,
    Jon

  • I can not transfer date from one hard drive to another, I keep getting an error because I have two of the same file names and one file name is in caps and I cant change the file name

    can not transfer date from one hard drive to another, I keep getting an error because I have two of the same file names and one file name is in caps and I cant change the file name. My original external has an error and needs to be reformatted but I dont want to lose this informations its my entire Itunes library.

    Sounds like the source drive is formatted as case sensitive and the destination drive is not. The preferred format for OS X is case insensitive unless there is a compelling reason to go case sensitive.
    Why can't you change the filename? Is it because the source drive is having problems?  If so is this happening with only one or two or a few files? If so the best thing would be to copy those over individually and then rename them on the destination drive.
    If it is more then you can do manually and you can't change the name on the source you will have to reformat the destination as case sensitive.
    Btw this group is for discussion of the Support Communities itself, you;d do better posting to Lion group. I'll see if a host will move it.

  • How to find output type givenSapscript form name and print program name

    Hi  Experts,
           Can anyone tell me how to find the output type of  a sapscript form if the print program name and sapscript form name is 
    known.

    Hi,
    There are two ways:
    1. Use table TNAPR .. Here is table give PGNAM as your print program name and FONAM as form name.. Now the field KSCHL will be the output type assigned to your script.
    2. You can also check the NACE t-code.. In that select a application(Corresponds to your area) -> click on Output types tab -> Here you get list of output type.. You need click on Processing Routine folder to get all other info..

  • How to get the list of unviewed Instances?

    Hi All,
    Can anyone tell me how to get the list of unviewed instances?
    I want to get all the instances which have been scheduled but not viewed.
    Please help me on this.
    I tried to get the info from audit report but i could not able to achieve it.
    is it possible from query builder?
    Thanks,
    Nagaveni

    Hi Ravi,
    Thank you for the reply!!
    Then it is not possible to get the unviewed reports.
    how does it work if i create a audit report with Viewed status and list of all instances then we can filter out the unviewed reports.
    Does above solution is going to work?
    i have not tried yet, seeking your opinion.

  • Failover clusterign... How similar do the primary and failover instance need to be in a failover cluster?

    How similar do the primary and failover instance need to be in a failover cluster?
    Does the number of database have to match, naming, general config etc...
    Mr Shaw

    In failover clustering, you use shared storage so the number of databases is irrelevant since only one node can see/access the shared storage at any given point in time. Ideally, the server configuration should be the same on all of the nodes to minimize
    potential issues that may impact downtime. However, you need to consider licensing/# of CPU-cores and implementation cost, especially if you are only using the other nodes as standby. As far as licensing is concerned, the standby has to have the same or fewer
    number of CPU-cores as the primary node to be covered by licensing. Besides, you don't want your standby node to be more powerful than your primary node. This is why the option to have a hybrid deployment of having a physical server as the primary node and
    virtual machine for standby nodes is now supported.
    Edwin Sarmiento SQL Server MVP | Microsoft Certified Master
    Blog |
    Twitter | LinkedIn
    SQL Server High Availability and Disaster Recover Deep Dive Course

  • My brother gave me his old ipod how do I remove his name and put my name on it so itunes will reconignes me

    My brother gave me his classic ipod, how do I remove his name and put my name so my itunes will recognize my computer?

    Hello Darryll,
    Welcome to the Apple Support Communities. If you want to change the name of the iPod, the following article assist with getting that setup for you.
    iTunes 11: Frequently used features
    http://support.apple.com/kb/HT5649
    Then you can change the name and sync the ipod with your library
    iTunes and iOS: Change the name of your iPhone, iPad, or iPod
    http://support.apple.com/kb/ht3965
    Connect your device and open iTunes.
    In the source list (the left-hand column of iTunes), double-click the name of your device.
    Type the new name for your device and press Return on the keyboard.
    Sync the device (press Sync in the bottom right corner of the screen).
    Regards,
    -Norm G.

  • How to get current time and date??

    How to get current time and date from my PC time and date to the java application??
    i use java.util.* package but got error, that is:
    - java.util.* and java.sql.* class are match
    - abstract class cannot be instantiated
    so what can i do, pls guide...thanks...

    There is a method in the System class that will return the current system time. You could also instantiate a Date, Time, Timestamp, or Calendar object, all of which get created with the system time by default.
    Don't import *. Import the specific classes you need.
    Next time, post the actual text of the exceptions/compile errors. If you make people guess, most just won't bother.

  • How to get BP kind based on user name?

    Hi,
    How to get BP kind based on user name?
    Is there any table other than BUT000 which gives the Business partner no. and BP KIND?
    What is BLUEPRINT table?

    Hi John,
    do you mean Type:
    1     Person
    2     Organisation
    3     Group
    or Role like
    000000     Business Partner (General)
    BBP000     Vendor
    BBP001     Bidder
    BBP002     Portal Provider
    BBP003     Plant
    BBP004     Purchasing Company
    BEA001     Billing Unit
    BUP001     Contact Person
    BUP002     Prospect
    BUP003     Employee
    BUP004     Organizational Unit
    BUP005     Internet User
    The Role can be found in BUT100.
    Regards
    Gregor

  • How to get system date and time?

    Can someone show me a code on how to get system date and time.
    Thanks!

    there is one really easy way to get system time, the api gives a great example of code on this. use gregorian calendar, which you'll find in the api under GregorianCalendar. You only need to create one instance of GC, ie Calendar time = new GregorianCalendar();
    you save seconds, minute and hours into int values, so you don't have to access the system time every second, you can create a thread which adds one to the int second value, if oyu see what i mean, for example, i have saved the hours, minutes and seconds as int values;
    int hour, minute, second;
    i can then create a thread (Thread thread = new Thread(this) and run it like:
    Calendar time;
    int hour, minute, second;
    Thread thread = null;
    public MyTime() {
    hour= time.get(Calendar.HOUR_OF_DAY);
    minute = time.get(Calendar.MINUTE);
    second = time.get(Calendar.SECOND);
    if(thread == null) {
    thread = new Thread(this);
    thread.start();
    public void run() {
    Thread t = Thread.currentThread();
    while(thread == t) {
    thread.sleep(1000);
    second++;
    if(second > 59)
    minute++;
    if(minute>59)
    hour++;
    formatTime();
    public void formatTime() {
    second = (second > 59? 0 : second);
    minute = (minute > 59? 0 : minute);
    hour = (hour > 23? 0 : hour);
    System.out.println(hour+":"+minute+":"+second);
    public static void main(String[] args) {
    new MyTime();
    I know this looks like gibberish but it should work. If not, try to fix the problem, i have written from memory really but i guarantee you, this gets the time then every second, simply adds one to the second and then formats time. You can also access the day, month and year then format them using the above code. I don't like giving code since you should really do these things yourself but it is 2:04am, i have nothing better to do and i am not tired so i did you a favour - i have become what i always did not want to, someone ho stays upall night writing code.

Maybe you are looking for

  • Can't open numbers files in latest version

    I'm running the latest version of numbers in Mavericks and iOs7. I was able to open a file yesterday, but now get this message "You need a newer version of Numbers to open this spreadsheet." I've double checked and all the versions are the latest. -

  • How to open with only level-one bookmarks showing

    I know how to set my initial view so the Bookmarks pane is open. However, is there a way to set the level of bookmarks that are shown? I have created my PDF by merging a lot of smaller files, many of which were created from MS Word, so there are many

  • What can i replace an iframe with? (Death to double scroll bars!!)

    So the site I'm working with has a ton of links all directed to an iframe.  The iframe is set to a fixed size and will not expand/contract with the linked content so i end up with two scroll bars. Here is the web site. I was hoping for a 'quick' fix

  • New CalDAV-account but no connection/no sync to Calendar

    Hi at all, I use David from Tobit for addresses and appointments. Therefore I created a new CalDAV account for syncing these data but the new calender is not available. I also miss to define the standard-calender in the settings for mail, contacts, c

  • Acrobat distiller 7.0

    Can someone help me? Am using Adobe Acrobat professional 7. When i use acrobat distiller 7.0 (Windows 2003 OS) try to convert text to pdf i receive an error as highlghted below %%[ ProductName: Distiller ]%% %%[ Error: syntaxerror; OffendingCommand: