SQL Server Performance

need to know abt server name

Discussion in 'Getting Started' started by jagpalsingh4, Feb 26, 2008.

  1. jagpalsingh4 New Member

    use adventureworks
    select 'current_date' =getdate ( ),name,size*8/1024 from sys.database_files
    this query is woking fine but still we just want to add server name in this query as well .i know the query to see server name but i dont know how to apply in it .
    select name from sys.servers
    so will u plz tell me how can i add this query
  2. jagblue New Member

    You can use
    Like this
    select 'current_date' =getdate ( ),name,size*8/1024,@@SERVERNAME as Servername from sys.database_files
  3. jagpalsingh4 New Member

    really thaxx that u can solve my problem .
  4. jagpalsingh4 New Member

    will u plz tell me if i need this t-sql query in script file like in oracle we used spool but in sql what we use
    select 'current_date' =getdate ( ),name,size*8/1024,@@SERVERNAME as Servername from sys.database_files
  5. jagblue New Member

    you can use osql utility to run this script file
    you can check Booksonline for more detalies on this.
  6. jagpalsingh4 New Member

    hello ,
    plz tell me actully i have tried but i cant go through .will u plz tell me the procees .
    so .thaxxx
  7. jagblue New Member

    what is your requirement requirement?
    you can run following command at dosprompt
    osql -Uuername -Ppassword -Sservername -i inputfile.sql -o outputfile.txt
    you can ignore -U and -P switch if it's Windows Authentication
  8. jagpalsingh4 New Member

    just solve this bcause i cant get it
    how to spool or script itselect 'current_date'=getdate (),name,size*8/1024,@@servername as servername
    from sys.database_files
    this one plz clear this to mee

Share This Page