How does jsp call the mssql Stored Procedure (1/2)

Source: Internet
Author: User

This article tells you how to call the mssql Stored Procedure in jsp. In fact, the stored procedure of calling mssql is very simple. Let's create a table first:

This article will show you how to call the jsp tutorialMssql Stored ProcedureActuallyCall the stored procedure of mssqlIt's easy. Let's create a table first:

Create table [bookuser] (
[Userid] [int] identity (1, 1) not null,
[Username] [varchar] (50) collate chinese_prc_ci_as not null,
[Title] [nvarchar] (50) collate chinese_prc_ci_as not null,
[Guid] [uniqueidentifier] not null constraint [df_bookuser_guid] default (newid ()),
[Birthdate] [datetime] not null,
[Description] [ntext] collate chinese_prc_ci_as not null,
[Photo] [image] null,
[Other] [varchar] (50) collate chinese_prc_ci_as null
Constraint [df_bookuser_other] default ('default '),
Constraint [pk_bookuser] primary key clustered
(
[Userid]
) On [primary]
) On [primary] textimage_on [primary]
Go

Create a stored procedure:

Create procedure insertuser
@ Username varchar (50 ),
@ Title varchar (255 ),
@ Guid uniqueidentifier,
@ Birthdate datetime,
@ Description ntext,
@ Photo image,
@ Other nvarchar (50 ),
@ Userid int output
As
Set nocount on
If exists (select userid from bookuser where username = @ username)
Return 0
Else
Begin
Insert into bookuser (username, title, guid, birthdate, description, photo, other)
Values (@ username, @ title, @ guid, @ birthdate, @ description, @ photo, @ other)
Set @ userid = @ identity
Return 1
End
Go

1 2

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.