If you want to manipulate a table to have a certain understanding of the table, then you can use two sentences SQL to intuitively understand the table structure
sp_help table name;
And
sp_columns table name;
There are also some very basic operations, such as:
1, query the current system date: SELECT GETDATE ();
2. Execute function SELECT dbo. F_func_log_batch_no ();
3. Stitching data: UNION ALL
4. Date format: SELECT (CONVERT (varchar), MAX (field), send_time) from table
5, or
Select Datename (Year,getdate ()) + '-' +datename (Month,getdate ()) + '-' +datename (Day,getdate ())
In addition, Datename () can also get hours, times, seconds, days of the week, weeks, respectively, as follows:
Select Datename (Hour,getdate ())
Select Datename (Minute,getdate ())
Select Datename (Second,getdate ())
Select Datename (Weekday,getdate ())
Select Datename (Week,getdate ())
Note that in the stored procedure it does not have Oracle as the create or replace , and all publications should be careful not to open the stored procedure directly after saving it into the release package.
Be aware that stored procedures that are opened directly can only be modified, not created, but can be
Save the statement that created the stored procedure.
At the same time, the general mode of the stored procedure is
SETAnsi_nulls onGOSETQuoted_identifier onGO-- =============================================--Author: <Author,,Name>--Create Date: <create date,,>--Description: <Description,,>-- =============================================CREATE PROCEDURETable name@I_INPUT_VALUES VARCHAR( -) asBEGIN /*data go to space*/ SET @I_INPUT_VALUES = LTRIM(RTRIM(@I_INPUT_VALUES)) /*defining variables and assigning values*/ DECLARE @ERROR_MESSAGE VARCHAR(4000) SET @ERROR_MESSAGE="' BEGIN TRAN BEGINTRYPRINT('do some work') COMMIT ENDTRYBEGINCATCHROLLBACK SET @ERROR_MESSAGE =error_message ()--Logging error Logs ENDCATCHENDGO
Create stored procedure general mode
SQL Server Common Syntax