|
|
-
MisterMagoo Commented 9 Months ago through Just Learned
Thanks - I haven't worked out how to do this quickly in my head though :(...
|
-
MisterMagoo Commented 9 Months ago through Just Learned
Thanks - I haven't worked out how to do this quickly in my head though :(...
|
-
MisterMagoo Commented 9 Months ago through Just Learned
Here is my method - tested on a whole year....
DECLARE @num INT
SET @num=366
SELECT @num AS theirNumber
, theMonth
, (@num - 31 * theMonth) / 12 AS theDay
FROM
(SELECT DUMMY = 1) base
OUTER APPLY (SE...
|
-
MisterMagoo Commented 9 Months ago through Just Learned
Here is my method - tested on a whole year....
DECLARE @num INT
SET @num=366
SELECT @num AS theirNumber
, theMonth
, (@num - 31 * theMonth) / 12 AS theDay
FROM
(SELECT DUMMY = 1) base
OUTER APPLY (SE...
|
-
MisterMagoo Answered 1 Years ago through Quizzes
HI Michael,
Thanks for taking the time to reply in such an informative and patient manner.
For the record, because I see how you read my comment, I don't believe that XQuery is actually "part of T-Sql" - I guess I meant that in this context I con...
|
-
MisterMagoo Answered 1 Years ago through Quizzes
Thanks for the question Michael, although I personally feel that your "alternative solution" breaks the spirit of the question rules 1 and 2.
Rule 1 says no t-sql joins, but you go ahead and use a comma join in the FLWOR expression, which is part of ...
|
-
MisterMagoo Answered 1 Years ago through Quizzes
I would say that the first query is NOT bad, especially when compared to the alternative.
The Function not only performs the calculation, but forces the parameters to be of suitable data types (INT and MONEY) and more importantly it returns a specifi...
|
-
MisterMagoo Answered 1 Years ago through Quizzes
Hello,
<BLOCKQUOTE>Why does SQL Server returns * for SELECT CAST(2004 as varchar(2)) and 20 for SELECT CAST('2004' as varchar(2))?</BLOCKQUOTE>
The first statement : <pre><code>CAST(2004 as VARCHAR(2))</code></pre> will attempt to perform a conver...
|
-
MisterMagoo Answered 1 Years ago through Quizzes
The problem is more complicated than the question implies because the results are dependent on the actual number being stored.
In the example given, the problem is one of presentation as can be displayed by the following query:
declare @floa...
|
-
MisterMagoo Answered 1 Years ago through Quizzes
In this case, as you want to remove approximately one third of the heap and because the heap size is not that great, I would use the "Reverse Logic" approach and actively keep the rows I don't want to delete....
BEGIN TRAN
-- modify the TO...
|