Viewing 15 posts - 121 through 135 (of 2,893 total)
...and the example was later extended for use as a TSQL recruiting test.
have you ever tried asking on interview what kind of results the following statement will produce:
SELECT COUNT(*)
:w00t:
there is...
June 19, 2014 at 9:42 am
I am very suspicient that you doing something wrong there....
But anyway, here is the answer:
DECLARE @ref AS CHAR(18)
SET @ref = REPLACE('8982214567.9999-Q199999999','-','.')
SELECT PARSENAME(@ref ,3) Part1,PARSENAME(@ref ,2) Part2,PARSENAME(@ref ,1) Part3
June 19, 2014 at 8:15 am
...
-- Query 4
SELECT c.*, o.*, ol.*
FROM #Customers c
LEFT JOIN #Orders o
INNER JOIN #Orderlines ol
ON ol.OrderID = o.OrderID
...
June 19, 2014 at 8:00 am
one of the manyways:
;WITH sample_data(val)
AS
(
SELECT '1.9999-Q1'
UNION SELECT '01.9999-Q11'
)
SELECT *, PARSENAME(x.namelike,3) Part1,PARSENAME(x.namelike,2) Part2,PARSENAME(x.namelike,1) Part3
FROM...
June 19, 2014 at 7:44 am
sqlnaive (6/19/2014)
Thanks a ton Eugene. 🙂 It's beautiful.I'll take care of the point you made about posting code.
I wouldn't call the above (my) code "beautiful", it looks like a pot...
June 19, 2014 at 4:44 am
...
Now I know the obvious way to find out if this is best or not is by testing the different options. I was wondering if there was a rule...
June 19, 2014 at 4:37 am
Add this to the end of your query (you better use code="sql" tag to format your code when posting here, otherwise your query end up as single line...):
;WITH tall
AS
(
SELECT *,...
June 19, 2014 at 4:28 am
Use Windows Authentication, and forget about "sending" user/password to SQL Server...
June 18, 2014 at 4:02 am
Eirikur Eiriksson (6/17/2014)
June 18, 2014 at 3:55 am
Yep, Gail's article conclusion tells that it doesn't matter what you type between SELECT and FROM in EXISTS query, as long it represents valid T-SQL sytax, SQL server always...
June 17, 2014 at 9:27 am
Apply your currency rate conversion before PIVOT:
....
(SELECT TrnYear, TrnMonth, CASE WHEN PostCurrency = 'GBP' THEN PostValue ELSE PostValue / PostConvRate END AS PostValue
FROM [ApInvoicePay]
Where TrnYear >= Year(...
June 17, 2014 at 9:11 am
Sorry Luis, help with what?
First of all it is a bit different topic. Second...
June 17, 2014 at 8:17 am
I know it is a very old thread, however, quite often, this exactly discussion comes up in different work places...
Is anyone have any material evidence that one syntax is better/faster...
June 17, 2014 at 7:19 am
... SQL Server doesn't really support code reuse in a useful way...
I would say that it's very arguable statement...
😉
May 23, 2014 at 8:35 am
Create a dedicated view for this or use dynamic SQL to build relevant query, as in your case INNER JOINs in the MASTER query ensures that complete "data-tree" exists.
If...
May 23, 2014 at 6:25 am
Viewing 15 posts - 121 through 135 (of 2,893 total)