Sunday, March 24, 2013

[SQL Server 2008 issues] Query to get system databases

[SQL Server 2008 issues] Query to get system databases


Query to get system databases

Posted: 22 Mar 2013 10:29 PM PDT

Hi,I want a query to get list of databases except system databases from sys.databases.I don't know how to differentiate system databases from user databases.Is there any way to do it?

Query for XML column values comparison

Posted: 22 Mar 2013 11:40 PM PDT

HiWe have a query for return rows by comparing with XML column values[code="sql"]SELECT [DBChanges].* FROM [Checklists].dbo.[DBChanges] WHERE ( [Permited_by].exist('for $x in /Root/Row where ( fn:upper-case($x/User[1]) = fn:upper-case("shw") or fn:upper-case($x/User[1]) = fn:upper-case("skt") or fn:upper-case($x/User[1]) = fn:upper-case("prs") ) return $x')>0 ) [/code]It seems we cant use IN in Xquery. So we ended up with using OR conditions for matching many values for a row.Is there anything to optimize in the query?

No comments:

Post a Comment

Search This Blog