If You run this script on sql server 2008, works fine.
declare @tab table(
id_emp int,
FIL_ROT_WID xml
)
insert into @tab
select 0, '<xml></xml>'
declare @xml_rot_widget xml
set @xml_rot_widget = '<ati id="1123" val="new()" />'
update @tab
set FIL_ROT_WID.modify('insert sql:variable("@xml_rot_widget")
as last
into (/xml)[1]')
where id_emp = 0
select * from @tab
But Im using SQL Server 2005 with SQLSMS2008 and this scripts works fine too. But with the same level of databse em SQLSMS2005 I receive the following error:
XQuery: SQL type 'xml' is not supported in XQuery.
Im already solve the problem, but my question is:
How to configure the SQLSMS2008 to run script and parse them for DB 2005?
Ah, Tools > Options > SQL Server Object Explorer > Scripting > Script for server version
does not work. It keep running like 2008.
Tks
There is no way this script would run on SQL 2005 no matter what version of Management Studio you were using. You must have been connected to the SQL 2008 server? Use
to doublecheck if you’re not sure of the version.