I have not solved this problem.
When a netizen asks me this question,I thought it was quite simple.,Assume that SQL Server should provide corresponding system variables or something.But so far,I have not yet obtained a better solution. It may be very simple, but I don't know. I hope so ..
Let me talk about the relevant knowledge..I hope you can provide a better method..
Here are several related con
When using SQL Server variables, the variable name is case-insensitive:
The current database is case-insensitive, but after declaring the variable, it is found that the variable name is case-sensitive. We always think that the collcation of the variable name of SQL Server
fromTb into @hostname while @ @fetch_status=0 begin Set @sql='Ping'+@hostname+'-a-n 1-l 1' Insert#ip (a)execMaster.. xp_cmdshell@sql Update#ipSetHostname=@hostname whereHostname is NULL Fetch Next fromTb into @hostname End Update#tbSetNet_ip=leftAPatindex('%:%'A-1) from#tb AInner Join (SelectHostname,a=substringAPatindex('Ping statistics for%:%'A+ -, -) from#ipwhereA like'Ping statistics for%:%') b on
Label:Using GETDATE () in the SQL Server date function to get the current date, the following will show you how to get the date using the SQL Server date function.But what if we just need to get the current date, do not need the
Label:Fix SQL Server 2008 error 15023: User or role already exists in the current database, SQLServer2008, error 15023,When using SQL Server 2008, we often encounter a situation where a database on one server needs to be transferr
server| objects
In database operations, you will use Objectowner.objectname to refer to objects when the list of database objects does not have a common element--objectname, but you can use system stored procedures if you need to change the owner of the objects in the current database sp_ Changeobjectowner (click here for more details)Sp_changeobjectownerChanges the owner of an object in the
Sp_change_users_login
Change the SQL Server user and Microsoft®SQL Server™The relationship between logon.Syntax
sp_change_users_login [ @Action = ] 'action'[ , [ @UserNamePattern = ] 'user' ][ , [ @loginName = ] 'login' ]Parameters
[@ Action =]'Action'
Describes the operations to be performed in this process.ActionThe
In database operations, you will use objectowner when the Database Object List contains more than one common element, objectname. objectname to reference objects, but if you need to change the owner of objects in the current database, you can use the system stored procedure sp_changeobjectowner (Click here for more details)Sp_changeobjectownerChange the owner of objects in the current database.Syntax: sp_ch
Label: using SQL Server today, I found a problem with the INSERT into database name. dbo. Table name (field) values (values) When this statement returns an error: SQL Server Principal The database cannot be accessed under the current security context.So I looked up the infor
Tags: authentication action Use a repository Lib class one mysqWhen using SQL Server, we often encounter a situation where a database on one server needs to be transferred to another server. When the transfer is complete, an error often occurs when you need to associate a "user" with a "login": "Error 15023: User or ro
A few days ago, when I upgraded the database of a communtiy server from SQL 2000 to SQL 2005, I encountered a strange problem and reported the following error:
Violation of primary key constraint 'pk _ cs_threads'. Cannot insert duplicate key in object 'dbo. cs_threads '.
After the analysis, we found that the table's auto-increment field database has reache
1. Use Management Tools
Start-> Administrative Tools-> performance (or enter MMC in the running) then, you can add common SQL statistics by adding counters and select user connections in the projects listed below to query the number of database connections from time to time. However, this method requires the permission to access the computer, that is, you must l
Label:when vs2015 imports MDF database files : This database file is incompatible with the current instance of SQL Server . mdf The version of the file is sql SERVER 2005 ,vs2015 The own database is LocalDB , direct import of mdf file will prompt : The s
Problem scenarios
During SQL Server database migration, after recovering the database backup file on another Server, you need to recreate the user account on the database. When creating a login User, you must authorize the User in User Mapping for the specific database. Because the recovered database contains a User account with the same name, "User, group, or ro
1. Through the management toolsStart with management tools, performance (or run the inside input MMC) and then add a counter by adding the SQL statistics and then select the user connection in the items listed below to always query the number of connections to the database. However, this method needs to have access to the computer's permissions, that is, to log in through the Windows account to add this counter.2. Querying through system tables?
In database operations, you will use objectowner when the Database Object List contains more than one common element, objectname. objectname to reference objects, but if you need to change the owner of objects in the current database, you can use the system stored procedure sp_changeobjectowner (Click here for more details)
Sp_changeobjectownerChange the owner of objects in the current database.Syntax: sp_
In database operations, you will use Objectowner.objectname to refer to objects when the list of database objects does not have a common element--objectname, but you can use system stored procedures if you need to change the owner of the objects in the current database sp_ Changeobjectowner (click here for more details)
Sp_changeobjectowner
Changes the owner of an object in the current database.
Syntax: sp
A few days ago, when I upgraded the database of a Communtiy Server from SQL 2000 to SQL 2005, I encountered a strange problem and reported the following error:Violation of primary key constraint 'pk _ cs_threads'. Cannot insert duplicate key in object 'dbo. cs_threads '.After the analysis, we found that the table's auto-increment field database has reached 6144,
To restore one data to another server, an exception occurred:the SQL Server Service Broker for the current database was not enabled, and as a result query notifications be not SUP Ported. Please enable the Service Broker for this database if you wish to use notifications.As follows:Workaround:Refer to the above steps,
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.