SQL statement-obtain the database name, table name, stored procedure, and parameter list
I have been familiar with data transfer services of different databases. To facilitate data import and export, I developed a small tool to export and import data, the SQL statements tha
A. rename a table
Rename the table oldtablename to newtablename:
Exec sp_rename 'oldtablename', 'newtablename'
B. rename a columnRename the column oldname in table 1 to newname.Exec sp_rename 'table1. oldname', 'newname', 'co
server| variable | solve
Recently wrote procedure, encountered some problems. I think the question of "Use variable name as table name" is more valuable, write and share with us. Please do not hesitate to enlighten me if you have a good solution.
Scene:
If you are writing procedure, create a table dynamically based
Tags: plsql developer text EditingOriginal works, from the "Blue Blog" blog, Welcome to reprint, please be sure to indicate the following sources, otherwise, the legal responsibility to pursue copyright.Deep Blue Blog:http://blog.csdn.net/huangyanlong/article/details/41513537Experiment: Use PL/SQL developer software to get the text form of table name and column n
xtype= ' PK ') Alter TABLE stuinfo Drop Constraint Pk_stuno Go--Re-add PRIMARY KEY constraint Pk_stuno ALTER TABLE stuinfo add CONSTRAINT pk_stuno PRIMARY key (Stuno) Go--Example 3 adds a unique UQ constraint (unique CONSTRAINT)--exists only A constraint Uq_stuno, delete the IF EXISTS (SELECT * from sysobjects WHERE name= ' uq_stuid ' and xtype= ' UQ ') Alter
SQL statement query the table name/column name/primary key/automatic Growth Value in the database---- Query tables created by users in the database---- Jsj01 indicates the database name.Select name tablename from jsj01.. sysobjects where type = 'U' and
MySQL command rename tables rename table syntax
RENAME TABLE tbl_name to new_tbl_name[, tbl_name2 toNew_tbl_name2,...]Renaming is performed atomically (atomically), which means that when the name change is running, no other threa
= single user; Use sp_dboption to set. Only one user can access the database at a time.32768 = emergency mode.4194304 = autoshrink.1073741824 = cleanly shutdown.
You can open multiple locations at the same time.
For example, determine whether a database is offline.Select * From master. dbo. sysdatabases where name = 'pubs' and status
Check whether the table object exists in
This article describes how to use SQL statements to determine whether table names and field names exist.
This article describes how to use SQL statements to determine whether table names and field names exist.
1. Whether the field exists
The Code is as follows:
If (count (*) from syscolumns
, we need to use a way to help us automatically generate modified statements, and then copy out to execute it.Modify Table Name:1 Select ' ALTER TABLE " '| | table_name| | ' '| | UPPER (table_name) | | ' ; ' from where table_nameModify Field Name:1 Select ' '| | table_name| | '
There is a temporary task today that modifies the database table name and field name of the production environment. Previously to modify table name field names are in the development environment, directly openSQL Server found the corresponding
decimal places, (case when. isnullable = 1 then '1' else'0' end) can be null, isnull (g. [value], '') AS field description FROM syscolumnsLeft join policypes B on a. xtype = B. xusertypeInner join sysobjects d on a. id = d. id and d. xtype = 'U' and d. name Left join syscomments e on a. cdefault = e. idLeft join sysproperties g on a. id = g. id AND a. colid = g. smallidWhere d. name = 'input'Order by a. id
Tags: plsql developer table Structure ComparisonOriginal works, from the "Blue Blog" blog, Welcome to reprint, please be sure to indicate the following sources, otherwise, the legal responsibility to pursue copyright. Deep Blue Blog:http://blog.csdn.net/huangyanlong/article/details/45746893 Experiment: Plan the table for the experiment.
Library
User
SQL queries the Table Name and description table field (column) Information in the MySql database, sqlmysql
The following describes how to use an SQL query statement to obtain the name of a ta
About SQL data table Stored Procedure table name prefix into dbo code, sqldbo
1. Replace all table names with dbo
2. replace all stored procedures with dbo
Then run
Label:Delete the table containing the specified stringCREATE PROCEDURE Sys_deletetablebytablename (@bianliang varchar (100))AsBeginDECLARE @biao varchar (+), @sql varchar (1000)Set @sql = '% ' [email protected]+ '% 'Declare c cursor for select name from sysobjects where type= ' u ' and
In SQL ServerEach database has a table generated by the system.The table sysobjects records all the table names in the database.We can use the following SQL syntax for query operations.
Copy codeThe Code is as follows:Select Name
In SQL ServerEach database has a table that is produced by a systemSysobjects this table records all the table names in the databaseWe can use the following SQL syntax for the query action
Copy Code code as follows:
Select nam
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.