1 Replies - 1822 Views - Last Post: 17 May 2009 - 09:39 PM Rate Topic: -----

#1 sssmartie  Icon User is offline

  • D.I.C Head

Reputation: 1
  • View blog
  • Posts: 58
  • Joined: 03-June 08

How can I insert an xml variable in a table using stored procedure?

Posted 17 May 2009 - 01:14 PM

Greetings!
I'm trying to write a stored procedure that has to enter a nvarchar value and an xml value into a table which the table name is also given as a variable(@lesson),as below:
create procedure q
@lesson  nvarchar(50),@desig nvarchar(30),
@xme xml
as declare @st nvarchar(200)

set @st='Insert into '+ @lesson+ ' (designer,exam) values ('+@desig +','+@xme +')'
exec(@st)


but i get the following error:"Msg 402, Level 16, State 1, Procedure q, Line 7
The data types nvarchar and xml are incompatible in the add operator."

How can I enter the xml variable along the nvarchar variable in the table?
Any idea?!
Thanks in advance

Is This A Good Question/Topic? 0
  • +

Replies To: How can I insert an xml variable in a table using stored procedure?

#2 sssmartie  Icon User is offline

  • D.I.C Head

Reputation: 1
  • View blog
  • Posts: 58
  • Joined: 03-June 08

Re: How can I insert an xml variable in a table using stored procedure?

Posted 17 May 2009 - 09:39 PM

BTW:I forgot to mention i'm using SQL server 2005
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1