1 distince value can be used for column name Distince ID cannot be distince *
2 Time Function Day (getdate ()) Gets days year (GETDATE ()) Gets the month (GETDATE ()) months DateDiff (Day,getdate (), ' 2015-12-14 ') Gets the time difference, DateAdd plus DatePart Datename get part of time
3 stored procedures in the final or SQL statement assembly, for the frequently used data source with temporary table, you can be a temporary table as a temporary variable form,
Table TEMP Variable
4 Select
' INSERT into [dbo]. [Common_street] VALUES ('
+convert (varchar (), ID)
+ ', ' + streetname+ '
+ ', ' '
+ ', ' +convert (varchar), SUBSTRING (streetcode,0,7))
+ ', ' +convert (varchar (), IsDeleted)
+ ', ' + streetcode+ '
+ ', 0 '
+ ') '
From Tempstreet the use of stitching strings, write BULK INSERT statements, the main or the thinking limit
5 temporary table temporary variable temp table variable
6 stored procedure SET NOCOUNT on:
When SET NOCOUNT is on, no count is returned (indicating the number of rows affected by the Transact-SQL statement). When SET NOCOUNT is OFF, the count is returned.
If some of the statements contained in a stored procedure do not return much of the actual data, this setting can significantly improve performance because of the significant reduction in network traffic.
If some of the statements contained in a stored procedure do not return much of the actual data, this setting can significantly improve performance because of the significant reduction in network traffic.
SQL Learning Notes