Showing posts with label SQL. Show all posts
Showing posts with label SQL. Show all posts

Tuesday, 20 May 2008

XPath/XQuery SQL counting repeatable nodes in SQL Server 2005

XML is represented in a field, vchr_Xml on table A, trying to count entities - can use xpath in the sql/xquery to get the count of repeatable nodes.

select convert(int, convert(varchar(max),
convert(xml,{a.ntext_xmlRepresentation).query('count(/Entities/Entity)')))

from [DB].dbo.tbl_A A where A.uid_id = [GUID]

Tuesday, 19 June 2007

Granting permission to a user to create stored procedures on SQL Server 2005

To enable a user to create stored procedures on a SQL Server 2005 use

GRANT ALTER ON SCHEMA::dbo TO

GRANT CREATE PROCEDURE TO