Stored Procedure generator (CSDN)

Source: Internet
Author: User
-- ===================================================== ======
-- Author: shipeng. wang
-- Create date: 2010-12-31
-- Description: automatically generates the add, delete, and modify parameters stored procedure and call code based on the table name.
-- ===================================================== ======
Create proc [dbo]. [sp_SendCode]
@ Tablename varchar (20), -- table name
@ Type int = 1, -- type (1: stored procedure, 2: called code)
@ Opertype int = 1, -- operation type (1: Query, 2: add, 3: Change, 4: delete)
@ Fields varchar (2000) = '*', -- the column to be operated (valid when querying, adding, or modifying). All columns are operated by default. Multiple columns are separated by commas)
@ Where varchar (500) = ''-- the column to be used as a condition (valid for query, modification, and deletion. It is null by default. Multiple column names are separated by commas (,), for example: field 1 and Field 2, where the primary key column can be omitted)
As
-- The affected number of rows is not returned to improve performance.
Set nocount on
 
-- Define primary key columns, whether primary key columns are auto-incrementing, the type of primary key columns, and the code to be generated
Declare @ keyfield varchar (20), @ iden int, @ partype varchar (20), @ code varchar (4000)
Select @ keyfield = c. name, @ iden = c. is_identity, @ partype = d. name from sys. indexes a, sys. index_columns B, sys. columns c, policypes d
Where a. object_id = B. object_id and a. index_id = B. index_id and a. object_id = c. object_id and c. user_type_id = d. xtype
And B. column_id = c. column_id and a. is_primary_key = 1 and d. status = 0
And a. object_id = OBJECT_ID (@ tablename)
 
-- When querying, whether to return only entity objects (1: Yes, 0: No)
Declare @ isflag bit
Set @ isflag = 0
If (@ where = @ keyfield)
Set @ isflag = 1
 
-- Perform non-empty Processing
If (not exists (select 1 from sysobjects where id = OBJECT_ID (@ tablename )))
Begin
Print 'enter the correct table name! '
Return
End
 
-- Modified column set
Declare @ updatefields varchar (1000)
Set @ updatefields =''
 
-- If the column to be operated is specified, check. Prevents error Columns
If (@ fields! = ''And @ fields! = '*')
Begin
Declare @ oldfields varchar (200)
Set @ fields = REPLACE (@ fields ,',',',')
If (right (@ fields, 1 )! = ',')
Set @ fields = @ fields + ','
Set @ oldfields = @ fields
Set @ fields =''
-- Traverse to filter out valid columns in @ fields
While (CHARINDEX (',', @ oldfields)> 0)
Begin
-- Obtains the field name.
Declare @ tempf varchar (50)
Set @ tempf = SUBSTRING (@ oldfields, 1, charindex (',', @ oldfields)-1)
If exists (select 1 from syscolumns where id = OBJECT_ID (@ tablename) and name = @ tempf)
Begin
Set @ fields = @ fields + @ tempf + ','
Set @ updatefields = @ updatefields + @ tempf + '= @' + @ tempf + ','
End
Set @ oldfields = SUBSTRING (@ oldfields, charindex (',', @ oldfields) + 1, LEN (@ oldfields ))
End
End
-- If no valid field exists or all fields are operated
If (@ fields = '*' or @ fields = '')
Begin
Set @ fields =''
Select @ fields = @ fields + name + ',', @ updatefields = @ updatefields + case when name! = @ Keyfield then name + '= @' + name + ', 'else' end
From syscolumns where id = OBJECT_ID (@ tablename)
End
 
If (@ updatefields! = '')
Set @ updatefields = STUFF (@ updatefields, LEN (@ updatefields), 1 ,'')
 
-- Save Conditions
Declare @ tempwhere varchar (200)
Set @ tempwhere =''
-- If conditions exist, the conditions are also processed in the same way.
If (@ where! = '')
Begin
Declare @ oldwhere varchar (200), @ tempfield varchar (50)
Set @ where = REPLACE (@ where ,',',',')
If (right (@ where, 1 )! = ',')
Set @ where = @ where + ','
Set @ oldwhere = @ where
Set @ where =''
-- Traverse to filter out valid columns in @ fields
While (CHARINDEX (',', @ oldwhere)> 0)
Begin
Set @ tempfield = SUBSTRING (@ oldwhere, 1, charindex (',', @ oldwhere)-1)
If exists (select 1 from syscolumns where id = OBJECT_ID (@ tablename) and name = @ tempfield)
Begin
Set @ tempwhere = @ tempwhere + @ tempfield + ','
Set @ where = @ where + 'and' + @ tempfield + '= @' + @ tempfield
End
Set @ oldwhere = SUBSTRING (@ oldwhere, charindex (',', @ oldwhere) + 1, LEN (@ oldwhere ))
End
End
If (@ where = ''and (@ opertype = 3 or @ opertype = 4 ))
Begin
-- If no valid condition exists, the primary key is used as the condition.
Set @ tempwhere = @ keyfield + ','
Set @ where = 'and' + @ keyfield + '= @' + @ keyfield
End
 
-- Generate a stored procedure
If (@ type = 1)
Begin
-- If a primary key Column exists in the Operation column and the primary key column is an auto-incrementing column, this column is excluded.
If (@ opertype = 2 and CHARINDEX (@ keyfield, @ fields)> 0 and @ iden = 1)
Begin
Set @ fields = stuff (@ fields, charindex (@ keyfield + ',', @ fields), LEN (@ keyfield + ','),'')
End
Set @ fields = stuff (@ fields, LEN (@ fields), 1 ,'')

-- Generate a parameter Declaration for the stored procedure
Declare @ paras varchar (1000)
-- Generate a stored procedure
If (@ opertype = 1) -- Query
Begin
-- Generate based on conditions
Select @ paras = ISNULL (@ paras + ',' + CHAR (13), '') + '@' + a. name +'' + B. name
+ Case when B. name in ('varchar ', 'nvarchar', 'Char ', 'nchar') then' ('+ LTRIM (. length) + ') 'else' end
From syscolumns a, policypes B
Where. id = OBJECT_ID (@ tablename) and. xtype = B. xtype and CHARINDEX (',' +. name + ',' + @ tempwhere + ',')> 0
And B. status = 0
Set @ code = '/* -- ==================================== ============== '+ CHAR (13) +
'-- Author: shipeng. wang' + CHAR (13) +
'-- Create date:' + CONVERT (varchar (10), getdate (), 120) + CHAR (13) +
'-- Description: queries data in table' + @ tablename + '+ CHAR (13) +
'-- ===================================================== ========= */'+ CHAR (13)

Set @ code = @ code + 'create proc [sp _ '+ @ tablename +' _ select' + case @ isflag when 0 then' 'else' _ one' end + '] '+ CHAR (13) + isnull (@ paras + CHAR (13 ),'')
+ 'As' + CHAR (13)
+ CHAR (9) + 'select' + @ fields + 'from [' + @ tablename + '] where 1 = 1' + @ where
+ CHAR (13)
End
Else if (@ opertype = 2) -- add
Begin
-- Generate Based on the added Field
Select @ paras = ISNULL (@ paras + ',' + CHAR (13), '') + '@' + a. name +'' + B. name
+ Case when B. name in ('varchar ', 'nvarchar', 'Char ', 'nchar') then' ('+ LTRIM (. length) + ') 'else' end
From syscolumns a, policypes B
Where. id = OBJECT_ID (@ tablename) and. xtype = B. xtype and CHARINDEX (',' +. name + ',' + @ fields + ',')> 0
And B. status = 0
Set @ code = '/* -- ==================================== ============== '+ CHAR (13) +
'-- Author: shipeng. wang' + CHAR (13) +
'-- Create date:' + CONVERT (varchar (10), getdate (), 120) + CHAR (13) +
'-- Description: Add' + CHAR (13) + to the table '+ @ tablename +'
'-- ===================================================== ========= */'+ CHAR (13)
Set @ code = @ code + 'create proc [sp _ '+ @ tablename +' _ insert] '+ CHAR (13) + isnull (@ paras + CHAR (13 ), '')
+ 'As' + CHAR (13)
+ CHAR (9) + 'insert into ['+ @ tablename +'] ('+ @ fields +') values (@ '+ REPLACE (@ fields ,',', ', @') + ')'
+ CHAR (13)
End
Else if (@ opertype = 3) -- modify
Begin

-- If no valid condition exists, the primary key is used as the condition.
If (@ where = '')
Begin
Set @ tempwhere = @ keyfield
Set @ where = 'and' + @ keyfield + '= @' + @ keyfield
End

-- Generate Based on the added fields and conditions
Select @ paras = ISNULL (@ paras + ',' + CHAR (13), '') + '@' + a. name +'' + B. name
+ Case when B. name in ('varchar ', 'nvarchar', 'Char ', 'nchar') then' ('+ LTRIM (. length) + ') 'else' end
From syscolumns a, policypes B
Where. id = OBJECT_ID (@ tablename) and. xtype = B. xtype and (CHARINDEX (',' +. name + ',' + @ fields + ',')> 0 or CHARINDEX (',' +. name + ',' + @ tempwhere + ',')> 0)
And B. status = 0
Set @ code = '/* -- ==================================== ============== '+ CHAR (13) +
'-- Author: shipeng. wang' + CHAR (13) +
'-- Create date:' + CONVERT (varchar (10), getdate (), 120) + CHAR (13) +
'-- Description: Modify the data in Table' + @ tablename + '+ CHAR (13) +
'-- ===================================================== ========= */'+ CHAR (13)
Set @ code = @ code + 'create proc [sp _ '+ @ tablename +' _ update] '+ CHAR (13) + isnull (@ paras + CHAR (13 ), '')
+ 'As' + CHAR (13)
+ CHAR (9) + 'Update ['+ @ tablename +'] set' + @ updatefields + 'where 1 = 1' + @ where
+ CHAR (13)
End
Else if (@ opertype = 4)
Begin

-- Generate based on conditions
Select @ paras = ISNULL (@ paras + ',' + CHAR (13), '') + '@' + a. name +'' + B. name
+ Case when B. name in ('varchar ', 'nvarchar', 'Char ', 'nchar') then' ('+ LTRIM (. length) + ') 'else' end
From syscolumns a, policypes B
Where. id = OBJECT_ID (@ tablename) and. xtype = B. xtype and CHARINDEX (',' +. name + ',' + @ tempwhere + ',')> 0
And B. status = 0

Set @ code = '/* -- ==================================== ============== '+ CHAR (13) +
'-- Author: shipeng. wang' + CHAR (13) +
'-- Create date:' + CONVERT (varchar (10), getdate (), 120) + CHAR (13) +
'-- Description: delete data in table' + @ tablename + '+ CHAR (13) +
'-- ===================================================== ========= */'+ CHAR (13)
Set @ code = @ code + 'create proc [sp _ '+ @ tablename +' _ delete] '+ CHAR (13) + isnull (@ paras + CHAR (13 ), '')
+ 'As' + CHAR (13)
+ CHAR (9) + 'delete ['+ @ tablename +'] where 1 = 1' + @ where
+ CHAR (13)
End
End
-- Generate C # Method
Else if (@ type = 2)
Begin
-- Parameters must be declared for Operation columns and condition columns during addition and modification.
Declare @ sqlparameters varchar (3000), @ newfield varchar (400)
Set @ sqlparameters =''
If (@ opertype = 2 or @ opertype = 3)
Begin
-- When adding an operation, if the primary key column is auto-incrementing, you do not need to specify the primary key column
If (CHARINDEX (@ keyfield, @ fields)> 0 and @ iden = 1)
Begin
Set @ fields = stuff (@ fields, charindex (@ keyfield + ',', @ fields), LEN (@ keyfield + ','),'')
End
-- Declare Parameters
Select @ sqlparameters = @ sqlparameters + CHAR (9) + CHAR (9) + CHAR (9) + CHAR (9) + CHAR (9) +
'New SqlParameter ("@ '+ a. name +'", SqlDbType. '+
Case B. name when 'varchar 'then' varchar 'when 'bigint' then 'bigint'
When 'datetime'then' datetime 'when' nvarchar 'then' NVarChar 'when 'numeric 'then' Decimal'
When 'tinyint' then 'tinyint'
Else UPPER (left (B. name, 1) + RIGHT (B. name, len (B. name)-1) end
+ ',' + Ltrim (a. length) + '),' + CHAR (13)
From syscolumns a, policypes B where. id = OBJECT_ID (@ tablename) and charindex (',' +. name + ',' + @ fields)> 0 and. xtype = B. xtype
And B. status = 0
End

If (@ opertype = 1 or @ opertype = 4 or @ opertype = 3) -- When querying, modifying, or deleting, you must add a condition parameter.
Begin
-- Declare Parameters
Select @ sqlparameters = @ sqlparameters + CHAR (9) + CHAR (9) + CHAR (9) + CHAR (9) + CHAR (9) +
'New SqlParameter ("@ '+ a. name +'", SqlDbType. '+
Case B. name when 'varchar 'then' varchar 'when 'bigint' then 'bigint'
When 'datetime'then' datetime 'when' nvarchar 'then' NVarChar 'when 'numeric 'then' Decimal'
When 'tinyint' then 'tinyint'
Else UPPER (left (B. name, 1) + RIGHT (B. name, len (B. name)-1) end + ',' + ltrim (. length) + '),' + CHAR (13)
From syscolumns a, policypes B where a. id = OBJECT_ID (@ tablename) and
Charindex (',' + a. name + ',' + @ tempwhere)> 0 and a. xtype = B. xtype and B. status = 0
End
If (@ sqlparameters! = '')
Set @ sqlparameters = STUFF (@ sqlparameters, len (@ sqlparameters)-1, 1 ,'')
If (@ opertype = 1)
Begin
If (@ sqlparameters! = '')
Begin
-- Parameter Declaration
Declare @ parselect varchar (200)
Select @ parselect = ISNULL (@ parselect + ',', '') +
Case when B. name in ('image', 'uniqueidentifier', 'ntext', 'varchar ', 'ntext', 'nchar', 'nvarchar ', 'text', 'Char ') then 'string'
When B. name in ('tinyint', 'smallint', 'int') then 'int'
When B. name = 'bigint' then 'Long'
When B. name in ('datetime', 'smalldatetime') then 'datetime'
When B. name in ('float', 'decimal', 'numeric ', 'money', 'real', 'smallmoney') then 'decimal'
When B. name = 'bit' then 'bool'
Else B. name end + ''+ a. name
From syscolumns a, policypes B where. xtype = B. xtype and. id = OBJECT_ID (@ tablename) and CHARINDEX (',' +. name + ',' + @ tempwhere)> 0
And B. status = 0
-- If multiple records are returned
If (@ isflag = 0)
Begin
-- Generate parameterization
Set @ code = '// <summary>' + CHAR (13)
+ '// Query the data in Table' + @ tablename + '+ CHAR (13)
+ '// </Summary>' + CHAR (13) +
+ '// The following code is automatically generated by the shipeng. wang Stored Procedure //' + CHAR (13)
+ 'Public DataSet GetList ('+ @ parselect +') '+ CHAR (13)
+ '{' + CHAR (13)
+ Char (9) + 'sqlparameter [] paras = new SqlParameter [] {'+ CHAR (13) + @ sqlparameters + CHAR (9) + '}; '+ CHAR (13)
Declare @ j int
Set @ j = 0

-- Assign values to parameters
While (CHARINDEX (',', @ tempwhere)> 0)
Begin
Declare @ p1 varchar (30)
Set @ p1 = substring (@ tempwhere, 1, CHARINDEX (',', @ tempwhere)-1)
If exists (select 1 from syscolumns where id = OBJECT_ID (@ tablename) and name = @ p1)
Begin
Select @ p1 = name from syscolumns where id = OBJECT_ID (@ tablename) and name = @ p1
Set @ code = @ code + char (9) + 'paras ['+ LTRIM (@ j) +']. value = '+ @ p1 +'; '+ CHAR (13)
Set @ j = @ j + 1
End
Set @ tempwhere = SUBSTRING (@ tempwhere, CHARINDEX (',', @ tempwhere) + 1, LEN (@ tempwhere ))

End
Set @ code = @ code + CHAR (9) + 'Return db. executeDataSet ("sp _ '+ @ tablename +' _ select' + '", CommandType. storedProcedure, paras); '+ CHAR (13)
+ '}'
End
Else -- returns an object
Begin
-- Generate parameterization
Set @ code = '// <summary>' + CHAR (13)
+ '// Obtain' + @ tablename + 'entity object' + CHAR (13) based on the primary key)
+ '// </Summary>' + CHAR (13)
+ '// The following code is automatically generated by the shipeng. wang Stored Procedure //' + CHAR (13)
+ 'Public' + @ tablename + 'getmodel ('+ @ parselect +') '+ CHAR (13)
+ '{' + CHAR (13)
+ Char (9) + 'sqlparameter [] paras = new SqlParameter [] {'+ CHAR (13) + @ sqlparameters + CHAR (13) + CHAR (9) + '}; '+ CHAR (13)
Set @ code = @ code + char (9) + 'paras [0]. Value = '+ @ keyfield +'; '+ CHAR (13)
Set @ code = @ code + CHAR (9) + 'sqldatareader read = db. executeDataReader ("sp _ '+ @ tablename +' _ select_one '+'", CommandType. storedProcedure, paras); '+ CHAR (13)
Set @ code = @ code + CHAR (9) + 'if (read! = Null & read. Read () '+ CHAR (13)
Set @ code = @ code + CHAR (9) + '{' + CHAR (13)
Set @ code = @ code + CHAR (9) + CHAR (9) + @ tablename + 'model = new' + @ tablename + ';' + CHAR (13)
Declare @ k int
Set @ k = 0
Declare @ t varchar (50)
Set @ fields = @ fields + ','
While (CHARINDEX (',', @ fields)> 0)
Begin
Set @ t = substring (@ fields, 1, CHARINDEX (',', @ fields)-1)
Select @ code = @ code + CHAR (9) + CHAR (9) + 'model. '+ @ t +' = read. get' +
Case when B. name in ('image', 'uniqueidentifier', 'ntext', 'varchar ', 'ntext', 'nchar', 'nvarchar ', 'text', 'Char ') then 'string'
When B. name in ('tinyint', 'smallint', 'int') then 'int32'
When B. name = 'bigint' then 'int64'
When B. name in ('datetime', 'smalldatetime') then 'datetime'
When B. name in ('float', 'decimal', 'numeric ', 'money', 'real', 'smallmoney') then 'decimal'
When B. name = 'bit' then 'boolean'
Else B. name end + '(' + ltrim (@ k) + ')' + ';' + CHAR (13)
From syscolumns a, policypes B where a. id = object_id (@ tablename) and a. name = @ t and a. xtype = B. xtype and B. status = 0
Set @ k = @ k + 1
Set @ fields = STUFF (@ fields, 1, CHARINDEX (',', @ fields ),'')
End
Set @ code = @ code + CHAR (9) + CHAR (9) + 'Return model; '+ CHAR (13)
Set @ code = @ code + CHAR (9) + '}' + CHAR (13)
Set @ code = @ code + CHAR (9) + 'else' + CHAR (13)
Set @ code = @ code + CHAR (9) + CHAR (9) + 'Return null; '+ CHAR (13)
+ '}'
End
End
Else
-- Generate parameterization
Set @ code = '// <summary>' + CHAR (13)
+ '// Query the data in Table' + @ tablename + '+ CHAR (13)
+ '// </Summary>' + CHAR (13)
+ '// The following code is automatically generated by the shipeng. wang Stored Procedure //' + CHAR (13)
+ 'Public DataSet GetList () '+ CHAR (13)
+ '{' + CHAR (13)
+ Char (9) + 'string SQL = "select * from '+ @ tablename +'"; '+ CHAR (13)
+ CHAR (9) + 'Return db. ExecuteDataSet (SQL, CommandType. Text); '+ CHAR (13)
+ '}'
End
Else if (@ opertype = 2 or @ opertype = 3) -- add or modify
Begin
-- Generate parameterization
Set @ code = '// <summary>' + CHAR (13)
+ '// Add 'else' to the table' + @ tablename + 'and 'Case @ opertype when 2 then' to modify 'end + CHAR (13)
+ '// </Summary>' + CHAR (13)
+ '// The following code is automatically generated by the shipeng. wang Stored Procedure //' + CHAR (13)
+ '// <Param name = "model"> Add 'else' to '+ case @ opertype when 2 then' to modify 'end +' object </param>' + CHAR (13)
+ 'Public bool '+ case @ opertype when 2 then' insert 'else' update 'end +' ('+ @ tablename + 'model)' + CHAR (13)
+ '{' + CHAR (13)
+ Char (9) + 'sqlparameter [] paras = new SqlParameter [] {'+ CHAR (13) + @ sqlparameters + CHAR (13) + CHAR (9) + '}; '+ CHAR (13)
Declare @ I int
Set @ I = 0
-- Assign values to parameters
While (CHARINDEX (',', @ fields)> 0)
Begin
Declare @ p varchar (30)
Set @ p = substring (@ fields, 1, CHARINDEX (',', @ fields)-1)
If exists (select 1 from syscolumns where id = OBJECT_ID (@ tablename) and name = @ p)
Begin
Set @ code = @ code + char (9) + 'paras ['+ LTRIM (@ I) +']. value = model. '+ @ p +'; '+ CHAR (13)
Set @ I = @ I + 1
End
Set @ fields = SUBSTRING (@ fields, CHARINDEX (',', @ fields) + 1, LEN (@ fields ))
End
If (@ opertype = 3) -- when modifying a condition, you must add a condition parameter.
Begin
-- Assign values to parameters
While (CHARINDEX (',', @ tempwhere)> 0)
Begin
Set @ p = substring (@ tempwhere, 1, CHARINDEX (',', @ tempwhere)-1)
If exists (select 1 from syscolumns where id = OBJECT_ID (@ tablename) and name = @ p)
Begin
Set @ code = @ code + char (9) + 'paras ['+ LTRIM (@ I) +']. value = model. '+ @ p +'; '+ CHAR (13)
Set @ I = @ I + 1
End
Set @ tempwhere = SUBSTRING (@ tempwhere, CHARINDEX (',', @ tempwhere) + 1, LEN (@ tempwhere ))
End
End
Set @ code = @ code + CHAR (9) + 'Return db. executeNonQuery ("sp _ '+ @ tablename +' _ '+ case @ opertype when 2 then 'insert 'else' Update' end
+ '", CommandType. StoredProcedure, paras);' + CHAR (13)
Set @ code = @ code + '}'
End
Else if (@ opertype = 4) -- delete
Begin
Declare @ parselect1 varchar (200)
Select @ parselect1 = ISNULL (@ parselect1 + ',', '') +
Case when B. name in ('image', 'uniqueidentifier', 'ntext', 'varchar ', 'ntext', 'nchar', 'nvarchar ', 'text', 'Char ') then 'string'
When B. name in ('tinyint', 'smallint', 'int') then 'int'
When B. name = 'bigint' then 'Long'
When B. name in ('datetime', 'smalldatetime') then 'datetime'
When B. name in ('float', 'decimal', 'numeric ', 'money', 'real', 'smallmoney') then 'decimal'
When B. name = 'bit' then 'bool'
Else B. name end + ''+ a. name
From syscolumns a, policypes B where. xtype = B. xtype and. id = OBJECT_ID (@ tablename) and CHARINDEX (',' +. name + ',' + @ tempwhere)> 0
And B. status = 0

-- Generate parameterization
Set @ code = '// <summary>' + CHAR (13)
+ '// Delete data in table' + @ tablename + '+ CHAR (13)
+ '// </Summary>' + CHAR (13)
+ '// The following code is automatically generated by the shipeng. wang Stored Procedure //' + CHAR (13)
+ 'Public bool delete ('+ @ parselect1 +') '+ CHAR (13)
+ '{' + CHAR (13)
+ Char (9) + 'sqlparameter [] paras = new SqlParameter [] {'+ CHAR (13) + @ sqlparameters + CHAR (13) + CHAR (9) + '}; '+ CHAR (13)
Declare @ h int
Set @ h = 0
-- Assign values to parameters
While (CHARINDEX (',', @ tempwhere)> 0)
Begin
Set @ p = substring (@ tempwhere, 1, CHARINDEX (',', @ tempwhere)-1)
If exists (select 1 from syscolumns where id = OBJECT_ID (@ tablename) and name = @ p)
Begin
Set @ code = @ code + char (9) + 'paras ['+ LTRIM (@ h) +']. value = '+ @ p +'; '+ CHAR (13)
Set @ h = @ h + 1
End
Set @ tempwhere = SUBSTRING (@ tempwhere, CHARINDEX (',', @ tempwhere) + 1, LEN (@ tempwhere ))
End

-- Set @ code = @ code + char (9) + 'paras [0]. Value = '+ @ keyfield +'; '+ CHAR (13)
Set @ code = @ code + CHAR (9) + 'Return db. executeNonQuery ("sp _ '+ @ tablename +' _ delete", CommandType. storedProcedure, paras); '+ CHAR (13)
Set @ code = @ code + '}'
End
End
Print @ code

Contact Us

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.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.