article mainly aims to summarize the work that needs to be done after we use the rename method to reconstruct the table. If you are not very clear, you must read this article carefully, at the same time, rectify the problem in the future table reconstruction work. Otherwise, the problem will come to you one day sooner or later!Ii.
Today I encountered a depressing problem about the database table name.
The table name of the SQL Server database can start with a number, but the table name cannot be directly written
(BYTE) is not null," Login_password "Varcha R2 (byte) is not NULL, "Register_time" DATE is not NULL, "FullName" VARCHAR2 (byte) is not null, "Sex" CHAR (1 BYTE) null, "Id_c ard "char" null, "email" VARCHAR2 ($) NULL, "Tel" char (one-byte) null, "Address" VARCHAR2 (+ byte) null, "work _units "VARCHAR2" null, "Monthly_income" number (8,2) null, "Bank_account" CHAR (BYTE) null, "Credit_rating" NUMB ER (1) NULL)The results are as follows:watermark/2/text/ahr0cdovl2jsb2cuy3nkbi5uzxqvd2fuz2hhaxbpbmcx
the finished work? This article is mainly inductive when we use the Rename method to reconstruct the table. What needs to be done, assuming you are not very clear. Be sure to read this article carefully. At the same time in the future reconstruction of the table work corrected. Otherwise. Sooner or later the problem will come to your side! ii. ways of rebuild
SQL obtains fields and corresponding descriptions based on the table name. For more information, see.
SQL obtains fields and corresponding descriptions based on the table name. For more information, see.
The Code is as follows:
Yesterday I went to an interview with one of these questions:
There is a score sheet with only two fields, names and grades. How do you query a student's name, score, and rank in a table with an SQL statement?I can not think of a specific implementation, I have two ideas: one is to associate a query through the join of his ranking of the
up when we use the rename way to rebuild the table, what needs to be done, if you are not very clear, you must read this article, and in the future reconstruction table work to rectify, otherwise, sooner or later, the problem will come to your side! ii. ways of rebuilding tables Let's just talk about the method of rebuilding the
1. Query all database names in the database:SELECT Name from Master. sysdatabases ORDER by Name2. Query all the table names in a database:SELECT name from SysObjects Where xtype= ' U ' ORDER by Name3. Query table structure information: 1 SELECT (case if A.colorder=1 then d.name else null end)
Exec sp_changeobjectowner '[bbsdb]. [dv_style]', [DBO]
Change the owner of objects in the current database
When you back up and restore the database, the owner is often the original user, so that when you use
When the table name is invalid, an error message is displayed. if you add the original user name, an error occurs,
So the best way is to change it to DB
Label:When you back-end programming uses the framework to connect to a database when the "column name or the number of supplied values does not match the table definition" exception information, if you confirm that your design column name and column values are the same as the SQL Server column
Map SQL Server Profiler eventclass ID to its name in a saved trace table
If you 've ever worked with SQL Server Profiler then you're familiar with the eventclass column in the trace.
It tells you what event is being monitored for each row. When you save this trace to a table
(' I _table_name'), upper (' I _owner') from dual;
Use tools like PL/SQL developer to view table definition statements.
3. Create a New _ old table (defined according to the extracted table above), and then use insert/* + append */xx select xxx to convert the data.
4. rename
Label: string text = "SELECT * from [admin] where aa=1 and cc= ' B ' ORDER by AA Desc";Regex reg = null; reg = new Regex (@ "\s+from\s+.*?" ( \s+where\s+|\s+order\s+|\s+group\s+) |\s+from\s+.+ ", regexoptions.ignorecase);string table = Reg. Match (text).
Value; Table = Regex.Replace (table. ToLower (), @ "\s+from\s+|\s+where\s+|\[|\]|\s+order\s+|\s+group\
SQL Server finds the file and file group based on the partition table name.
SELECT ps. name AS PSName, dds. destination_idAS PartitionNumber, fg. name AS FileGroupName, fg. name, t. name
Tags: select fill idt LAN row content query action GravityDouble-click the table default feel Expand/collapse expand/collapse sometimes need to view the data at a high speed, assuming that writing a select * from tab will appear troublesome,We can achieve high-speed query by double-clicking table.The method is:Double-click Action (Table), User Interface, Browser, Tools, Preferences, Quer Y Data)Reprint Plea
SELECTTableName= object_name(c.object_id), Columnsname=C.name, Description=Ex.value, ColumnType=T.name, Length=C.max_length fromsys.columns C Left OUTER JOINsys.extended_properties ex onex.major_id=C.object_id andex.minor_id=c.column_id andEx.name= 'ms_description' Left outer Joinsystypes T onc.system_type_id=T.xtypeWHERE ObjectProperty(c.object_id,'ismsshipped')=0 and object_name(c.object_id)='TableName' --1. Get all database names:SelectName fromMaster.. sysdatabasesOrDER byName--2. Get al
know which scanning tasks need to be completed ?? This article mainly aims to summarize the work that needs to be done after we use the rename method to reconstruct the table. If you are not very clear, you must read this article carefully, at the same time, rectify the problem in the future table reconstruction work. Otherwise, the problem will come to you one
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.