Hi!
In MSS Management Studio it is very irritating that queries not can be sorted.
So I looked at the ssmssqlproj-file.
I want to order by filename, but:
declare
@x xml;select
@x = '<LogicalFolder Name="Queries" Type="0"><Items>
<FileNode Name="updateTbl.sql">
<AssociatedConnectionMoniker />
<AssociatedConnSrvName />
<AssociatedConnUserName />
<FullPath>updateTbl.sql</FullPath>
</FileNode>
<FileNode Name="insertTbl.sql">
<AssociatedConnUserName />
<FullPath>insertTbl.sql</FullPath>
</FileNode>
<FileNode Name="selectTbl.sql">
<AssociatedConnUserName />
<FullPath>selectTbl.sql</FullPath>
</FileNode>
<FileNode Name="deleteTbl.sql">
<AssociatedConnUserName />
<FullPath>deleteTbl.sql</FullPath>
</FileNode>
</Items>
</LogicalFolder>'
;--select @x.query('for $item in /LogicalFolder/Items
-- return count($item/FileNode) ')
select
@x.query('for $x in /LogicalFolder/Items/FileNodeorder by $x/FullPath
return $x '
)--for xml path(''), root('LogicalFolder');
--Msg 2389, Level 16, State 1, Line 29
--XQuery [query()]: 'order by' requires a singleton (or empty sequence), found operand of type 'xdt:untypedAtomic
Can anyone help
Thanks
Bjorn