-------Get table names by field nameSELECT Sb.nameFrom syscolumns s joins sysobjects SB on s.id=sb.idWHERE s.name= ' Your field name 'Left join returns records that include all the records in the left table and the equivalent of the junction fields
Note: Before you do this, you need to back up the database before you can delete the error1. Enquiry' %cases% '2. Stitching statementsSELECT'Drop Procedure'+namefrom SysObjects WHERE name like'%cases%'and type='P'; SELECT'Drop View'+namefrom
use dbnameselect * from sysobjects WHERE (xtype = " u " ) Goxtype can be replaced with the following parameters --c = CHECK constraint --d =--f = FOREIGN KEY constraint --l = log--fn = scalar function --if = inline table function --p = stored
Before sqlserver2005, it is cumbersome to implement recursion, for example, you might want to use a temporary table with a while statement to loop. Since sqlserver2005, the new with AS function syntax, the common expression (CTE), makes recursive
1: Add a field to the tableAlter table [table name] add [column name] Type2: Delete FieldAlter table [table name] Drop column [column name]3: Modify the field type in the table (you can modify the type of the column, whether it is empty)ALTER TABLE [
SQL Server finds objects that contain stringsSELECTSm.object_id,object_name(Sm.object_id) as object_name, O.type, O.type_desc, Sm.definition fromSys.sql_modules asSMJOINSys.objects asO onSm.object_id =O.object_idwhereSm.definition like '% of content
A trigger is a special kind of stored procedure that is invoked primarily by an event to trigger, and the stored procedure must be called through the name of the stored procedure.First, the definition of triggersA trigger is a special stored
Last semester in the company's internship in the company's national map of the project, found that the front-end of the rapid search, statistical analysis and so on is actually called the database server side of the stored procedures or views,
--Instructions for use--HDOCSN is the name of the database to be modified--hdocsn_log is the name of the log file to be purged--Modify all the HDOCSN you see as the name of the database to be purged--Modify the log file name of Hdocsn_log for all
SQL Server Compilation and recompilationMeaning of the compilation
When SQL Server receives any one instruction, including query, batch, stored procedure, trigger (trigger), precompiled directives (prepared statement), and dynamic SQL
--Table data manipulation---- Add Table Data ---- adding data to an existing table --[Use the database name to manipulate the data tableGoInsert [into] datasheet [(Field name 1, field name 2, field name 3, ...)] VALUES (value 1, value 2, value 3, ...
1, longitudinal table turn horizontal tableTABLE_A structure of the longitudinal table:Post-conversion structure:SQL example of a vertical table to a table:SELECT Name,SUM (case when Course = N ' language ' then GradeELSE 0END) as Chinese,SUM (case
SQL Server implements the code of a digital auxiliary table instance.
The Number Auxiliary table is a continuous integer series, which is usually used to implement multiple different query tasks. Most of them are divided into two categories: a large
After SQL2000 is installed, the SQL Server group has no project solution. sql2000server
Yesterday I installed SQL2000, opened the Enterprise Manager, and found that there was no content in the SQL Server group, prompting "no project ". This problem
How does SQL Server View the locked table and how to unlock it?
View the locked table:
Select spIdfrom master... SysProcesseswhere db_Name (dbID) = 'database name' and spId <>@spidand dbID <> 0
Unlock:
Exec ('Kill '+ cast (@ spid as varchar ))
SQL server compilation and recompilation details, SQL server
SQLSERVER compilation and recompilation
Meaning of compilation
When SQLSERVER receives any command, including query, batch, stored procedure, trigger)
Pre-compiled commands (prepared
How to solve the session blocking problem in SqlServer, sqlserversession
Introduction
It is common for database O & M personnel to create sessions or query problems. The following describes a very effective method to solve similar problems without
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.