TAILIEUCHUNG - Beginning SQL Server 2008 for Developers From Novice to Professional phần 9

Chức năng hệ thống được chức năng cung cấp chức năng thêm bên ngoài ranh giới có thể được định nghĩa như là một chuỗi số, hoặc liên quan đến ngày. Ba trong số các chức năng này sẽ được sử dụng rộng rãi trong cả mã của chúng tôi, và do đó bạn nên chú ý đặc biệt CASE, CAST, và ISNULL. | CHAPTER 10 STORED PROCEDURES AND FUNCTIONS 335 -- Use the Specify Values for Template Parameters -- command Ctrl-Shift-M to fill in the parameter -- values below. -- -- This block of comments will not be included in -- the definition of the procedure. SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER ON GO -- Author Robin Dewson -- Create date 24 Mar 2008 -- Description This is to insert a customer CREATE PROCEDURE apf_InsertCustomer -- Add the parameters for the stored procedure here @FirstName varchar 50 @LastName varchar 50 AS BEGIN -- SET NOCOUNT ON added to prevent extra result sets from -- interfering with SELECT statements. SET NOCOUNT ON -- Insert statements for procedure here SELECT @FirstName @LastName END GO 6. We can now define the remaining parameters. There are one or two points to make before we progress. First of all the parameters can be in any order although it is best to try and group parameters together. The second point is that parameters like @CustTitle @AddressId @AccountNumber and @AccountTypeId in this example are showing the numerical reference values that would come from values defined in a graphical front end. You may be wondering why the stored procedure is not generating these values from other information passed. For example why is the stored procedure not producing the title ID from Mr. Miss etc. It is likely that the operator using the front end had a combo box with a list of possible values to choose from with IDs corresponding to titles. In the case of the address the ID would link back to an external address database so rather than holding the whole address we could receive just the ID selected when the operator used the address lookup. The code with the remaining parameters is shown here CREATE PROCEDURE -- Add the parameters for the function here @FirstName varchar 50 @LastName varchar 50 @CustTitle int @CustInitials nvarchar 10 @AddressId int @AccountNumber nvarchar 15 @AccountTypeId int 336 CHAPTER

TAILIEUCHUNG - Chia sẻ tài liệu không giới hạn
Địa chỉ : 444 Hoang Hoa Tham, Hanoi, Viet Nam
Website : tailieuchung.com
Email : tailieuchung20@gmail.com
Tailieuchung.com là thư viện tài liệu trực tuyến, nơi chia sẽ trao đổi hàng triệu tài liệu như luận văn đồ án, sách, giáo trình, đề thi.
Chúng tôi không chịu trách nhiệm liên quan đến các vấn đề bản quyền nội dung tài liệu được thành viên tự nguyện đăng tải lên, nếu phát hiện thấy tài liệu xấu hoặc tài liệu có bản quyền xin hãy email cho chúng tôi.
Đã phát hiện trình chặn quảng cáo AdBlock
Trang web này phụ thuộc vào doanh thu từ số lần hiển thị quảng cáo để tồn tại. Vui lòng tắt trình chặn quảng cáo của bạn hoặc tạm dừng tính năng chặn quảng cáo cho trang web này.