SQL Server Performance

is it possible to change an instance server properties with T-SQL ?

Discussion in 'ALL SQL SERVER QUESTIONS' started by pooya, Dec 31, 2012.

  1. pooya New Member

    hi
    can i change the properties of a server instance with T-SQL ...like Enabling mixed mode or change the name of server ?
  2. Shehap MVP, MCTS, MCITP SQL Server

    Sure you can do that , just you can use numerous T-SQL Queries which you can find out most of them easily by just selecting the needed option then you can tab the script button exists at the above of Server Properties to generate the relevant T-SQL Script like the below T-SQL Query used to change Degree parallelism

    EXEC sys.sp_configureN'max degree of parallelism', N'4'
    GO
    RECONFIGURE WITH OVERRIDE
    GO

    And the below one used to enable mixed mode:

    EXEC xp_instance_regwriteN'HKEY_LOCAL_MACHINE', N'Software\Microsoft\MSSQLServer\MSSQLServer', N'AuditLevel', REG_DWORD, 3
    GO

    Please let me know if any further help is needed
    pooya likes this.
  3. pooya New Member

    thank you very very much....
    can i use this to restart SQL service ...like that i Right click on Server name and Choose Restart.i want do this in T-SQL.
  4. Shehap MVP, MCTS, MCITP SQL Server

    For server restart , you should use xp_cmdshell SP to run the CMD prompt Net start SQLService name

    please let me know if any further help is needed

Share This Page