There are many discussions about stored procedures in the garden, many people suggest that the SQL statement in the program, this essay discusses the SQL statement in the process of writing.
1string strSQL = "SELECT [Addressid], [AddressLine1], [AddressLine2], [City], [StateProvinceID], [PostalCode], [ ROWGUID], [ModifiedDate] from [AdventureWorks]. [Person]. [Address] WHERE city = ' Bothell ' ORDER by Addressid;
This is the most common form of writing, and is widely used in development.
String strSQL = "Select" +
"[Addressid]," +
"[AddressLine1]," +
"[AddressLine2]," +
"[City]," +
"[StateProvinceID]," +
"[PostalCode]," +
"[Rowguid]," +
"[ModifiedDate]" +
"From" +
"[AdventureWorks]. [Person]. [Address] " +
"WHERE" +
"City = ' Bothell '" +
"ORDER BY" +
"Addressid";
The second type of writing, in addition to making people more comfortable, there is no benefit.
The above figure shows a better way to reduce maintenance difficulties, improve development efficiency, team development should be the small details of the provisions. Of these, the 1th in the diagram can look at the SQL statements generated in SQL Server 2005 from the following Figure menu, but don't know why SQL Server 2005 's Query Editor generates SQL statements that are still lame. Microsoft can fully parse SQL statements and make them a more development-friendly format.
The above figure shows a better way to reduce maintenance difficulties, improve development efficiency, team development should be the small details of the provisions. Of these, the 1th in the diagram can look at the SQL statements generated in SQL Server 2005 from the following Figure menu, but don't know why SQL Server 2005 's Query Editor generates SQL statements that are still lame. Microsoft can fully parse SQL statements and make them a more development-friendly format.
If two tables are connected, statements such as INNER (Left/right) Join should also be written on one line. In addition, it is recommended to use a simpler English alias instead of the Chinese table name.