Original: SQL Server name changed to local IP address loginWhen installing sqlserver2008, 2012 and so on is the default instance, the server name is the name of the computer, especially to log on to the local database, you need to enter the computer
SQL statement to query the SQL Server name and IP address, SQL Server
Get Server Name:
SELECT SERVERPROPERTY('MachineName')select @@SERVERNAMEselect HOST_NAME()
To obtain the IP address, run the ipconfig command in xp_cmdshell:
-- Enable
Modify the SQL Server Name (@ servername)
After SQL server2005 is installed, the computer name (xiage) is changed ),
However, the @ servername returned by the database is still fb4b6c04012d449/sqlexpress (the original default computer
Changes to the SQL Server name1. Use the SELECT @ @ServerName to see the server name of the current database 2. From the Sys.sysservers table, you can see all of the current server name 3. Use sp_dropserver ' servername ' to remove this server name.
SELECT @ SERVERNAME, SERVERPROPERTY ('servername ')-- Default instance
USE masterGO
-- Set two variablesDECLARE @ serverproperty_servername varchar (100), @ servername varchar (100)
-- Obtain information about the Windows NT Server and the
These texts are displayed in the Delphi box. The original author is lwp_lwp.With the original address: http://www.2ccc.com/article.asp? ArticleID = 2717This post is for reference only.
1. sqlservr.exe run parameters.SQL Server can be started in the
--Connect remote SQL or insert data with OPENROWSET--if only temporary access, you can directly use OPENROWSET--Query ExampleSelect * from OpenRowset('SQLOLEDB','SQL Server name';'User name';'Password', database name. dbo. Table name)--Import
From:https://www.cnblogs.com/railgunman/archive/2010/12/25/1916780.htmlConnect remote SQL or insert data with OPENROWSET--if it's just temporary access, you can use OPENROWSET directly--query ExampleSELECT * FROM OPENROWSET (' SQLOLEDB ', ' SQL
SQL Server connections across serversConnect remote SQL or insert data with OPENROWSET--if it's just temporary access, you can use OPENROWSET directly--query ExampleSELECT * FROM OPENROWSET (' SQLOLEDB ', ' SQL Server name '; ' User name '; '
1. enable Ad Hoc Distributed Queries
Enable the Ad Hoc Distributed Queries service before using openrowset/opendatasource. Because this service is insecure, SqlServer is disabled by default.
How to enable Ad Hoc Distributed Queries
SQL Server blocks
/* Data operations between different Server databases */-- Create a linked serverExec sp_addrole server 'itsv', '', 'sqloledb', 'remote server name or IP address'Exec sp_add1_srvlogin 'itsv', 'false', null, 'username', 'Password'-- Query
Data Development-Classic1. Sort by last name stroke:Select * from TableName Order by CustomerName Collate chinese_prc_stroke_ci_as//from less to more2. Database encryption:Select Encrypt (' original password ') Select Pwdencrypt (' original password
Data operations between databases on different servers
-- Create a linked serverExec sp_addrole server 'itsv', '', 'sqloledb', 'remote server name or IP address'Exec sp_add1_srvlogin 'itsv', 'false', null, 'username', 'Password'
-- Query
SQL code
Data operations between databases on different servers -- Create linked server Exec Sp_addmediaserver ' Itsv ' , ' ' , ' Sqloledb ' , ' Remote Server name or IP address ' Exec Sp_add1_srvlogin ' Itsv '
Data operations between databases on different servers
-- Create a linked serverExec sp_addrole server 'itsv', '', 'sqloledb', 'remote server name or IP address'Exec sp_add1_srvlogin 'itsv', 'false', null, 'username', 'Password'
-- Query
Copy codeThe Code is as follows: -- PK
Select * from sys. key_constraints where object_id = OBJECT_ID ('tb ')
-- FK
Select * from sys. foreign_keys where parent_object_id = OBJECT_ID ('tb ')
-- Create a linked server
Exec sp_addrole server 'itsv', ''
SQL Server Remote Login Server Management and query
/* Data operations between databases on different servers */-- create a link to the server exec sp_add+server 'itsv', '', 'sqloledb ', 'remote server name or IP address 'exec
Data operations between databases on different servers -- Create linked server Exec Sp_addmediaserver ' Itsv ' , ' ' , ' Sqloledb ' , ' Remote Server name or IP address ' Exec Sp_add1_srvlogin ' Itsv ' , ' False '
Http://www.uipower.com/bbs/thread-35773-1-1.html
/* Data operations between different Server databases */
-- Create a linked server
Exec sp_addmediaserver 'itsv','',' Sqloledb',' Remote Server name or IP address'
Exec sp_add1_srvlogin 'itsv',
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.