Viewing 15 posts - 331 through 345 (of 938 total)
Paul Nicklin (3/28/2008)
I'm not sure I agree exactly with your rule 1- or at least how you've used the idea of "unknown" to say what NULL is.
Consider when using foreign...
March 28, 2008 at 9:39 am
csaba.marko (3/28/2008)
Hi!You could also write about how NULL values effect the aggregate functions: count, sum, avg etc.
MCs
Hi csaba. See http://www.sqlservercentral.com/articles/Advanced+Querying/gotchasqlaggregatefunctionsandnull/1947/%5B/url%5D.
March 28, 2008 at 9:32 am
Jeff Moden (3/28/2008)
I normally don't work NULLs against "TRUE/FALSE" values even in WHERE clauses... I normally work them against some form...
March 28, 2008 at 9:29 am
mohler (3/28/2008)
My confusion comes in trying to apply the statement
Simply put, [when] we try to compare NULLs to data values[] or other...
March 28, 2008 at 9:19 am
Matt Miller (3/27/2008)
Christopher Ford (3/27/2008)
SUM(OrderQty) OVER(PARTITION BY SalesOrderID)
That works fine...
Why can't I remember what it was about that, that would be really nice to have...Several...
March 27, 2008 at 12:35 pm
Matt Miller (3/27/2008)
Mike C (3/26/2008)
March 27, 2008 at 10:44 am
Matt Miller (3/26/2008)
Mike C (3/26/2008)
Matt Miller (3/26/2008)
You're right, XQuery does have a slightly higher learning curve than many other newer features in SQL Server 🙂 The CROSS APPLY and...
March 26, 2008 at 5:30 pm
Matt Miller (3/26/2008)
Right on...It does take a while for that light bulb to go off... You're essentially creating derived tables with each CROSS APPLY statement....
It's the same argument I...
March 26, 2008 at 4:30 pm
Andrew Pfeiffer (3/26/2008)
Mike C (3/26/2008)
For readability purposes I'd probably go with something like this:
SELECT x.value('Name[1]', 'VARCHAR(20)')
FROM @x.nodes('/Employees/Employee') e(x);
I like this method. It is actually faster and uses...
March 26, 2008 at 2:32 pm
Christopher Ford (3/26/2008)
for each "section" I need to cross apply it to do what I want.
Example below:
SELECT
x.value('UnparsedName[1]', 'VARCHAR(20)') as Name
,l.value('@BusinessType', 'varchar(20)') as BusinessType
,CAST(CONVERT(varchar(20),l.query('HighBalanceAmount/text()')) as money)...
March 26, 2008 at 2:27 pm
For readability purposes I'd probably go with something like this:
SELECT x.value('Name[1]', 'VARCHAR(20)')
FROM @x.nodes('/Employees/Employee') e(x);
March 26, 2008 at 12:38 pm
Or for this particular XML data you could simplify even further:
SELECT
Table1.Column1.value('.','VARCHAR(20)') AS Employee_Name
FROM
@XML_Employee_Name.nodes('//Name[1]') AS...
March 26, 2008 at 11:39 am
After the .nodes() method you must create a table and column alias. e is the table alias, c is the column alias.
March 26, 2008 at 9:48 am
You can retrieve all names without a CTE and CROSS APPLY as well:
DECLARE @x XML;
SET @x = '<Employees>
<Employee ID="101">
<Name>Jacob</Name>
<Department>IT</Department>
...
March 26, 2008 at 7:46 am
That's what I basically did (after about 10 edit attempts). I italicized everything after the ampersand. It appears that when the parser for this editor sees an ampersand...
March 20, 2008 at 10:44 am
Viewing 15 posts - 331 through 345 (of 938 total)