Click here to Skip to main content
15,914,820 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
hiii for this stored procedure is not executing it comes error can u plz help me

error: Msg 102, Level 15, State 1, Procedure Employee_insert, Line 18
Incorrect syntax near ';'


create proc Employee_insert @filepath nvarchar(100)
as
begin
set @filepath='E:\Xmlview\Register.xml';
insert into Userdata(UserName,Password,Email,Gender,Location,DateOfBirth)
SELECT XmlQuery.employee.query('Name').value('.', 'VARCHAR(50)'),
dbo.REMOVE_SPECIAL(XmlQuery.employee.query('Password').value('.', 'VARCHAR(30)')),
dbo.REMOVE_SPECIAL(XmlQuery.employee.query('Email').value('.', 'VARCHAR(50)')),
XmlQuery.employee.query('Gender').value('.', 'VARCHAR(50)'),
XmlQuery.employee.query('Location').value('.', 'VARCHAR(50)'),
XmlQuery.employee.query('DateOfBirth').value('.', 'nvarchar(50)')
from (
SELECT CAST(XmlQuery AS XML)
FROM OPENROWSET(
BULK 'E:\Xmlview\Register.xml',
SINGLE_BLOB) AS T(XmlQuery)
) AS T(XmlQuery)
CROSS APPLY XmlQuery.nodes('employees/employee') AS XmlQuery(employee)
Posted

Try this

SQL
create proc Employee_insert @filepath nvarchar(100)
as
begin
set @filepath='E:\Xmlview\Register.xml';
insert into   Userdata(UserName,Password,Email,Gender,Location,DateOfBirth)
SELECT XmlQuery.employee.query('Name').value('.', 'VARCHAR(50)'),
         dbo.REMOVE_SPECIAL(XmlQuery.employee.query('Password').value('.', 'VARCHAR(30)')),
         dbo.REMOVE_SPECIAL(XmlQuery.employee.query('Email').value('.', 'VARCHAR(50)')),
         XmlQuery.employee.query('Gender').value('.', 'VARCHAR(50)'),
         XmlQuery.employee.query('Location').value('.', 'VARCHAR(50)'),
         XmlQuery.employee.query('DateOfBirth').value('.', 'nvarchar(50)')
from (
SELECT CAST(XmlQuery AS XML)
FROM OPENROWSET(
BULK 'E:\Xmlview\Register.xml',
SINGLE_BLOB) AS T(XmlQuery)
) AS T(XmlQuery)
CROSS APPLY XmlQuery.nodes('employees/employee') AS XmlQuery(employee)
end
 
Share this answer
 
end key word is missing at end
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900