Execute a stored procedure/create a stored procedure:

Source: Internet
Author: User
Use [ao08]
Go

Declare @ return_value int

Exec @ return_value = [DBO]. [sp_insert_sys_msg]
@ Type = n'2 ',
@ MSG = n'abc ',
@ Msg_from = n 'zhangshan ',
@ Msg_to = n'000000'

Select 'Return value' = @ return_value

Go

Create a stored procedure: Set ansi_nulls on
Set quoted_identifier on
Go

-- ===================================================== ======
-- Author: <author, Name>
-- Create Date: <create date,>
-- Description: <description,>
-- ===================================================== ======
Alter procedure [DBO]. [sp_insert_sys_msg]
-- Add the parameters for the stored procedure here
@ Type varchar (20), -- Variable
@ MSG varchar (20), -- Chinese Character content
@ Msg_from varchar (20), -- Chinese name
@ Msg_to varchar (20 )--


As
Begin
-- Set nocount on added to prevent extra result sets from
-- Interfering with select statements.
Set nocount on;
Declare @ susercode varchar (50 );
Select @ susercode = '';
Select @ susercode = user_code from pd_user where [user_name] = @ msg_from;
-- Insert statements for procedure here

Insert into sys_msg ([type], MSG, msg_from, msg_to)
Values (@ type, @ MSG, @ susercode, @ msg_to)

End

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.