Viewing 15 posts - 826 through 840 (of 2,894 total)
Writing the query on paper requires the candidate to demonstrate the conceptual knowledge of the SELECT-FROM-JOIN-WHERE-ORDER BY construct without fumbling through it by trial-and-error at the keyboard (smart people with...
November 29, 2012 at 9:25 am
I would ask an interviewee who presented that solution why he or she did not use the modulo operator, though. It's a bit like asking a candidate for a carpentry...
November 29, 2012 at 9:05 am
CELKO (11/29/2012)
Hmm, I'm actually off to participate in a panel interview of a candidate in a few minutes! Bwaa-ha-ha-ha!
I just sit there in my black three piece suit, tenting...
November 29, 2012 at 8:55 am
Because it's not yet exist to be used in OVER (ORDER BY ...)
Change it to:
.. ROW_NUMBER() OVER( ORDER BY P.Fsex) ROWID,
...
November 29, 2012 at 8:27 am
Try this:
SELECT S.CityId, C.Name
FROM @City AS S
CROSS APPLY (VALUES (CityName),(AlternateCityName1),(AlternateCityName2)) C(Name)
WHERE C.Name LIKE @SearchString + '%'
November 29, 2012 at 8:10 am
Could anyone suggest ways to improve it.
May be.
You have done a great job by specifying table DDL and query you have!
Adding some sample data (as insert script) and expected...
November 29, 2012 at 7:58 am
You can use CASE WHEN:
SELECT ...
,CASE WHEN car = 'sedan' THEN 1
WHEN car = 'coupe' THEN 0
...
November 29, 2012 at 7:54 am
You don't need to OUTER APPLY, just use relative xPath:
SELECT DISTINCT
S.N.value('name[1]', 'varchar(150)') AS UserName,
S.N.value('id[1]', 'varchar(150)') AS UserID,
S.N.value('../message[1]', 'varchar(150)') AS [Message],
S.N.value('../from[1]', 'varchar(150)') AS [From],
S.N.value('../created_time[1]', 'varchar(150)') AS [CreatedTime],
S.N.value('../likes[1]', 'varchar(150)') AS [Likes]
FROM...
November 29, 2012 at 7:51 am
I guess the main problem is in xQuery, you shouldn't have "id " in it:
nodes('/comments_data/Row/from') AS S(N)
Check this:
declare @CommentsData xml =
'<comments_data>
<Row>
<id>204506806280354_433001873430845_1108251</id>
...
November 29, 2012 at 7:39 am
oradbguru (11/29/2012)
So is it best to extract relational data in xml format and using another language like c#, apply a style sheet to transform it into the desired format?
Exactly that!
November 29, 2012 at 6:19 am
You can generate XML in T-SQL, and it is absolutely fine.
But applying XSLT? It is not good idea.
SQL SERVER is not a right tool for this, actually it doesn't...
November 29, 2012 at 5:38 am
You could also use NULLIF (which is wrapper around CASE WHEN...)
SELECT
#Textsample.Event, CONVERT(DATE,NULLIF(#Textsample.Date,''),3)
from #TextSample
November 29, 2012 at 4:15 am
Hey, where are you? Mr. One Standard For All or You Can Port My Code To Alpha-Centaurus! :hehe:
I thought you will make another try...
Ok, I might help you a bit:
IBM...
November 29, 2012 at 4:05 am
Sorry for my a bit unorthodox view on " FizzBuzz" problem in T-SQL, but couldn't keep myself quiet :hehe:
I don't think it's a good T-SQL question at all..
Create a...
November 29, 2012 at 3:53 am
Viewing 15 posts - 826 through 840 (of 2,894 total)