Returns the stored procedure of XML data

xiaoxiao2021-03-31  227

If EXISTS (SELECT Name from sysobjects where name = n'getpeople 'and type =' p ') Drop Procedure getPeopleGo

CREATE PROCEDURE getPeopleASdeclare @au_lname varchar (40), @ au_fname varchar (40), @ returnXML varchar (4000) DECLARE Employee_Cursor CURSOR FORSELECT LastName, FirstName FROM Northwind.dbo.EmployeesOPEN Employee_Cursorset @returnXML = '' FETCH NEXT FROM Employee_Cursorinto @ au_lname, @ au_fnameWHILE @@ FETCH_STATUS = 0BEGIN set @returnXML = rtrim (@returnXML) ' ' @au_lname ' ' @au_fname ' < / people> 'FETCH NEXT FROM Employee_Cursor into @ au_lname, @ au_fnameENDset @returnXML = rtrim (@returnXML) ' 'CLOSE Employee_CursorDEALLOCATE Employee_Cursorselect @returnXMLGO

转载请注明原文地址:https://www.9cbs.com/read-131033.html

New Post(0)