When writing code generator encountered such a problem, want to set up a database after the field description as comments written into the class file, so we searched the Internet a lot of code a long long way (of course, my code is very long), the
MySQL reserved word list. Bark finishing.Attempting to use a qualifier, such as using an embedded MySQL data type or function name as a table or column name, such as timestamp or group, can cause a common problem. Allows you to do this (for example,
When learning hibernate, the database uses PostgreSQL, the first lesson is thrown wrong, user entity mapping is not alive or alive cannot export the table. Always prompt this sentence:Error:syntax ERROR at or near "User". Later found that if the
SELECTTableName= object_name(c.object_id), Columnsname=C.name, Description=Ex.value, ColumnType=St.name, Length=C.max_length fromsys.columns C Left JOINsys.extended_properties ex onex.major_id=C.object_id andex.minor_id=c.column_id andEx.name=
PostgreSQL gets all the table names in the database:SELECT TableName from Pg_tables WHERE not like ' pg% ' and not like ' sql_% ' ORDER by TableNamePostgreSQL Gets the annotation information for all table names and table in the database:
1. Add a field ALTER TABLE user add COLUMN new1 VARCHAR (x) DEFAULT NULL; Add a field that defaults to null ALTER TABLE user add COLUMN new2 VARCHAR (a) not NULL; Add a field, default cannot be empty//2. Delete a field ALTER TABLE
Title, the result will be that the value of the parameter will not be the value you passed in, but the value of the field for each record.The consequences of this are often severe. For example, to perform a delete operation, it can completely delete
CONVERT (varchar (10), field name, conversion format)CONVERT (nvarchar), count_time,121Convert is a date conversion function, typically in the time type (Datetime,smalldatetime) and the string type (Nchar,nvarchar,char,varchar)The 3 parameters of
Direct error reporting without using dynamic statementsIncorrectCopy codeThe Code is as follows:Alter proc testpapersAsBeginDeclare @ tems nvarchar (max), @ zidaun nvarchar (max)Set @ tems = select * from @ tems order by @ zidaunExec (@ tems)EndExec
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
Laravel changes the default field name used for logon. in the authentication system provided by Laravel, the user is authenticated by email and password. In fact, Laravel provides an attribute to replace the default email field, you can add the
Problem:The first column of the gridview is buttonfield, and the field name is "delete". If you want to delete it, a confirmation box is displayed. Otherwise, how should I write the result?Solution:1. Click the shortcut arrow of the gridview and
I hope that I can clearly analyze the primary and foreign key tables and field information like SQL Server, use an SQL statement to write out the one-to-one correspondence between the fields in the primary and foreign key tables, and find them
To implement dynamic incoming table names and column names, you need to make the following modifications
Add Property statementtype= "STATEMENT"
At the same time, the value of the genus variable in SQL is changed to ${xxxx} instead of #{
1. Whether the field exists The code is as follows:Copy code If (select count (*) from syscolumns where name = 'field name' and id = (select id from sysobjects where name = 'Table name') = 0)BeginEnd 2. Whether the table exists The code is as
In the previous article, we created the Hibernateconfigurationutil class, which can be used to obtain information about the table name and column name of the entity class, and we will use the Hibernateconfigurationutil class as well as the Java
No direct error using dynamic statements
of the wrong
Copy Code code as follows:
ALTER PROC Testpapers
As
Begin
declare @tems nvarchar (max), @zidaun nvarchar (max)
Set @tems =select * from @tems ORDER by @zidaun
EXEC
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.